How do I list all the fact variables for a given node?
Upgrade to the latest code from git today a previously working playbook stopped working.
This code is skipping Ubuntu machines
when: ansible_os_family == “Ubuntu”
At first I thought it was an issue against two new 14.04 machines I added, but it is failing the same against 12.04 machines.
This was working before… so I am trying to see what the playbook is seeing when it runs to adjust the playbook.
this will show all vars for a host, includes facts and inventory group and host vars.
debug: var=hostvars[inventory_hostname]
Not finding the right syntax… this is what I am trying:
tasks:
- name: Create user in Ubuntu systems
user: home=/home/{{item.uname}} name={{item.uname}} shell=/bin/bash state=present password={{item.passwd}} groups=sudo,adm
when: ansible_os_family == “Ubuntu”
with_items: Ops
- debug: var=hostvars[inventory_hostname]
Not sure if inventory_hostname was meant to be a literal… or to replaced it with an actual hostname… tried both… Neither worked. Do I put that in a playbook?
- debug: var=hostvars[inventory_hostname]
…
Not sure if inventory_hostname was meant to be a literal… or to replaced it with an actual hostname… tried both… Neither worked. Do I put that in a playbook?
Nervemind… had
debug: var=hostvars[[inventory_hostname]
Notice the double bracked… .once I removed second bracked… got values.
“ansible_os_family”: “Debian”
I guess that changed…
I guess will go with this:
“ansible_distribution”: “Ubuntu”