Skip to content

Ansible basics

Config

ansible-config dump

First tests

ansible all --list-hosts

ansible all -m ping

ansible {host} -m setup

Get facts

ansible {host} -m setup

Run playbooks

Verbose mode

ansible-playbook playbook/cloud.yml -vvv
For specified host(s)
ansible-playbook playbook/cloud.yml --limit {host}
With special tags
ansible-playbook playbook/cloud.yml --tags nginx,cron_job
Skip tags
ansible-playbook playbook/cloud.yml --skip-tags nginx

Inventories

ansible-doc -t inventory -l