Open main menu

Changes

980 bytes added ,  23:22, 15 September 2016
add example commands
== Example Commands ==
Note: control verbosity with <code>-vvvv</code># <code>ansible -c local -i ~/ansible_hosts -m ping all</code> ping all the hosts in the inventory file
# <code>ansible -m setup wiki.example.com</code> will show you all the ansible 'facts' (aka [[ansible_variables]]) about that host.
# <code>ansible all -m setup -a "filter=ansible_distribution*"</code> use a filter action to see specific variables
#<code>ansible -m debug -a "var=hostvars['wiki.example.com']" localhost</code> gives you the '[[ansible hostvars]]'
# <code>ansible-playbook play1.yml play2.yml</code> Run multiple playbooks
# <code>ansible-playbook -i production webservers.yml --tags ntp '''--list-tasks'''</code> confirm what task names would be run if I ran this command and said "just ntp tasks"
# <code>ansible-playbook '''--list-tags''' launch.yml</code> see what tags exist in my playbook (the tasks list shows more detail + the tags)
# <code>ansible-playbook -i production webservers.yml --limit boston '''--list-hosts'''</code> confirm what hostnames might be communicated with if I said "limit to boston" <ref>Choosing which host(s) to operate on https://docs.ansible.com/ansible/intro_patterns.html</ref>
# <code>~/bin/ansible/contrib/inventory/digital_ocean.py --list --pretty --api-token TOKEN_HERE</code> use the DO api to list your droplets (dynamic inventory)
# <code>ansible-playbook -vvv launch.yml -l wiki.example.com --user=root -e do_name=wiki.example.com '''--start-at-task'''='remove empty wiki schema from database if it already exists'</code> start at a particular point in the task list
== Variables ==
4,558

edits