[clug] Ansible getting distribution

Bob Edwards bob at cs.anu.edu.au
Tue Jul 21 11:51:38 UTC 2020


Hi all,

Am kinda enjoying my journey with Ansible so far - it is very similar to
Saltstack in lots of ways, but also different...

At the moment, I am trying to find a consistent way to get the 
distribution of an Ansible "remote" ("minion" in Saltstack-speak). I
have gathered some "facts" on some remotes using:
$ ansible -i inventory $machinename -m setup > $machinename.facts

Then, when I go to find out the distribution (the "id": field is in
"ansible_lsb": {}):

cecsit at ansible:/tmp$ grep '"id":' *facts
csitnode53.facts:            "id": "8000.fe1ad6a31b29",
csitnode53.facts:            "id": "Debian",
csittest.facts:            "id": "Ubuntu",
focaltmp1.facts:            "id": "Ubuntu",
focaltmp3.facts:            "id": "Ubuntu",

cecsit at ansible:/tmp$ grep '"ansible_distribution":' *facts
csitnode53.facts:        "ansible_distribution": "Debian",
csittest.facts:        "ansible_distribution": "Ubuntu",
wallaman.facts:        "ansible_distribution": "Debian",

so, some report distribution in "ansible_distribution", others in
"ansible_lsb.id" and some in both...

Any clues as to why they are divergent? My DuckDuckGo foo is not helping
me...

cheers,
Bob Edwards.



More information about the linux mailing list