An unknown error occurred: HTTPSConnection.__init__() got an unexpected keyword argument 'cert_file' when running ansible tasks from a RHEL 9 system.

Solution Verified - Updated -

Issue

  • Unable to execute certain ansible playbooks on systems having Python 3.12 as the default python version.

  • Any ansible tasks based on get_url or uri etc modules fail with the following error:

    FAILED! => {"changed": false, "dest": "/tmp/lsagent.run", "elapsed": 0, "msg": "An unknown error occurred: HTTPSConnection._init_() got an unexpected keyword argument 'cert_file'", "url": "https://cdn.lansweeper.com/download/10.4.2/1/LsAgent-linux.run"}
    
  • Red Hat Satellite and Capsule 6.16 running on RHEL 9.x, fails to execute the job on some target systems in a similar way:

    TASK [cit-sysconfig-rhel : Download the LSAgent] ***
    fatal: [satellite616]: FAILED! => {"changed": false, "dest": "/tmp/lsagent.run", "elapsed": 0, "msg": "An unknown error occurred: HTTPSConnection.__init__() got an unexpected keyword argument 'cert_file'", "url": "https://cdn.lansweeper.com/download/10.4.2/1/LsAgent-linux.run"}
    PLAY RECAP *********************************************************************
    satellite616          : ok=40   changed=8    unreachable=0    failed=1    skipped=3    rescued=0    ignored=0
    Exit status: 2
    StandardError: Job execution failed
    
    • The affected target RHEL systems have Python 3.12 enabled as their default python version.

Environment

  • Red Hat Enterprise Linux 9
  • Red Hat Satellite 6.16
  • Red Hat Capsule 6.16
  • Ansible Core 2.14

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