cryptography gets not detected
mowgli opened this issue · 3 comments
SUMMARY
I use gentoo which has the following versions:
~> LC_ALL=C.UTF-8 ansible -m community.general.python_requirements_info -c local localhost -a dependencies=cryptography
[WARNING]: No inventory was parsed, only implicit localhost is available
localhost | SUCCESS => {
"changed": false,
"mismatched": {},
"not_found": [],
"python": "/usr/bin/python3.11",
"python_system_path": [
"/tmp/root/ansible_community.general.python_requirements_info_payload_c150g50d/ansible_community.general.python_requirements_info_payload.zip",
"/usr/lib/python311.zip",
"/usr/lib/python3.11",
"/usr/lib/python3.11/lib-dynload",
"/usr/lib/python3.11/site-packages"
],
"python_version": "3.11.8 (main, Feb 23 2024, 08:06:35) [GCC 13.2.1 20240113]",
"python_version_info": {
"major": 3,
"micro": 8,
"minor": 11,
"releaselevel": "final",
"serial": 0
},
"valid": {
"cryptography": {
"desired": null,
"installed": "42.0.4"
}
}
}
So, you see, cryptography with a way higher version then 1.2.3 is installed.
But when I run the following task:
- name: Create Key
openssl_privatekey:
path: "{{ exim_config_dir }}/exim.key"
mode: 0640
owner: "{{ exim_user }}"
group: "{{ exim_group }}"
it fails with the following error:
fatal: [chua]: FAILED! => {"changed": false, "msg": "Cannot detect the required Python library cryptography (>= 1.2.3)"}
Side note: I run that all on the local machine. The playbook is done via ansible-pull.
ISSUE TYPE
- Bug Report
COMPONENT NAME
openssl_privatekey
ANSIBLE VERSION
ERROR: Ansible requires the locale encoding to be UTF-8; Detected ISO8859-1.
CONFIGURATION
ERROR: Ansible requires the locale encoding to be UTF-8; Detected ISO8859-1.
OS / ENVIRONMENT
See above
STEPS TO REPRODUCE
See above
See above
EXPECTED RESULTS
It should work
ACTUAL RESULTS
It produces an error
See above
It clearifies a bit...
Gentoo often has more than one python installed and configures the default via /etc/python-exec/python-exec.conf
.
On the current system, the default ist python3.11 but there is a version python3.12 installed. Ansible does not care about the default and use the incomplete python3.12.
If ansible uses the wrong Python, you have to explicitly tell it to use the rigth one.
cryptography needs to be available to the Python environment used to execute the community.crypto modules.
Yea, I believe you are right. It is not a bug here.
Maybe it helps other users hitting the same bug.