AIX O/S version detection problems in Ansible 2.8

244 views
Skip to first unread message

Daniel Delin

unread,
Sep 30, 2019, 7:35:07 AM9/30/19
to Ansible Project
Hi,

Noticed that a few of our playbooks failed to run on AIX after trying to move from 2.7.10 to 2.8.4
I´ve tracked it down to handling of the ansible_distribution_major_version fact.

We include variables in the playbooks like this:

  - name: Include OP5 varibles.
    include_vars: "{{ item }}"
    with_first_found:
     - "{{ ansible_distribution }}{{ ansible_distribution_major_version }}.yml"
     - "other_os.yml"

This fails in 2.8 since the file supposed to be included is named AIX5.yml , but in 2.8 the variable is set to "5.3"

If I check the fact cache file it looks like this on both 2.7.10 and 2.8.4, which seems correct:

 "ansible_distribution": "AIX",
    "ansible_distribution_major_version": "5",
    "ansible_distribution_release": "3",
    "ansible_distribution_version": "5.3",


However, if I debug the variables in the playbook, major version is wrong when running 2.8.4, which makes the import of our variable file fail:


TASK [op5 : debug] ***********************************************************************************************************************************************
ok: [xxxx.xxxx.xxxx] => {
    "ansible_distribution": "AIX"
}

TASK [op5 : debug] ***********************************************************************************************************************************************
ok: [xxxx.xxxx.xxxx] => {
    "ansible_distribution_major_version": "5.3"


Could this be a bug ? It doesn´t seem correct that the facts differ from the debug.

Kai Stian Olstad

unread,
Sep 30, 2019, 1:05:57 PM9/30/19
to ansible...@googlegroups.com
On 30.09.2019 13:35, Daniel Delin wrote:
> *If I check the fact cache file it looks like this on both 2.7.10 and
> 2.8.4, which seems correct:*
>
> "ansible_distribution": "AIX",
> * "ansible_distribution_major_version": "5", *
> "ansible_distribution_release": "3",
> "ansible_distribution_version": "5.3",
>
>
> *However, if I debug the variables in the playbook, major version is wrong
> when running 2.8.4, which makes the import of our variable file fail:*
>
>
> TASK [op5 : debug]
> ***********************************************************************************************************************************************
> ok: [xxxx.xxxx.xxxx] => {
> "ansible_distribution": "AIX"
> }
>
> TASK [op5 : debug]
> ***********************************************************************************************************************************************
> ok: [xxxx.xxxx.xxxx] => {
> *"ansible_distribution_major_version": "5.3"*
>
>
> Could this be a bug ? It doesn´t seem correct that the facts differ from
> the debug.

This look like a bug, but when I check the code distribution_major_version for AIX is not changed between 2.7.10 and 2.8.4, only distribution_version and distribution_release has some changes.

The fact is parsing the output of /usr/bin/oslevel what output do you get from that command?


--
Kai Stian Olstad

Daniel Delin

unread,
Oct 1, 2019, 3:17:21 AM10/1/19
to Ansible Project
On Monday, September 30, 2019 at 7:05:57 PM UTC+2, Kai Stian Olstad wrote:
This look like a bug, but when I check the code distribution_major_version for AIX is not changed between 2.7.10 and 2.8.4, only distribution_version and distribution_release has some changes.

The fact is parsing the output of /usr/bin/oslevel what output do you get from that command?


--
Kai Stian Olstad


bash-3.00# /usr/bin/oslevel
5.3.0.0
Reply all
Reply to author
Forward
0 new messages