Some Ansible snippets

Some useful Ansible snippets

Some Ansible snippets

Examples

Install Ansible

# install/update `pip`
pip install -UY pip

# install ansible (via pip)
pip install ansible

# check the install version
ansible --version

Other commands

# list of connection plugins for ansible "control node" to connect to "managed nodes"
ansible-doc -t connection -l

# see various ad-hoc ansible commands
# eg. ansible -m copy -a "src=master.gitconfig dest=~/.gitconfig" localhost
ansible <TAB>

Useful things to know

# machine level host file location
/etc/ansible/hosts

# ansible modules: https://docs.ansible.com/ansible/latest/collections/index_module.html