[clug] Ansible getting distribution

Bob Edwards bob at cs.anu.edu.au
Tue Jul 21 23:21:19 UTC 2020


Thanks to those who replied.

Turns out that to get the "ansible_lsb" facts, you need the lsb-release
package installed, which some Debian installs included, and others
didn't, but all Ubuntu installs did.

I'll make sure it is installed in future... before running ansible...

cheers,
Bob Edwards.

On 21/7/20 9:51 pm, Bob Edwards via linux wrote:
> 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