After helping someone on IRC he was interested to have this debug module in upstream. This module simply 'prints' a message, and can be ordered to fail if needed. It helps to troubleshoot or understand inventory/facts issues and/or experiment with statements and conditions using only_if.
Here is a small example playbook:
```yaml
- hosts: all
tasks:
- local_action: debug msg="System $inventory_hostname has uuid ${ansible_product_uuid}"
- local_action: debug msg="System $inventory_hostname lacks a gateway" fail=yes
only_if: "is_unset('$ansible_default_ipv4.gateway')"
- local_action: debug msg="System $inventory_hostname has gateway ${ansible_default_ipv4.gateway}"
only_if: "is_set('$ansible_default_ipv4.gateway')"
```
outputting:
```
[root@moria ansible]# ansible-playbook -v -l localhost:x220 test6.yml
PLAY [all] *********************
GATHERING FACTS *********************
ok: [localhost]
ok: [x220]
TASK: [debug msg="System $inventory_hostname has uuid $ansible_product_uuid"] *********************
ok: [localhost] => {"msg": "System localhost has uuid d125a48c-364f-4e65-b225-fed42ed61fac"}
ok: [x220] => {"msg": "System x220 has uuid d125a48c-364f-4e65-b225-fed42ed61fac"}
TASK: [debug msg="System $inventory_hostname lacks a gateway" fail=yes] *********************
failed: [localhost] => {"failed": true, "msg": "System localhost lacks a gateway", "rc": 1}
ok: [x220] => {"msg": "System x220 has gateway 192.168.1.1"}
PLAY RECAP *********************
localhost : ok=2 changed=0 unreachable=0 failed=1
x220 : ok=3 changed=0 unreachable=0 failed=0
```
I had some other plans for the module, like displaying host inventory and complete inventory to help understand inventory and facts modules, but that would require an action-plugin for transfering inventory information etc... And I am not sure this is wanted/best done in a module.
| Name |
Last commit
|
Last update |
|---|---|---|
| .. | ||
| apt | Loading commit data... | |
| apt_repository | Loading commit data... | |
| assemble | Loading commit data... | |
| async_status | Loading commit data... | |
| async_wrapper | Loading commit data... | |
| authorized_key | Loading commit data... | |
| command | Loading commit data... | |
| copy | Loading commit data... | |
| debug | Loading commit data... | |
| easy_install | Loading commit data... | |
| facter | Loading commit data... | |
| fail | Loading commit data... | |
| fetch | Loading commit data... | |
| file | Loading commit data... | |
| fireball | Loading commit data... | |
| get_url | Loading commit data... | |
| git | Loading commit data... | |
| group | Loading commit data... | |
| ini_file | Loading commit data... | |
| lineinfile | Loading commit data... | |
| mount | Loading commit data... | |
| mysql_db | Loading commit data... | |
| mysql_user | Loading commit data... | |
| nagios | Loading commit data... | |
| ohai | Loading commit data... | |
| pause | Loading commit data... | |
| ping | Loading commit data... | |
| pip | Loading commit data... | |
| postgresql_db | Loading commit data... | |
| postgresql_user | Loading commit data... | |
| raw | Loading commit data... | |
| seboolean | Loading commit data... | |
| selinux | Loading commit data... | |
| service | Loading commit data... | |
| setup | Loading commit data... | |
| shell | Loading commit data... | |
| slurp | Loading commit data... | |
| subversion | Loading commit data... | |
| supervisorctl | Loading commit data... | |
| template | Loading commit data... | |
| user | Loading commit data... | |
| virt | Loading commit data... | |
| wait_for | Loading commit data... | |
| yum | Loading commit data... |