-
Notifications
You must be signed in to change notification settings - Fork 156
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
No module named hvac after upgrading to ansible version 6.0.0 or 6.1.0 / module is running under python 2.7??! #412
Comments
The problem seems to come from the "shebang" in the modules. |
What happens when you run What distro are you running on? |
I'm running on a Debian 11. The problem is that |
The ansible documentation (https://docs.ansible.com/ansible/latest/dev_guide/testing/sanity/shebang.html) is saying "This does not apply to Ansible modules, which should not be executable and must always use |
I am seeing potentially similar issues on Alpine 3.16 (which removed Python2):
I could fix it by
|
An update on this, as my colleague and me just fell over this in another instance. I had v4.6.6 installed, my colleague 4.7.0.
Because of the new behavior in 4.7.0, To workaround this for the moment, we added another Overall, I think this module should just use the default ansible python interpreter used in all other tasks rather than hardcoding it's one to Thanks for maintaining this module! |
In case it helps somebody here, our current configuration to account for the installation of
- name: Check that /usr/bin/env python exists (for hashivault modules)
stat:
path: /usr/bin/python
register: python_exists
- name: Symlink /usr/bin/env python to /usr/bin/env python3
file:
src: "/usr/bin/python3"
dest: "/usr/bin/python"
state: link
when: not python_exists.stat.exists
- name: Check if pip2 exists
stat:
path: /usr/bin/pip2
register: pip2_exists
- name: Ensure pip hvac is installed if python2 exists
when: pip2_exists.stat.exists
pip:
executable: /usr/bin/pip2
name:
- hvac
- hvac[parser]
state: present
- name: Install hvac pip required for hashicorp_vault module
become: true
become_user: "{{ user }}"
pip:
name:
- hvac
- hvac[parser]
state: latest |
We have the same issue MacOS 13.4.1 - the same error |
You'll need to make sure some Python version is in your path when you are running |
Of course can be created a symlink |
Agree, As described here: "Using #!/usr/bin/env, makes env the interpreter and bypasses ansible__interpreter logic." I am running into this issue when trying to use the modules in an pre-built k8s operator image. This should do the trick |
I have created PR to solve the issue. |
I think the idea was to change the shebang, not remove it. |
Creating and maintaining a non-pip based
|
Insisting on Eschewing The whole situation is a mess introduced by |
Encountering the |
After upgrading ansible from version 5.10.0 to version 6.0.0 or 6.1.0 I'm getting the error:
What I'm seeing is the module is running with "python 2.7" but it should run under "python 3.9" (as it was with version 5.10.0).
Does someone has already used this module with ansible 6 (ansible core 2.13) ?
Is there any configuration to be done on ansible 6 to make it works ?
The text was updated successfully, but these errors were encountered: