Ansible - Resolve "got an unexpected keyword argument 'cert_file'"
by
Jeremy Canfield |
Updated: March 23 2024
| Ansible articles
Let's say something like this is being returned.
ERROR! Unknown error when attempting to call Galaxy at 'https://galaxy.ansible.com/api/v3/collections/community/general/': HTTPSConnection.__init__() got an unexpected keyword argument 'cert_file'. HTTPSConnection.__init__() got an unexpected keyword argument 'cert_file'
I got this when install the community.general collection using the ansible-galaxy collection install command with ansible-core version 2.15.0 on Python version 3.12.0.
~]$ ansible --version
ansible [core 2.15.0]
python version = 3.12.0 (main, Dec 22 2023, 02:43:27) [GCC 4.8.5 20150623 (Red Hat 4.8.5-44)]
According to https://docs.python.org/3.12/library/http.client.html#http.client.HTTPSConnection
Changed in version 3.12: The deprecated key_file, cert_file and check_hostname parameters have been removed.
This defect was fixed in ansible-core version 2.16.0 (or above) thus the simple solution, if possible, is to run ansible-core version 2.16.0 or above.
Did you find this article helpful?
If so, consider buying me a coffee over at
Comments
September 04 2024 by erplus
Great explanation! Thanks :)