Ansible-playbook succeeds with no changes but i686 package not installed

Hi there,

I’m a new user to Ansbile so this might well be user error but I’m seeing ansible-playbook complete with no issues but not update the dnf package. Edit: after a bit of debug as I wrote this issue, it looks like the problem is only with i686 packages.

Ansible version: core 2.17.0

My playbook looks like:

---
- hosts: rhel
  become: yes

  tasks:
    - name: RHEL specific packages
      dnf:
        name:
          - glibc-devel
          - glibc-devel.i686
      when: ansible_facts['os_family'] == 'RedHat'

and my invokation and stdout looks like:

$ ansible-playbook playbooks/test.yaml -K
BECOME password:
[WARNING]: Invalid characters were found in group names but not replaced, use -vvvv to see details

PLAY [rhel] ********************************************************************************************************************************************************************************************************************************

TASK [Gathering Facts] *********************************************************************************************************************************************************************************************************************
[WARNING]: Platform linux on host rhel-dev.nu-quantum.com is using the discovered Python interpreter at /usr/bin/python3.9, but future installation of another Python interpreter could change the meaning of that path. See
https://docs.ansible.com/ansible-core/2.17/reference_appendices/interpreter_discovery.html for more information.
ok: [rhel-dev.nu-quantum.com]

TASK [RHEL specific packages] **************************************************************************************************************************************************************************************************************
ok: [rhel-dev.nu-quantum.com]

PLAY RECAP *********************************************************************************************************************************************************************************************************************************
rhel-dev.nu-quantum.com    : ok=2    changed=0    unreachable=0    failed=0    skipped=0    rescued=0    ignored=0

Yet when I check on the host I can see:

[shareefj@rhel-dev ~]$ sudo dnf info glibc-devel
[sudo] password for shareefj:
Updating Subscription Management repositories.
Last metadata expiration check: 0:24:34 ago on Fri 07 Jun 2024 12:01:36 BST.
Installed Packages
Name         : glibc-devel
Version      : 2.34
Release      : 100.el9_4.2
Architecture : x86_64
Size         : 37 k
Source       : glibc-2.34-100.el9_4.2.src.rpm
Repository   : @System
From repo    : rhel-9-for-x86_64-appstream-rpms
Summary      : Object files for development using standard C libraries.
URL          : http://www.gnu.org/software/glibc/
License      : LGPLv2+ and LGPLv2+ with exceptions and GPLv2+ and GPLv2+ with exceptions and BSD and Inner-Net and ISC and Public Domain and GFDL
Description  : The glibc-devel package contains the object files necessary
             : for developing programs which use the standard C libraries (which are
             : used by nearly all programs).  If you are developing programs which
             : will use the standard C libraries, your system needs to have these
             : standard object files available in order to create the
             : executables.
             :
             : Install glibc-devel if you are going to develop programs which will
             : use the standard C libraries.

Available Packages
Name         : glibc-devel
Version      : 2.34
Release      : 100.el9_4.2
Architecture : i686
Size         : 43 k
Source       : glibc-2.34-100.el9_4.2.src.rpm
Repository   : rhel-9-for-x86_64-appstream-rpms
Summary      : Object files for development using standard C libraries.
URL          : http://www.gnu.org/software/glibc/
License      : LGPLv2+ and LGPLv2+ with exceptions and GPLv2+ and GPLv2+ with exceptions and BSD and Inner-Net and ISC and Public Domain and GFDL
Description  : The glibc-devel package contains the object files necessary
             : for developing programs which use the standard C libraries (which are
             : used by nearly all programs).  If you are developing programs which
             : will use the standard C libraries, your system needs to have these
             : standard object files available in order to create the
             : executables.
             :
             : Install glibc-devel if you are going to develop programs which will
             : use the standard C libraries.

[shareefj@rhel-dev ~]$ sudo dnf info glibc-devel.i686
Updating Subscription Management repositories.
Last metadata expiration check: 0:24:39 ago on Fri 07 Jun 2024 12:01:36 BST.
Available Packages
Name         : glibc-devel
Version      : 2.34
Release      : 100.el9_4.2
Architecture : i686
Size         : 43 k
Source       : glibc-2.34-100.el9_4.2.src.rpm
Repository   : rhel-9-for-x86_64-appstream-rpms
Summary      : Object files for development using standard C libraries.
URL          : http://www.gnu.org/software/glibc/
License      : LGPLv2+ and LGPLv2+ with exceptions and GPLv2+ and GPLv2+ with exceptions and BSD and Inner-Net and ISC and Public Domain and GFDL
Description  : The glibc-devel package contains the object files necessary
             : for developing programs which use the standard C libraries (which are
             : used by nearly all programs).  If you are developing programs which
             : will use the standard C libraries, your system needs to have these
             : standard object files available in order to create the
             : executables.
             :
             : Install glibc-devel if you are going to develop programs which will
             : use the standard C libraries.

[shareefj@rhel-dev ~]$

Is this a bug or do I need to do something else to allow Ansible to install i686 packages?

Thanks, Shareef.

I’m afraid I’m not a RedHat user these days, but on Debian / Ubuntu one would first need to add the architecture prior to installing a package, the package architecture in this case would be added to the package name separated with a colon, something like this:

- name: Architecture i386 enabled
  ansible.builtin.command: dpkg --add-architecture i386

- name: Linux support headers for userspace development present for i386 and x86_64
  ansbile.builtin.apt:
    pkg:
      - linux-libc-dev
      - linux-libc-dev:i386

Perhaps something like this is also needed for RedHat based distros?

1 Like

Thanks, I can add it manually without any further dnf magic. It’s just not being installed by Ansible.

Edit: and wouldn’t you expect an error if that were the case rather than failing silently?

Confirmed bug: ansible.builtin.dnf doesn't install i686 packages · Issue #83406 · ansible/ansible · GitHub

2 Likes