In Bolt, we have to explicitly list the nodes that we want to manage. We can do this via the --nodes command flag, or by providing an inventory file. An inventory file is a YAML file that contains groups of nodes, with configuration options already set. By default, an inventory file placed at ~/.puppetlabs/bolt/inventory.yaml will be used by Bolt. For this section, we'll only be targeting our Puppet Master, so I'll ensure that it is in the inventory file:
# ~/.puppetlabs/bolt/inventory.yaml
---
groups:
- name: puppetserver
nodes:
- pe-puppet-master.puppet.net
config:
transport: ssh
ssh:
user: root
Before I can run Bolt to that server, I'm going to need to ensure that my SSH key is available as the root user on that system. I'll use the ssh-copy-id utility to transfer this from my UNIX-based system to the root user:
rary at Ryans-MacBook in ~/workspace/packt
$ ssh-copy-id [email protected]
/usr/bin/ssh-copy-id: INFO: attempting to log in with the new key(s), to filter out any that are already installed
/usr/bin/ssh-copy-id: INFO: 1 key(s) remain to be installed -- if you are prompted now it is to install the new keys
[email protected]'s password:
Number of key(s) added: 1
Now try logging into the machine, with: "ssh '[email protected]'"
and check to make sure that only the key(s) you wanted were added.