12.05.15





ANSIBLE PLAYBOOK COMMANDS





Check Mode

(“Dry Run”) ansible-playbook myplaybook.yml --check

Does a dry run and shows a preview without executing the playbook.

Check mode is just a simulation.


Check Syntax

ansible-playbook myplaybook.yml --syntax-check

Does a check for syntax errors.


Check Tags

ansible-playbook myplaybook.yml --tags httpd

Runs a specific part of the configuration that is tagged without running the whole playbook ex: a tag called "httpd".


List Tags

ansible-playbook myplaybook.yml --list-tags

Lists all tags in a playbook.


Skip Tags

ansible-playbook myplaybook.yml --skip-tags httpd

Skips a specific part of the configuration that is tagged while running the rest of the playbook.

Here it skips a tag called httpd.


List Tasks

ansible-playbook myplaybook.yml --list-tasks

List all tasks in a playbook.


Start-at-task

ansible-playbook myplaybook.yml --start-at-task="install packages"

Runs the playbook from the task named “install packages”


Step

ansible-playbook myplaybook.yml --step

ANSIBLE will stop on each task, and ask if the task should be executed.

Say you had a task called “configure ssh”, the playbook run will stop and ask:

Perform task: configure ssh (y/n/c):

Answering “y” will execute the task,

Answering “n” will skip the task

Answering “c” will continue executing all the remaining tasks without asking.