Skip to content

Running playbooks

Terminal window
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-pass

The 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.

Run once per VM that ansible will manage. Hat-tip to /etc/skel for the shell rc setup.

Terminal window
useradd -G sudo --system --user-group --create-home --skel /etc/skel --shell /bin/bash ansible
Terminal window
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 -vv

Add --skip-tags "alpine.ct" if you want to skip the Alpine container template (e.g. you don’t need it on a refresh).