Skip to content

Ansible

All Ansible commands run from the ansible/ directory, with credentials loaded from .env into the shell:

Terminal window
cd ansible
export $(cat .env | grep -v '^#' | xargs)
InventoryUse
inventory/proxmox.proxmox.ymlDynamic — every VM and LXC, discovered from the Proxmox API
inventory/hosts.iniStatic localhost, for playbooks that run on the controller

Guests are grouped by Proxmox node and by Proxmox tag, so a guest tagged docker lands in tag_docker. restart-docker-stacks.yml targets proxmox_all_running.

Full detail: Inventory.

PlaybookWhat it does
restart-docker-stacks.ymlRestarts every running Compose stack with BWS secrets injected
setup_new_machine.ymlBaseline configuration for a freshly created guest
setup-step-ca-client.ymlTrusts the internal CA on a host
distribute-bws-token.ymlInstalls /etc/bws/token so bws works on the host
system-update.ymlPackage updates across the fleet
prune-docker-images.ymlReclaims disk from unused images
configure-lxc-mounts.ymlApplies LXC bind-mount configuration
clear-bash-history.ymlClears shell history on target hosts
test-playbook.yml / test-proxmox-hosts.ymlConnectivity and inventory checks
Terminal window
# Fleet-wide
ansible-playbook -i inventory/proxmox.proxmox.yml playbooks/<playbook>.yml
# Scoped
ansible-playbook -i inventory/proxmox.proxmox.yml playbooks/<playbook>.yml --limit arcane
ansible-playbook -i inventory/proxmox.proxmox.yml playbooks/<playbook>.yml --limit 'arcane,traefik'
# Dry run
ansible-playbook -i inventory/proxmox.proxmox.yml playbooks/<playbook>.yml --check --diff

This is the playbook that matters most day to day, because it is the supported way to apply secrets:

Terminal window
ansible-playbook -i inventory/proxmox.proxmox.yml playbooks/restart-docker-stacks.yml
# One host, no secret injection
ansible-playbook -i inventory/proxmox.proxmox.yml playbooks/restart-docker-stacks.yml \
--limit traefik -e bws_inject_secrets=false
VariableDefaultMeaning
restart_timeout600Per-stack timeout in seconds
bws_inject_secretstrueWrap each restart in bws run
bws_project_idLimit injection to one BWS project UUID

docker compose ls is called without a status filter; its default output already includes only stacks with at least one running container.

Three custom roles, all idempotent and safe to re-run:

From ansible/ansible.cfg: remote user is unknown224, become is off by default (pass --become or set become: true in the play), facts are cached as JSON in /tmp/ansible_facts for one hour, and logs are written to ansible/ansible.log.