Getting an OpenSSL error when running an Ansible playbook with the DNF or YUM modules in a managed node

Solution Verified - Updated -

Issue

  • The following error can be seen in the ansible console associated with the managed node:
TASK [ansible.builtin.yum]
****************************************************************************************************************************
An exception occurred during task execution. To see the full traceback, use -vvv. The error was: TypeError: deprecated() got an unexpected keyword argument 'name'
fatal: [MANAGED_HOST: FAILED! => {"changed": false, "module_stderr": "Shared connection to MANAGED_HOST closed.\r\n", "module_stdout": "Traceback (most recent call last):\r\n  File \"/home/ansible/.ansible/tmp/ansible-tmp-1698789695.5506108-97329-30562052396846/AnsiballZ_dnf.py\", line 107, in <module>\r\n    _ansiballz_main()\r\n  File \"/home/ansible/.ansible/tmp/ansible-tmp-1698789695.5506108-97329-30562052396846/AnsiballZ_dnf.py\", line 99, in _ansiballz_main\r\n    invoke_module(zipped_mod, temp_path, ANSIBALLZ_PARAMS)\r\n  File \"/home/ansible/.ansible/tmp/ansible-tmp-1698789695.5506108-97329-30562052396846/AnsiballZ_dnf.py\", line 48, in invoke_module\r\n    run_name='__main__', alter_sys=True)\r\n  File \"/usr/lib64/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/lib64/python3.6/runpy.py\", line 96, in _run_module_code\r\n    mod_name, mod_spec, pkg_name, script_name)\r\n  File \"/usr/lib64/python3.6/runpy.py\", line 85, in _run_code\r\n    exec(code, run_globals)\r\n  File \"/tmp/ansible_ansible.legacy.dnf_payload_asr7adw9/ansible_ansible.legacy.dnf_payload.zip/ansible/modules/dnf.py\", line 359, in <module>\r\n  File \"<frozen importlib._bootstrap>\", line 971, in _find_and_load\r\n  File \"<frozen importlib._bootstrap>\", line 955, in _find_and_load_unlocked\r\n  File \"<frozen importlib._bootstrap>\", line 656, in _load_unlocked\r\n  File \"<frozen importlib._bootstrap>\", line 626, in _load_backward_compatible\r\n  File \"/tmp/ansible_ansible.legacy.dnf_payload_asr7adw9/ansible_ansible.legacy.dnf_payload.zip/ansible/module_utils/urls.py\", line 115, in <module>\r\n  File \"/usr/local/lib/python3.6/site-packages/urllib3/contrib/pyopenssl.py\", line 46, in <module>\r\n    import OpenSSL.SSL\r\n  File \"/usr/local/lib/python3.6/site-packages/OpenSSL/__init__.py\", line 8, in <module>\r\n    from OpenSSL import SSL, crypto\r\n  File \"/usr/local/lib/python3.6/site-packages/OpenSSL/SSL.py\", line 19, in <module>\r\n    from OpenSSL.crypto import (\r\n  File \"/usr/local/lib/python3.6/site-packages/OpenSSL/crypto.py\", line 3266, in <module>\r\n    name=\"load_pkcs7_data\",\r\nTypeError: deprecated() got an unexpected keyword argument 'name'\r\n", "msg": "MODULE FAILURE\nSee stdout/stderr for the exact error", "rc": 1}
  • Failed to install a RPM package in the managed node through the ansible-core or Ansible Automation Platform products.

  • Failed to run ansible.builtin.yum or ansible.builtin.dnf modules.

Environment

  • Red Hat Enterprise Linux 8
    • Python 3.6
  • Red Hat Ansible Automation Platform 2.x

Subscriber exclusive content

A Red Hat subscription provides unlimited access to our knowledgebase, tools, and much more.

Current Customers and Partners

Log in for full access

Log In

New to Red Hat?

Learn more about Red Hat subscriptions

Using a Red Hat product through a public cloud?

How to access this content