Where to start First steps track · 15 stages
Linux Labs

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 ping reach all machines
  • ansible -i hosts.ini all --list-hosts who a command will touch
  • ansible-inventory -i hosts.ini --graph groups 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 -o one-line answers
  • ansible-playbook -i hosts.ini site.yml a playbook
Loading…