From 741bbca203c2316f250effda091c9e6ba14c8a85 Mon Sep 17 00:00:00 2001 From: Nicole Rappe Date: Thu, 14 Nov 2024 21:39:46 -0700 Subject: [PATCH] Update Servers & Workflows/Linux/Automation/Puppet/Puppet Bolt.md --- .../Linux/Automation/Puppet/Puppet Bolt.md | 92 +++++++++++++++++-- 1 file changed, 84 insertions(+), 8 deletions(-) diff --git a/Servers & Workflows/Linux/Automation/Puppet/Puppet Bolt.md b/Servers & Workflows/Linux/Automation/Puppet/Puppet Bolt.md index a5e76da..38b4031 100644 --- a/Servers & Workflows/Linux/Automation/Puppet/Puppet Bolt.md +++ b/Servers & Workflows/Linux/Automation/Puppet/Puppet Bolt.md @@ -13,18 +13,94 @@ sudo yum install -y puppet-bolt bolt --version # Clone Puppet Bolt Repository into Bolt Directory -sudo git clone https://git.bunny-lab.io/GitOps/Puppet-Bolt.git /etc/puppetlabs/bolt +#sudo git clone https://git.bunny-lab.io/GitOps/Puppet-Bolt.git /etc/puppetlabs/bolt <-- Disabled for now +sudo mkdir -p /etc/puppetlabs/bolt sudo chown -R $(whoami):$(whoami) /etc/puppetlabs/bolt sudo chmod -R 644 /etc/puppetlabs/bolt -sudo chmod -R u+rwx,g+rx,o+rx /etc/puppetlabs/bolt/modules/bolt +#sudo chmod -R u+rwx,g+rx,o+rx /etc/puppetlabs/bolt/modules/bolt <-- Disabled for now -# Initialize Bolt Project +# Initialize A New Bolt Project cd /etc/puppetlabs/bolt -bolt project init puppet_bolt +bolt project init bunny_lab ``` -## Validate Bolt Project is Initialized -If the command below is successful, you will see the custom `bolt::enroll_agent` plan listed. -``` sh -bolt plan show --project /etc/puppetlabs/bolt +## Configuring Inventory +At this point, you will want to create an inventory file that you can use for tracking devices. For now, this will have hard-coded credentials until a cleaner method is figured out. +``` yaml title="/etc/puppetlabs/bolt/inventory.yaml" +# Inventory file for Puppet Bolt +groups: + - name: linux_servers + targets: + - lab-auth-01.bunny-lab.io + - lab-auth-02.bunny-lab.io + config: + transport: ssh + ssh: + host-key-check: false + private-key: "/etc/puppetlabs/bolt/id_rsa_OpenSSH" # (1) + user: nicole + native-ssh: true + + - name: windows_servers + config: + transport: winrm + winrm: + realm: BUNNY-LAB.IO + ssl: true + user: "BUNNY-LAB\\nicole.rappe" + password: DomainPassword # (2) + groups: + - name: domain_controllers + targets: + - lab-dc-01.bunny-lab.io + - lab-dc-02.bunny-lab.io + - name: dedicated_game_servers + targets: + - lab-games-01.bunny-lab.io + - lab-games-02.bunny-lab.io + - lab-games-03.bunny-lab.io + - lab-games-04.bunny-lab.io + - lab-games-05.bunny-lab.io + - name: hyperv_hosts + targets: + - virt-node-01.bunny-lab.io + - bunny-node-02.bunny-lab.io ``` + +1. Point the inventory file to the private key (if you use key-based authentication instead of password-based SSH authentication.) +2. Replace this with your actual domain admin / domain password. + +### Validate Bolt Inventory Works +If the inventory file is created correctly, you will see the hosts listed when you run the command below: +``` sh +cd /etc/puppetlabs/bolt +bolt inventory show +``` + +??? example "Example Inventory Output" + You should expect to see output similar to the following: + ``` + [root@lab-puppet-01 bolt-lab]# bolt inventory show + Targets + lab-auth-01.bunny-lab.io + lab-auth-02.bunny-lab.io + lab-dc-01.bunny-lab.io + lab-dc-02.bunny-lab.io + lab-games-01.bunny-lab.io + lab-games-02.bunny-lab.io + lab-games-03.bunny-lab.io + lab-games-04.bunny-lab.io + lab-games-05.bunny-lab.io + virt-node-01.bunny-lab.io + bunny-node-02.bunny-lab.io + + Inventory source + /tmp/bolt-lab/inventory.yaml + + Target count + 11 total, 11 from inventory, 0 adhoc + + Additional information + Use the '--targets', '--query', or '--rerun' option to view specific targets + Use the '--detail' option to view target configuration and data + ```