Getting an error on bootstrap-users

Hi,

I was running the following command cchq echis ap deploy_common.yml and get an error on the following step.

TASK [bootstrap-users : Add public keys for current devs] ******************************************************************************************[44/1977]failed: [172.19.3.38] (item=administrator) => {"ansible_loop_var": "item", "changed": false, "item": "administrator", "module_stderr": "Shared connection to 172.19.3.38 closed.\r\n", "module_stdout": "\r\n/usr/lib/python3/dist-packages/OpenSSL/crypto.py:12: CryptographyDeprecationWarning: Python 3.6 is no longer supported by the Python core team. Therefore, support for it is deprecated in cryptography and will be removed in a future release.\r\n from cryptography import x509\r\nTraceback (most recent call last):\r\n File "/tmp/ansible-tmp-1663505110.1333332-61198-187940343577061/AnsiballZ_authorized_key.py", line 100, in \r\n _ansiballz_main()\r\n File "/tmp/ansible-tmp-1663505110.1333332-61198-187940343577061/AnsiballZ_authorized_key.py", line 92, in _ansiballz_main\r\n invoke_module(zipped_mod, temp_path, ANSIBALLZ_PARAMS)\r\n File "/tmp/ansible-tmp-1663505110.1333332-61198-187940343577061/AnsiballZ_authorized_key.py", line 41, in invoke_module\r\n run_name='main', alter_sys=True)\r\n File "/usr/lib/python3.6/runpy.py", line 205, in run_module\r\n return _run_module_code(code, init_globals, run_name, mod_spec)\r\n File "/usr/lib/python3.6/runpy.py", line 96, in _run_module_code\r\n mod_name, mod_spec, pkg_name, script_name)\r\n File "/usr/lib/python3.6/runpy.py", line 85, in _run_code\r\n exec(code, run_globals)\r\n File "/tmp/ansible_authorized_key_payload_u_ys2vhe/ansible_authorized_key_payload.zip/ansible_collections/ansible/posix/plugins/modules/authorized_key.py", line 217, in \r\n File "", line 971, in _find_and_load\r\n File "", line 955, in _find_and_load_unlocked\r\n File "", line 656, in _load_unlocked\r\n File "", line 626, in _load_backward_compatible\r
n File "/tmp/ansible_authorized_key_payload_u_ys2vhe/ansible_authorized_key_payload.zip/ansible/module_utils/urls.py", line 115, in \r\n File "/
usr/lib/python3/dist-packages/urllib3/contrib/pyopenssl.py", line 46, in \r\n import OpenSSL.SSL\r\n File "/usr/lib/python3/dist-packages/OpenS
SL/init.py", line 8, in \r\n from OpenSSL import crypto, SSL\r\n File "/usr/lib/python3/dist-packages/OpenSSL/crypto.py", line 1550, in \r\n class X509StoreFlags(object):\r\n File "/usr/lib/python3/dist-packages/OpenSSL/crypto.py", line 1570, in X509StoreFlags\r\n CB_ISSUER_CHE
CK = _lib.X509_V_FLAG_CB_ISSUER_CHECK\r\nAttributeError: module 'lib' has no attribute 'X509_V_FLAG_CB_ISSUER_CHECK'\r\n", "msg": "MODULE FAILURE\nSee stdout
/stderr for the exact error", "rc": 1}
failed: [172.19.3.38] (item=echis_demism) => {"ansible_loop_var": "item", "changed": false, "item": "echis_demism", "module_stderr": "Shared connection to 17
2.19.3.38 closed.\r\n", "module_stdout": "\r\n/usr/lib/python3/dist-packages/OpenSSL/crypto.py:12: CryptographyDeprecationWarning: Python 3.6 is no longer su
pported by the Python core team. Therefore, support for it is deprecated in cryptography and will be removed in a future release.\r\n from cryptography impo
rt x509\r\nTraceback (most recent call last):\r\n File "/tmp/ansible-tmp-1663505110.5987222-61198-244610870205085/AnsiballZ_authorized_key.py", line 100,
in \r\n _ansiballz_main()\r\n File "/tmp/ansible-tmp-1663505110.5987222-61198-244610870205085/AnsiballZ_authorized_key.py", line 92, in _ansiba
llz_main\r\n invoke_module(zipped_mod, temp_path, ANSIBALLZ_PARAMS)\r\n File "/tmp/ansible-tmp-1663505110.5987222-61198-244610870205085/AnsiballZ_author
ized_key.py", line 41, in invoke_module\r\n run_name='main', alter_sys=True)\r\n File "/usr/lib/python3.6/runpy.py", line 205, in run_module\r\n
return _run_module_code(code, init_globals, run_name, mod_spec)\r\n File "/usr/lib/python3.6/runpy.py", line 96, in _run_module_code\r\n mod_name, mo
d_spec, pkg_name, script_name)\r\n File "/usr/lib/python3.6/runpy.py", line 85, in _run_code\r\n exec(code, run_globals)\r\n File "/tmp/ansible_autho
rized_key_payload_yxm_c3qw/ansible_authorized_key_payload.zip/ansible_collections/ansible/posix/plugins/modules/authorized_key.py", line 217, in \r
n File "", line 971, in _find_and_load\r\n File "", line 955, in _find_and_load_unlocked\r\n
File "", line 656, in _load_unlocked\r\n File "", line 626, in _load_backward_compatible\r\n
File "/tmp/ansible_authorized_key_payload_yxm_c3qw/ansible_authorized_key_payload.zip/ansible/module_utils/urls.py", line 115, in \r\n File "/us
r/lib/python3/dist-packages/urllib3/contrib/pyopenssl.py", line 46, in \r\n import OpenSSL.SSL\r\n File "/usr/lib/python3/dist-packages/OpenSSL
/init.py", line 8, in \r\n from OpenSSL import crypto, SSL\r\n File "/usr/lib/python3/dist-packages/OpenSSL/crypto.py", line 1550, in \r\n class X509StoreFlags(object):\r\n File "/usr/lib/python3/dist-packages/OpenSSL/crypto.py", line 1570, in X509StoreFlags\r\n CB_ISSUER_CHECK
= _lib.X509_V_FLAG_CB_ISSUER_CHECK\r\nAttributeError: module 'lib' has no attribute 'X509_V_FLAG_CB_ISSUER_CHECK'\r\n", "msg": "MODULE FAILURE\nSee stdout/$
tderr for the exact error", "rc": 1}

sudo pip3 install --force-reinstall pyopenssl on the target machine has solved the problem.

source: python - Ansible OpenSSL Error with apt module - Server Fault