Got the same output using ansible 2.4:
"ansible_distribution": "Arch Linux",
"ansible_distribution_file_parsed": true,
"ansible_distribution_file_path": "/etc/os-release",
"ansible_distribution_file_variety": "NA",
"ansible_distribution_major_version": "NA",
"ansible_distribution_release": "NA",
"ansible_distribution_version": "NA",
the "ansible_distribution_file_path" is new from 2.3 and may be the source
of the infos instead of hardcoded ones, hence "Arch Linux"
Le lundi 24 juillet 2017 15:37:34 UTC+2, mdl a écrit :
>
> Thank you so much for your reply Mathias.
>
> Version:
> me@host ~> ansible --version
> 2
> ansible 2.4.0
> config file = /etc/ansible/ansible.cfg
> configured module search path = [u'/home/me/.ansible/plugins/modules', u
> '/usr/share/ansible/plugins/modules']
> ansible python module location = /usr/lib/python2.7/site-packages/
> ansible
> executable location = /usr/bin/ansible
> python version = 2.7.13 (default, Feb 11 2017, 12:22:40) [GCC 6.3.1
> 20170109]
>
> I just tried your example playbook in my computer and got:
> me@host ~/Ansible> cat /etc/os-release
> NAME="Arch Linux"
> PRETTY_NAME="Arch Linux"
> ID=arch
> ID_LIKE=archlinux
> ANSI_COLOR="0;36"
> HOME_URL="https://www.archlinux.org/"
> SUPPORT_URL="https://bbs.archlinux.org/"
> BUG_REPORT_URL="https://bugs.archlinux.org/"
>
> me@host ~/Ansible> ansible-playbook arch-test.yml | grep ansible_os
> "ansible_os_family": "Arch Linux",
> "ansible_os_family": "Arch Linux",
> "ansible_os_family": "Arch Linux",
> "ansible_os_family": "Arch Linux",
>
> Is version 2.4.0 to blame here?
>
> El lunes, 24 de julio de 2017, 10:18:13 (UTC-3), Mathias Ettinger escribió:
>>
>> Using ansible 2.3.1.0 and the following playbook:
>>
>> - hosts: localhost
>> tasks:
>> - debug: msg={{ vars }}
>>
>> I get, amongst others: "ansible_os_family": "Archlinux", and
>> "ansible_distribution": "Archlinux",
>>
>> What version are you using?
>>
>>
>> Le vendredi 21 juillet 2017 18:32:16 UTC+2, mdl a écrit :
>>>
>>> I'm testing Ansible roles with Archlinux and one of them uses
>>> ansible_os_family to include variables or tasks. So I have:
>>> - name: include OS vars
>>> include_vars: "{{ ansible_os_family }}.yml"
>>> when: ansible_os_family == 'Archlinux'
>>>
>>> Problem is that ansible_os_family gets 'Arch Linux' as value, so ansible
>>> looks for 'Arch Linux.yml' but filename is actually 'Archlinux.yml', just
>>> capital A and no spaces. I know this is not a fancy bug or anything, I've
>>> been looking at ansible code and GitHub issues but only found OS_FAMILY_MAP
>>> (Code here
>>> <https://github.com/ansible/ansible/blob/devel/lib/ansible/module_utils/facts/system/distribution.py>)
>>>
>>> and Arch seems to be defined as 'Archlinux' but never 'Arch Linux'.
>>>
>>> Could anyone guide me because I do not know if something changed with
>>> /etc/os-release in Archlinux or maybe a bug needs to be reported to update
>>> variables like OS_FAMILY_MAP.
>>>
>>> Thanks in advance.
>>>
>>
--
You received this message because you are subscribed to the Google Groups
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/ansible-project/c355b604-889e-442f-863a-c5ec41de2779%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.