Ansible: inventory, modules and one-off commands
cheat sheet · Ansible 2.16 https://lab.dimsanych.ru/en/wiki/ansible/Cheat sheet
-
ansible -i hosts.ini all -m pingreach all machines -
ansible -i hosts.ini all --list-hostswho a command will touch -
ansible-inventory -i hosts.ini --graphgroups and machines -
ansible -i hosts.ini web -m command -a 'uptime'run a command -
ansible -i hosts.ini web -m copy -a 'src=a.conf dest=/tmp/a.conf' -
ansible -i hosts.ini web -b -m service -a 'name=nginx state=started' -
ansible -i hosts.ini all -m ping -oone-line answers -
ansible-playbook -i hosts.ini site.ymla playbook