Running playbooks
Run a playbook
Section titled “Run a playbook”export NETBOX_API_KEY=$(op item get --vault "HomeLab" "Netbox" --fields "api_token" --reveal)ansible-playbook <playbook> \ -i ../inventory.netbox.yaml \ -e "@../vault.yaml" \ --vault-password-file ../../.vault-passThe dynamic inventory is the Netbox plugin (inventory.netbox.yaml); the
vault.yaml decryption uses the gitignored .vault-pass file at the repo
root. Set NETBOX_API_KEY from 1Password as above so the plugin can list
hosts.
Create the ansible user on a fresh VM
Section titled “Create the ansible user on a fresh VM”Run once per VM that ansible will manage. Hat-tip to /etc/skel for the
shell rc setup.
useradd -G sudo --system --user-group --create-home --skel /etc/skel --shell /bin/bash ansibleBuild base VM templates
Section titled “Build base VM templates”ansible-playbook 00-create-base-templates/create-base-templates.yaml \ -i 00-create-base-templates/inventory.yaml \ -e "@./vault.yaml" \ --vault-password-file ../.vault-pass -vvAdd --skip-tags "alpine.ct" if you want to skip the Alpine container
template (e.g. you don’t need it on a refresh).