Problems with centos8 docker image with ansible-test

The tests seem to be installing python2, causing the test environment to be modified.

Per the error message:

ERROR: Test target “lookup_mongodb” has changed the test environment!
If these changes are necessary, they must be reverted before the test finishes.

This is being done in the following task:

TASK [setup_mongodb : Ensure mongod package is installed] **********************

https://github.com/ansible-collections/community.mongodb/blob/master/tests/integration/targets/setup_mongodb/tasks/main.yml#L76-L80

You’ll either need to remove the python2 packages that were installed in setup_mongodb. This already existed, but was commented out in https://github.com/ansible-collections/community.mongodb/commit/71d1de33c73423df4f2b5aed7d2403c1e4ef5220

That task is defined as follows…

  • name: Ensure mongod package is installed
    yum:
    name: ‘{{ mongodb_packages.mongod }}’
    state: present
    when: ansible_os_family == “RedHat”

and the variable used is defined as follows…

mongodb_packages:
mongod: mongodb-org-server

Running locally I see the following (expected) output…

TASK [setup_mongodb : Ensure mongod package is installed] **********************
changed: [testhost] => {“changed”: true, “msg”: “”, “rc”: 0, “results”: [“Installed: openssl-pkcs11-0.4.10-2.el8.x86_64”, “Installed: mongodb-org-server-4.2.12-1.el8.x86_64”, “Installed: openssl-1:1.1.1g-12.el8_3.x86_64”, “Installed: openssl-devel-1:1.1.1g-12.el8_3.x86_64”, “Installed: openssl-libs-1:1.1.1g-12.el8_3.x86_64”, “Removed: openssl-devel-1:1.1.1-8.el8.x86_64”, “Removed: openssl-libs-1:1.1.1-8.el8.x86_64”]}

But in Github actions I see the following (unexpected) output…

changed: [testhost] => {“changed”: true, “msg”: “”, “rc”: 0, “results”: [“Installed: python2-setuptools-39.0.1-12.module_el8.3.0+478+7570e00c.noarch”, “Installed: python2-setuptools-wheel-39.0.1-12.module_el8.3.0+478+7570e00c.noarch”, “Installed: python2-libs-2.7.17-2.module_el8.3.0+478+7570e00c.x86_64”, “Installed: python2-pip-9.0.3-18.module_el8.3.0+478+7570e00c.noarch”, “Installed: python2-pip-wheel-9.0.3-18.module_el8.3.0+478+7570e00c.noarch”, “Installed: python2-2.7.17-2.module_el8.3.0+478+7570e00c.x86_64”, “Installed: mongodb-org-server-4.2.12-1.el8.x86_64”, “Installed: openssl-1:1.1.1g-12.el8_3.x86_64”]}

There is the redhat_packages_py2 variable but I don’t see how this is being picked up in GA/centos8 only. The only references to this variable are in…

tests/integration/targets/setup_mongodb/defaults/main.yml

tests/integration/targets/setup_mongodb/handlers/main.yml (commented out)

How on earth this is getting merged with the mongod task is currently unknown. This is legacy stuff left over from Shippable so I’ll clean this up and hope it goes away.

Have a great weekend

Cheers,

Rhys