List tasks and hosts without running

Preview the run: every task and the final target hosts, without connecting to them

ansible-playbook site.yml --list-tasks --list-hosts -i prod

tool
ansible56 commands
tags
ansibledebugtroubleshooting

More ansible commands

  • ANSIBLE_CALLBACKS_ENABLED=profile_tasks ansible-playbook site.yml

    Sort tasks by run time to find the slow steps; profile_roles does the same per role

  • ANSIBLE_KEEP_REMOTE_FILES=1 ansible-playbook site.yml -vvvv --limit <host>

    Keep the module scripts Ansible pushed to ~/.ansible/tmp, so you can debug a failing module by hand

  • ansible-playbook -i inventory/prod playbook.yml --diff

    Run a playbook with --diff to see what it changes

  • ansible-playbook -i inventory playbook.yml --limit host1,host2

    Run only on the listed hosts from the inventory

  • ansible-playbook -i inventory playbook.yml --tags install,configure

    Run only the tasks with these tags

all 56 ansible commands