Run ad-hoc shell command ansible
Execute a shell command on all webservers with sudo (-b)
ansible webservers -i inventory.ini -m shell -a 'df -h' -b
more ansible
all 56 commands →
Gather facts for a host
ansible myhost -i inventory.ini -m setup | jq '.ansible_facts.ansible_distribution'
Run playbook with tags
ansible-playbook site.yml -i inventory.ini --tags 'nginx,ssl'
Skip specific tags
ansible-playbook site.yml -i inventory.ini --skip-tags 'slow,optional'
Encrypt variable with Vault
ansible-vault encrypt_string 'mysecretpassword' --name 'db_password'
Limit to specific hosts
ansible-playbook deploy.yml -i inventory.ini --limit 'web01,web02'