Ansible
Running ad-hoc commands
ansible all --key-file <path to key-file> -i <inventory> -m <module>
Ansible config
ansible-config init --disabled > ansible.cfg Generate a commented-out sample config
[defaults] inventory = <inventory file> private_key_file = <path to key-file>
Useful commands
ansible all --list-hosts List target hosts
ansible all -m gather_facts List target facts
ansible all -m gather_facts --limit <host> List target facts, limited to <host>
Become
The sudo password must be the same on control and target nodes.
ansible all -m apt -a update_cache=true --become --ask-become-pass Run apt update with sudo and ask for password
ansible all -m apt -a "name=vim-nox state=latest" --become --ask-become-pass Install newest version of vim-nox
ansible all -m apt -a upgrade=full --become --ask-become-pass Upgrade all packages
ansible all -m apt -a upgrade=dist --become --ask-become-pass Full distribution upgrade, some say this may be dangerous