Skip to content

Instantly share code, notes, and snippets.

@arthuralvim
Created January 30, 2019 13:14
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save arthuralvim/2644f941d9ff03be98bdf32356a3b439 to your computer and use it in GitHub Desktop.
Save arthuralvim/2644f941d9ff03be98bdf32356a3b439 to your computer and use it in GitHub Desktop.
Ansible Commands

Install

$ pip install ansible

Basic

$ ansible-playbook -i inventory <playbook.yml> -l <host_scope>

Maximum Verbose

$ ansible-playbook -i inventory <playbook.yml> -l <host_scope> -vvvv

Using Extra Vars

$ ansible-playbook -i inventory <playbook.yml> -l <host_scope> --extra-vars "ex_var=master environ=prod ip_master='33.34.35.36'"

Only Tags

$ ansible-playbook -i inventory <playbook.yml> -l <host_scope> --tags <role-tag>,<role-tag-2>

Skip Tags

$ ansible-playbook -i inventory <playbook.yml> -l <host_scope> --skip-tags <role-tag>,<role-tag-2>

List Tasks

$ ansible-playbook -i inventory <playbook.yml> -l <host_scope> --list-tasks

List Hosts

$ ansible-playbook -i inventory <playbook.yml> -l <host_scope> --list-hosts

Starting at Specific Task

$ ansible-playbook -i inventory <playbook.yml> -l <host_scope> --start-at-task="name of the task"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment