Skip to content

Compatibility with ansible 2.8 (missing ansible facts) #556

Closed
@hogarth-sv

Description

@hogarth-sv

We run automated weekly tests of all our roles against preview and nightly builds of ansible.

Any yum interaction with a combination of mitogen 0.2.5 and the ansible 2.8 nightly results in:

TASK [ansible_role_yum : configure packages] **********************************************************************************************************************************************************************
failed: [initial] (item={u'name': u'yum-utils'}) => {"changed": false, "item": {"name": "yum-utils"}, "msg": ["Could not detect which major revision of yum is in use, which is required to determine module backend.", "You can manually specify use_backend to tell the module whether to use the yum (yum3) or dnf (yum4) backend})"]}
failed: [initial] (item={u'name': u'yum-plugin-priorities'}) => {"changed": false, "item": {"name": "yum-plugin-priorities"}, "msg": ["Could not detect which major revision of yum is in use, which is required to determine module backend.", "You can manually specify use_backend to tell the module whether to use the yum (yum3) or dnf (yum4) backend})"]}

This happens within a docker container and also with a remote host as the target.

I have traced this back to facts not being populated correctly. These are present with ANSIBLE_STRATEGY set to linear but missing when ANSIBLE_STRATEGY is set to mitogen_linear.

        "ansible_distribution": "CentOS", 
        "ansible_distribution_file_parsed": true, 
        "ansible_distribution_file_path": "/etc/redhat-release", 
        "ansible_distribution_file_variety": "RedHat", 
        "ansible_distribution_major_version": "7", 
        "ansible_distribution_release": "Core", 
        "ansible_distribution_version": "7", 

This results in, when following the code, eventually the error laid out above since the selection of yum backend is dependent on the distribution being detected correctly.

 ansible-config dump --only-changed
ANSIBLE_FORCE_COLOR(env: ANSIBLE_FORCE_COLOR) = True
DEFAULT_CALLBACK_WHITELIST(env: ANSIBLE_CALLBACK_WHITELIST) = [u'junit']
DEFAULT_HOST_LIST(/srv/ansible/ansible_role_yum/ansible.cfg) = [u'/srv/ansible/ansible_role_yum/tests/inventory']
DEFAULT_ROLES_PATH(/srv/ansible/ansible_role_yum/ansible.cfg) = [u'/srv/ansible/ansible_role_yum/tests/roles']
DEFAULT_STRATEGY(env: ANSIBLE_STRATEGY) = mitogen_linear
DEFAULT_STRATEGY_PLUGIN_PATH(env: ANSIBLE_STRATEGY_PLUGINS) = [u'/root/.ansible/plugins/strategy', u'/usr/share/ansible/plugins/strategy', u'/srv/ansible/mitogen/ansible_mitogen/plugins/strategy']
DEFAULT_TIMEOUT(env: ANSIBLE_TIMEOUT) = 30
HOST_KEY_CHECKING(env: ANSIBLE_HOST_KEY_CHECKING) = False
RETRY_FILES_ENABLED(env: ANSIBLE_RETRY_FILES_ENABLED) = False
ansible --version
ansible 2.8.0.dev0
  config file = /srv/ansible/ansible_role_yum/ansible.cfg
  configured module search path = [u'/root/.ansible/plugins/modules', u'/usr/share/ansible/plugins/modules']
  ansible python module location = /usr/lib/python2.7/site-packages/ansible
  executable location = /usr/bin/ansible
  python version = 2.7.5 (default, Oct 30 2018, 23:45:53) [GCC 4.8.5 20150623 (Red Hat 4.8.5-36)]

This can be trivially replicated by using a centos container that has ansible 2.8 with mitogen installed:

docker run --rm -it centos bash
yum -y install epel-release
yum-config-manager --add-url=https://releases.ansible.com/ansible/rpm/nightly/devel/epel-7-x86_64/
yum install ansible
# <add mitogen to the system>
ansible -c local -i localhost, -m setup all # this is missing the facts
ANSIBLE_STRATEGY=linear ansible -c local -i localhost, -m setup # this has the distribution facts

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions