ansible-freeipa icon indicating copy to clipboard operation
ansible-freeipa copied to clipboard

Add ipaclient support for Amazon Linux 2

Open Drugantibus opened this issue 2 years ago • 9 comments

Amazon Linux 2 is a RedHat-7 based distro, but reports its major version as '2'. This varfiles allows installation of the correct packages and enrollment using the ipaclient role.

Drugantibus avatar May 12 '22 08:05 Drugantibus

The vars file for Ansible Linux 2 should not be named RedHat-2,yml. Please create a link for Ansible-2.yml pointing to RedHat-7.yml instead. Why have you set ansible_python_interpreter? Is that really needed?

t-woerner avatar May 12 '22 09:05 t-woerner

Yes, unfortunately AL2 doesn't provide the ipapython python3 module in its repos. Updated the filename to the more proper name

Drugantibus avatar May 12 '22 12:05 Drugantibus

RHEL-7 is also not providing the Python 3 IPA bindings. Only Python 2 bindings for IPA are there.

t-woerner avatar May 12 '22 13:05 t-woerner

Why not only create a link from RedHat-7.yml to Amazon-2.yml?

This worked for me.

rjeffman avatar May 12 '22 16:05 rjeffman

I'll be honest, I don't understand how it's supposed to work without switching to python2 if the python3 module is not available. Since the python3 module is not available in AL2's repos and the role installs the modules using yum rather than pip this role cannot work unless it's running in python2, can it?. If I remove the ansible_python_interpreter line or link it to RHEL-7.yml, it fails with ModuleNotFoundError: No module named 'ipapython', as expected. @rjeffman, did you test on a clean AL2 installation?

I would also prefer to abandon python2 for good, but I haven't been able to get this role to run in python3 on a fresh, up to date AL2 installation even with manual intervention.

Drugantibus avatar May 17 '22 08:05 Drugantibus

Ansible should automatically use Python2 for all RHEL-7 based distributions. If this is not the case for Amazon Linux 2, then we really need that extra line and file.

t-woerner avatar May 17 '22 09:05 t-woerner

Indeed, the Ansible python interpreter discovery uses /usr/bin/python3.7 on Amazon Linux 2.

Drugantibus avatar May 17 '22 09:05 Drugantibus

@Drugantibus yes, I tested on a clean AL2 installation. What I did was:

  • download AL2 cloud image
  • configure IP address to static (due to my environment)
  • dnf updated the distro
  • deployed ipaclient

I ran it locally, with KVM/libvirt, not on Amazon cloud.

rjeffman avatar May 17 '22 11:05 rjeffman

Please create one patch for this PR.

t-woerner avatar Jun 14 '22 10:06 t-woerner