With the –check parameter a dry run is possible.
ansible-playbook -i hosts --check myservice.yml
Use the parameter “–start-at-task=<TASKNAME>” on your call to ansible-playbook.
ansible-playbook -i hosts myPlaybook.yml --start-at-task="test echo"
Or use “–step” and there will be a question for all tasks if you want to proceed to the next.
ansible-playbook -i hosts myPlaybook.yml --step
List hosts targeted in a playbook.
ansible-playbook myPlaybook.yml --list-hosts
List all tasks in a playbook. This may be usefull to gather an overview of a big amount of tasks in a plabook.
ansible-playbook myPlaybook.yml --list-tasks
Take use of the debug module.
- name: test echo
shell: echo I failed
register: output
- debug: msg="Okay stop the playbook"
failed_when: output.stdout.find('failed')!=-1
Use debug module to debug a variable or dictionaries. The task ‘test echo’ will only be run when verbosity from commandline matches the given verbosity level.
- shell: /usr/bin/uptime
register: output
- name: test echo
debug: var=output verbosity=1
ansible-playbook -i hosts myPlaybook.yml -v
Append the known -v (verbose) parameter to your ansible or ansible-playbook command
ansible testServer -i hosts -m ping -vvvv