This is growing into a minimal Ansible reference of sorts, since Ansible’s own docs have nothing like a reference.


To check the ubuntu version, ansible_distribution_version|float < 18 (ansible_distribution_version is e.g. “16.04”):

"ansible_distribution_release": "bionic"
"ansible_distribution_version": "18.04"

Better error formatting from Put this in ansible.cfg:

# Use the YAML callback plugin.
stdout_callback = yaml
# Use the stdout_callback when running ad-hoc commands.
bin_ansible_callbacks = True

Just note that this can break output from ‘command’ or ‘ansible -m setup’, and you might need to disable it if you need that. Open issue:

Misc. stuff I need to file somewhere:

Ad-hoc command

ansible Host Patterns -m <module> [options]


$ ansible all -m ping –ask-pass

Shortcut to run a command:

$ ansible all -a “/bin/echo hello”

options: see output of “ansible –help” for now

See ansible ad-hoc commands doc for ad-hoc commands.