Debugging Ansible Role on localhost
I used to write bash scripts for all my automation needs. But over the last few years, I’ve been pleasantly surprised by how well Ansible works for provisioning. I’ve found that it is far more readabile and reusable.
Below are some snippets for debugging.
Check hostname:
ansible localhost -m command -a "hostname"
This is for running a specific role without having to create or update a playbook:
ansible localhost -m ansible.builtin.include_role -a name=myrole
Some resources: