yakshaveinc / linux

software engineering for Linux projects
The Unlicense
1 stars 3 forks source link

Ansible tutorial/cheatsheet #17

Open abitrolly opened 5 years ago

abitrolly commented 5 years ago
  1. Create inventory and ping all hosts

    ansible -i inventory all -m ping
  2. Ping all hosts in internal network by connecting through machine with external IP

    ansible -i inventory all --ssh-common-args='-o ProxyCommand="ssh -W %h:%p user@example.com"' -m ping

    https://docs.ansible.com/ansible/latest/reference_appendices/faq.html#how-do-i-configure-a-jump-host-to-access-servers-that-i-have-no-direct-access-to

  3. Append my SSH key to all hosts from inventory

    ansible -i inventory all -m authorized_key -a "user=ubuntu key='https://gitlab.com/abitrolly.keys'"