2. Meet our Presenters
BOLT WORKSHOP2
John Laffey
Senior Sales Engineer, NorCal
â The O.G. Party Llama
â Been around for a couple of years
â Enjoys long walks on the beach, playing
the soprano kazoo, and romantic CI/CD
talks
Jerry Mozes
Senior Solutions Engineer, West
jerry@puppet.com
â Lifelong Learner
â 25 years of Enterprise IT
â Enjoy hiking, biking, fishing and camping
Matt Stone
Guru Extraordinaire , Puppet
⢠Puppet on Windows SME
⢠Rock and rolls all night and part of every
day.
⢠is not crying, you're crying.
Ryan Russell-Yates
Senior Sales Engineer, Pacific Northwest
Author of Mastering Puppet 5
Puppet User since 2013
Puppet Instructor since 2015
4. Progress⌠But
BOLT WORKSHOP4
VMware Cloud Foundation/Builder
Hybrid-Cloud Software Defined Data Center
VMware Cloud Services
vRealize Suite
Virtual Server, Network, and Storage Infrastructure
Windows Admin Linux Admin Database Admin Webserver Admin
AcceleratedDelivery
Manual OS/App Configuration
Scripts, No Documentation, No Sharing, Not Scalable
SlowProcess
Operator
5. Create More Speed
BOLT WORKSHOP5
VMware Cloud Foundation/Builder
Hybrid-Cloud Software Defined Data Center
VMware Cloud Services
vRealize Suite
Virtual Server, Network, and Storage Infrastructure
Windows Admin Linux Admin Database Admin Webserver Admin
AcceleratedDeliveryAcceleratedProcess
Operator
Automate with Scale
Orchestrated Plans
Sharable Tasks
Documented Scripts
6. All About Bolt
⢠Bolt provides a simple way to execute agentless automation against remote hosts
⢠Zero requirements to the remote host. No agents, no python, nothing thatâs not native
⢠Authenticate via SSH, WinRM, PCP
⢠Execute arbitrary commands, scripts, Bolt Tasks and Bolt Plans
⢠Use scripts in any language the remote host can execute
⢠Mature at your own pace from scripts â tasks â plans â puppet code
⢠If you have Puppet Enterprise, leverage PE from Bolt
BOLT WORKSHOP6
7.
8. Environment Setup
⢠Create a Bolt playground directory (i.e. ~/boltworkshop or c:usersyouboltworkshop)
⢠Create a Boltdir within your playground directory (i.e. ~/boltworkshop/Boltdir)
⢠Grab the Linux cert:
⢠Web Browser Method
⢠Visit https://db4820-1.classroom.puppet.com/download/student.pem
⢠Log in as client0@puppet.com
⢠Store the contents in your Bolt playground directory as student.pem.
⢠i.e. ~/boltworkshop/Boltdir/student.pem
⢠c:usersyouboltworkshopBoltdir/student.pem
⢠Lab Info â https://bit.ly/boltws-cmds4lab
BOLT WORKSHOP8
9. Using Bolt
⢠Bolt command line syntax:
bolt [command|script|task|plan] run <name> --targets <targets> [options]
⢠To run a simple Bash command on a remote SSH host:
bolt command run 'echo Hello World!' --targets 10.0.0.1,10.0.0.2
--user root --private-key /path/to/key --transport ssh --no-host-key-check
⢠To run a simple PowerShell command on a remote WinRM host:
bolt command run 'write-host Hello World!' --targets 10.0.0.1,10.0.0.2
--user Administrator --password âPuppetlabs!' --transport winrm --no-ssl
BOLT WORKSHOP9
11. Lab One Instructions (A Long Command For A Ping!)
⢠Student Bolt Instances
Linux: db4820-$nix#.classroom.puppet.com (Use fqdn replacing $ with environment number and
replacing # with student number you chose when we started)
Windows: db4820-$win#.classroom.puppet.com (Use fqdn replacing $ with environment number
and replacing # with student number you chose when we started)
⢠Credentials
Linux: centos / student.pem
Windows: Administrator / Puppetlabs!
⢠Run these from the command line
bolt command run 'ping 8.8.8.8 -c2' --targets <linux_node>
--user centos --private-key ./Boltdir/student.pem --no-host-key-
check
bolt command run 'ping 8.8.8.8 ân 2â --targets <win_node> --user
Administrator --password Puppetlabs! --transport winrm --no-sslBOLT WORKSHOP11
12. Easing Bolt Configuration
http://www.puppet.com/docs/bolt
⢠Bolt provides ways to make repetitive tasks more efficient
⢠Use a bolt.yaml file to store generic settings like modulepath or PE integration
⢠Use an inventory.yaml file to prevent typing in connection info every time
⢠Use a Boltdir to bundle all the files you need and have Bolt automatically use it
BOLT WORKSHOP12
13. Bolt Configuration File
⢠Bolt supports a configuration file to manage default configuration settings
⢠The configuration file is YAML and can have any name you want
⢠If unspecified, Bolt will look in these locations for a configuration file
⢠./Boltdir/bolt.yaml
⢠~/.puppetlabs/bolt/bolt.yaml (~ = %HOMEPATH%)
⢠A custom configuration file can be specified at runtime with --configfile [full
path]
BOLT WORKSHOP13
16. Lab Two Instructions (Making some Defaults)
1. Create a Boltdir directory in your playground folder
2. Create Boltdir/bolt.yaml in your bolt playground folder.
3. add host-key-check: false to SSH section of bolt.yaml and ssl: false to
WinRM section of bolt.yaml
ssh:
host-key-check: false
winrm:
ssl: false
3. Run commands to targets without specifying these 2 options
bolt command run 'ping 8.8.8.8 -c2' --targets <linux_node>
--user centos --private-key ./Boltdir/student.pem
bolt command run 'ping 8.8.8.8 ân 2â --targets <win_node> --user Administrator
--password Puppetlabs! --transport winrm
BOLT WORKSHOP16
17. Bolt Inventory
⢠Bolt supports an inventory file to maintain a list of known targets
⢠The inventory file is YAML and can have any name you want
⢠If unspecified, Bolt will look in these locations for an inventory file:
⢠./Boltdir/inventory.yaml
⢠~/.puppetlabs/bolt/inventory.yaml (~ = %HOMEPATH%)
⢠A custom inventory file can be specified on the command line with --inventoryfile
[full path]
⢠A custom inventory file can be specified in bolt.yaml with the inventoryfile keyword.
BOLT WORKSHOP17
20. Lab Three Reference
1. Create an inventory.yaml in your workshop folder
2. One group for your Linux node, connecting over SSH
3. One group for your Windows node, connecting over WinRM
Reference:
https://bit.ly/boltws-invfileyaml
Note:
â Youâll need to use your student number in the provided file. Replace #
BOLT WORKSHOP20
22. Lab Four Reference (Using our Inventory)
1. Run bolt command run 'ping 8.8.8.8 -c2â --targets linux
1. Run bolt command run 'ping 8.8.8.8 -n 2â --targets windows
1. Run bolt command run 'hostnameâ --targets linux,windows
BOLT WORKSHOP22
23. The Boltdir
To assist in packaging Bolt with source code, Bolt supports a Boltdir
When Bolt sees a directory called ./Boltdir it overrides all other configuration
The Boltdir has the following structure:
./Boltdir/bolt.yaml # Configuration settings
./Boltdir/inventory.yaml # Node inventory
./Boltdir/Puppetfile # Additional Forge modules â https://forge.puppet.com
./Boltdir/modules # Path where modules are installed via Puppetfile
./Boltdir/site # Another modulepath, safe from Puppetfile
./Boltdir/modules/mymod/tasks # Bolt Tasks in module âmymodâ
./Boltdir/modules/mymod/plans # Bolt Task Plans in module âmymodâ
BOLT WORKSHOP23
24. Running Scripts
⢠Bolt will copy the script file to the remote host and run it in the native shell
⢠Linux = Bash
⢠Windows = Powershell
⢠Bolt expects the shell to execute the correct parser (based on file extension)
⢠You can pass arguments, but Bolt doesnât do input validation for scripts
bolt script run <script> [[arg1] ... [argN]] [options]
BOLT WORKSHOP24
26. Lab Five Instructions (Running a Script)
1. On your laptop, recreate the time_sync.ps1 script at http://bit.ly/boltws-time_syncps
⢠Place this file above your Boltdir, in our ~/boltworkshop directory
2. From our boltworkshop directory: Use Bolt to run the script on your Windows node
bolt script run time_sync.ps1 --targets windows
BOLT WORKSHOP26
27. What did we cover?
⢠Using Bolt to scale and run commands across multiple
types of operating systems (Windows, Linux)
⢠Using the Bolt yaml files to define how we execute
efficiently using commands and scripts
⢠Using Bolt to execute existing scripts customers may
have from a single admin desktop across multiple nodes
BOLT WORKSHOP27
28. Whatâs on tap for next week!
⢠Tasks â Taking our scripts and make them
documented with usable parameters
⢠Plans â Creating orchestration around multi-task
needs to accomplish deeper automation
⢠Using Puppet modules with Bolt to perform
declarative automation
BOLT WORKSHOP28