# Archlinux OS Family issue

**URL:** <https://forum.ansible.com/t/archlinux-os-family-issue/25048>\
**Category:** Ansible Project\
**Created:** [July 21, 2017, 4:32pm UTC](https://forum.ansible.com/t/archlinux-os-family-issue/25048 "2017-07-21T16:32:16Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![mdl](https://avatars.discourse-cdn.com/v4/letter/m/b38774/32.png) [@mdl](https://forum.ansible.com/u/mdl)\
**Post date:** [July 21, 2017, 4:32pm UTC](https://forum.ansible.com/t/archlinux-os-family-issue/25048/1 "2017-07-21T16:32:16Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![Mathias\_Ettinger](https://avatars.discourse-cdn.com/v4/letter/m/d6d6ee/32.png) [@Mathias\_Ettinger](https://forum.ansible.com/u/Mathias_Ettinger)\
**Post date:** [July 24, 2017, 1:18pm UTC](https://forum.ansible.com/t/archlinux-os-family-issue/25048/2 "2017-07-24T13:18:13Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![mdl](https://avatars.discourse-cdn.com/v4/letter/m/b38774/32.png) [@mdl](https://forum.ansible.com/u/mdl)\
**Post date:** [July 24, 2017, 1:37pm UTC](https://forum.ansible.com/t/archlinux-os-family-issue/25048/3 "2017-07-24T13:37:34Z")

</div>

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/](https://www.archlinux.org/)”  
SUPPORT\_URL=“[https://bbs.archlinux.org/](https://bbs.archlinux.org/)”  
BUG\_REPORT\_URL=“[https://bugs.archlinux.org/](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?

---

<div class="post-metadata">

**Author:** ![Mathias\_Ettinger](https://avatars.discourse-cdn.com/v4/letter/m/d6d6ee/32.png) [@Mathias\_Ettinger](https://forum.ansible.com/u/Mathias_Ettinger)\
**Post date:** [July 24, 2017, 2:07pm UTC](https://forum.ansible.com/t/archlinux-os-family-issue/25048/4 "2017-07-24T14:07:14Z")

</div>

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”

---

<div class="post-metadata">

**Author:** ![mdl](https://avatars.discourse-cdn.com/v4/letter/m/b38774/32.png) [@mdl](https://forum.ansible.com/u/mdl)\
**Post date:** [July 24, 2017, 2:27pm UTC](https://forum.ansible.com/t/archlinux-os-family-issue/25048/5 "2017-07-24T14:27:59Z")

</div>

I saw [this](https://github.com/ansible/ansible/pull/15675) issue at GitHub where people requested to get Archlinux detection from /etc/os-release. It seems to be related to this. What’s the best way to address this with the Ansible team? It’s not a big issue but having no spaces in distribution or family name is a good practice.

Thanks for your help, it’s nice to know the root of the ‘problem’.

---

<div class="post-metadata">

**Author:** ![Mathias\_Ettinger](https://avatars.discourse-cdn.com/v4/letter/m/d6d6ee/32.png) [@Mathias\_Ettinger](https://forum.ansible.com/u/Mathias_Ettinger)\
**Post date:** [July 24, 2017, 2:54pm UTC](https://forum.ansible.com/t/archlinux-os-family-issue/25048/6 "2017-07-24T14:54:34Z")

</div>

I compared the source codes between 2.3 and 2.4, it seems to me that the check at [https://github.com/ansible/ansible/blob/stable-2.3/lib/ansible/module\_utils/facts.py#L729-L731](https://github.com/ansible/ansible/blob/stable-2.3/lib/ansible/module_utils/facts.py#L729-L731) is not present something like here [https://github.com/ansible/ansible/blob/devel/lib/ansible/module\_utils/facts/system/distribution.py#L171](https://github.com/ansible/ansible/blob/devel/lib/ansible/module_utils/facts/system/distribution.py#L171) and since no “parse\_distribution\_file\_Archlinux” method is present, it goes all the way down to “parse\_distribution\_file\_NA” which just plain reads /etc/os-release.

Maybe it’s time to implement such method for custom logic, or stick to the ‘allowempty’ trick.

I also tryed manually applying the fix provided in #15675 and got the desired output:  
“ansible\_distribution”: “Archlinux”,  
“ansible\_distribution\_file\_parsed”: true,  
“ansible\_distribution\_file\_path”: “/etc/os-release”,  
“ansible\_distribution\_file\_variety”: “Archlinux”,  
“ansible\_distribution\_major\_version”: “NA”,  
“ansible\_distribution\_release”: “NA”,  
“ansible\_distribution\_version”: “NA”,

so maybe just update this PR instead (or #22949) to modify the right file?

---

<div class="post-metadata">

**Author:** ![alikins](https://avatars.discourse-cdn.com/v4/letter/a/d07c76/32.png) [@alikins](https://forum.ansible.com/u/alikins)\
**Post date:** [July 24, 2017, 3:37pm UTC](https://forum.ansible.com/t/archlinux-os-family-issue/25048/7 "2017-07-24T15:37:50Z")

</div>

Analysis sounds correct to me, but would like to clarify the expected result:

For a system with /etc/os-release of:

NAME=“Arch Linux”  
PRETTY\_NAME=“Arch Linux”  
ID=arch  
ID\_LIKE=archlinux  
ANSI\_COLOR=“0;36”  
HOME\_URL=“[https://www.archlinux.org/](https://www.archlinux.org/)”  
SUPPORT\_URL=“[https://bbs.archlinux.org/](https://bbs.archlinux.org/)”  
BUG\_REPORT\_URL=“[https://bugs.archlinux.org/](https://bugs.archlinux.org/)”

The desired value for ‘ansible\_os\_family’ is ‘Archlinux’ ?

And for the other distro facts:

“ansible\_distribution”: “Archlinux”,  
“ansible\_distribution\_file\_parsed”: true,  
“ansible\_distribution\_file\_path”: “/etc/os-release”,  
“ansible\_distribution\_file\_variety”: “Archlinux”,  
“ansible\_distribution\_major\_version”: “NA”,  
“ansible\_distribution\_release”: “NA”,  
“ansible\_distribution\_version”: “NA”,

What is the background for the values in /etc/os-release being different than the desired values (‘Arch Linux’ vs ‘Archlinux’) ?

The description at [https://github.com/ansible/ansible/pull/15675#issue-151988680](https://github.com/ansible/ansible/pull/15675#issue-151988680) claims:

“systemd is a first class citizen in Arch Linux variants and thus /etc/os-release will always have the right info [1]. We don’t need to rely on /etc/arch-release and allowempty workaround.”

Is that correct?

If so, sounds like just need to rebase [https://github.com/ansible/ansible/pull/15675](https://github.com/ansible/ansible/pull/15675) or [https://github.com/ansible/ansible/pull/22949](https://github.com/ansible/ansible/pull/22949) again.

---

<div class="post-metadata">

**Author:** ![Brian\_Coca](https://avatars.discourse-cdn.com/v4/letter/b/6de8d8/32.png) [@Brian\_Coca](https://forum.ansible.com/u/Brian_Coca)\
**Post date:** [July 24, 2017, 3:43pm UTC](https://forum.ansible.com/t/archlinux-os-family-issue/25048/8 "2017-07-24T15:43:44Z")

</div>

> > &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;"systemd is a first class citizen in Arch Linux variants and thus /etc/os-release will always have the right info [1]. We don't need to rely on /etc/arch-release and allowempty workaround."

> Is that correct?

No, we have encountered systems that did not conform to that  
statement. They might be old, but not everyone can update/upgrade at  
same pace (even with rolling release distros).

---

<div class="post-metadata">

**Author:** ![mdl](https://avatars.discourse-cdn.com/v4/letter/m/b38774/32.png) [@mdl](https://forum.ansible.com/u/mdl)\
**Post date:** [July 25, 2017, 1:53pm UTC](https://forum.ansible.com/t/archlinux-os-family-issue/25048/9 "2017-07-25T13:53:27Z")

</div>

Thanks for your replies and for taking the time.

Adrian, I did not understand what you meant for background when it comes to values being different, I’m sorry.  
I’m asking now you and Mathias as I’m in the dark here: should I update [#22949](https://github.com/ansible/ansible/pull/22949) with a report of what’s been discussed in this thread or should I rebase following [ansible guide](http://docs.ansible.com/ansible/latest/dev_guide/developing_rebasing.html)? I’m no developer but I understand the changes stated in PR #22949. I really don’t want to screw something up or do something dumb due my lack of experience.
