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

ipa-client role overriding ansible_python_interpreter for other plays later in the playbook

Open isundaylee opened this issue 2 years ago • 1 comments

I recently upgraded freeipa.ansible-freeipa to the latest release (v1.9.2) and noticed that my playbooks started erroring out. Example error:

TASK [isundaylee.docker : docker - install python module] **********************
35s
fatal: [mapps2]: FAILED! => {"changed": false, "msg": "Unable to find any of pip2, pip to use.  pip needs to be installed."}

despite me setting

ansible_python_interpreter: /usr/bin/python3

in a group_vars/ file which is applied for this host.

I bisected the issue to commit 44b3c3003d1a115a00cefd8f8bd46da4466bf09b

The rough setup is, in the playbook .yml file, I have

- hosts: role_miniapps
  strategy: linear
  roles: ['isundaylee.ipa_client']
  tags: ['ipa-client']

...

- hosts: role_miniapps
  roles: ['isundaylee.docker']
  tags: ['docker']

In isundaylee.ipa_client role, the relevant part is

...
- block:
  - name: ipa_client - sets up ipa client
    collections: ['freeipa.ansible_freeipa']
    import_role:
      name: ipaclient
    become: true
...

And in isundaylee.docker, the action that errors out is

  - name: docker - install python module
    pip:
      name: docker

Looks like ipaclient now overrides ansible_python_interpreter to Python 2 for all subsequent plays in the playbook in addition to just the role itself, which doesn't seem ideal.

isundaylee avatar Feb 19 '23 19:02 isundaylee

Which distro are you using and with version of it?

rjeffman avatar Mar 16 '23 21:03 rjeffman