Molecule tests are failing with ansible returning TypeError: TLSConfig.__init__(): unexpected keyword argument 'assert_hostname'

57 Views Asked by At

We have some molecule tests for Ansible configuration. These tests were working fine earlier and they are started failing recently. Below are the command and error details.

Docker Image in molecule config:

image: geerlingguy/docker-amazonlinux2-ansible:latest

Command:

molecule test -s scenario1

Error Messages:

TASK [Destroy molecule instance(s)] ********************************************
changed: [localhost] => (item=squid)
TASK [Wait for instance(s) deletion to complete] *******************************
failed: ...
File \"/tmp/ansible_community.docker.docker_container_payload_jy58o0sr/ansible_community.docker.docker_container_payload.zip/ansible_collections/community/docker/plugins/module_utils/common.py\",
line 206,
in _get_tls_config",
"TypeError: TLSConfig.__init__() got an unexpected keyword argument 'assert_hostname'"], "stdout": "", "stdout_lines": []}
CRITICAL Ansible return code was 2, command was: 
['ansible-playbook', '--inventory', '/root/.cache/molecule/test/scenario1/inventory',
 '--skip-tags', 'molecule-notest,notest', 
'/usr/lib/python3.10/site-packages/molecule_docker/playbooks/destroy.yml']

we are running these tests in a docker-in-docker from a pipeline. The versions details parent docker container.

Version details:

$ python3 --version
Python 3.10.13

$ ansible --version
ansible [core 2.12.10]
  config file = None
  configured module search path = ['/root/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
  ansible python module location = /usr/lib/python3.10/site-packages/ansible
  ansible collection location = /root/.ansible/collections:/usr/share/ansible/collections
  executable location = /usr/bin/ansible
  python version = 3.10.13 (main, Aug 26 2023, 11:41:25) [GCC 11.2.1 20220219]
  jinja version = 3.1.3
  libyaml = False

$ molecule --version
molecule 3.5.2 using python 3.10 
    ansible:2.12.10
    delegated:3.5.2 from molecule
    docker:1.1.0 from molecule_docker requiring collections: community.docker>=1.9.1

We did not make any changes recently and not sure if any automatic upgrades in the background causing this issue. Could not find anything on web which can help identify the root cause. Please advise.

0

There are 0 best solutions below