Skip to main content
Kill -9 Club
Sign in

ansible-playbook

AutomationPackage: ansible-core

Applies a playbook: each task compares the described state with the present one and acts only on the difference, then the recap counts what changed. --check --diff shows what a run would do without writing anything; it is the command to run before the first real run, and after every edit to the playbook.

What its options do in the lessons

From the same glossary the lessons render under their commands, so the two cannot disagree.

ansible-playbook --ask-vault-pass
Asks for the vault password at the keyboard, once per run: the choice for a machine where a password file would be worse than typing it.
ansible-playbook --check
Dry-runs the playbook: every module reports what it would change without writing anything to the machine.
ansible-playbook --diff
Shows, for every file a task changes, the difference between the present state and the described one — with --check, what a run would do, line by line.
ansible-playbook --force-handlers
Runs the notified handlers even when a later task in the play fails: without it, the play stops at the failure and an already changed file leaves the service on the old configuration.
ansible-playbook --list-tasks
Prints the tasks the playbook would run, play by play, without running anything — the list of what the playbook claims about the machine, with no Gathering Facts and no handlers.
ansible-playbook --syntax-check
Parses the playbook and the files it includes, then stops: the YAML is valid and every task names a module that exists. No host is contacted and nothing is run.
ansible-playbook --vault-password-file
Reads the vault password from that file, one line and nothing else, instead of asking for it. The file belongs outside the repository; ansible.cfg can name its path with vault_password_file.
ansible-playbook -v
Prints the JSON result each task returns, not just ok or changed — including the values a task handled, unless it carries no_log: true.

Lessons that teach it