Yum module update_cache doesn't work for RHEL in ansible 2.4.0.0

The example shown in Ansible website shows that update_cache is executed when ansible_distribution is Centos.

  • name: install system updates for centos systems yum: name=* state=latest update_cache=yes when: ansible_distribution == “CentOS”

The exact same command works for us when we run it on Centos without the when condition, however it hangs up for hours in RHEL and finally outputs with a long error message depicting conflicts…

Does update_cache work in RHEL?

It does. From your description, it sounds like the RHEL repository
has a packageset that's generating conflicts in your install. the
update_cache is likely just making the error in the repository
visible.

CentOS and RHEL pull from different repositories and don't always have
the same set of packages at the same time (and you could also have
different packages installed on the two machines which complicates
things further).

A better test for diagnosing this would be whether using yum from the
commandline (or via ansible's command module) on the RHEL box does the
same thing or a different thing from the ansible command.

-Toshio

I diagnosed it first by reverting the ansible version to 2.3.1.0 and it worked:

“changed”: false,
“invocation”: {
“module_args”: {
“conf_file”: null,
“disable_gpg_check”: false,
“disablerepo”: null,
“enablerepo”: null,
“exclude”: null,
“install_repoquery”: true,
“installroot”: “/”,
“list”: null,
“name”: [
“*”
],
“skip_broken”: false,
“state”: “installed”,
“update_cache”: true,
“validate_certs”: true
}
},
“msg”: " Warning: Due to potential bad behaviour with rhnplugin and certificates, used slower repoquery calls instead of Yum API.",
“rc”: 0,
“results”: [
“systemd-libs-219-42.el7_4.1.x86_64 providing * is already installed”
]
}

I then went ahead and ran this command on the node “yum makecache” and it was successful.

so that’s the only reason i am thinking about ansible version.

This is the part of error i get with ansible 2.4.1.0:

zldy1643.pdk1.cci.att.com | FAILED! => {
“changed”: false,
“failed”: true,
“invocation”: {
“module_args”: {
“allow_downgrade”: false,
“conf_file”: null,
“disable_gpg_check”: false,
“disablerepo”: null,
“enablerepo”: null,
“exclude”: null,
“install_repoquery”: true,
“installroot”: “/”,
“list”: null,
“name”: [
“*”
],
“security”: false,
“skip_broken”: false,
“state”: “installed”,
“update_cache”: true,
“validate_certs”: true
}
},
“msg”: "Error: zeromq3-devel conflicts with zeromq-devel-4.1.4-5.el7.x86_64\nError: compat-qpid-cpp-client-rdma conflicts with qpid-cpp-client-rdma-1.36.0-1.el7.x86_64\nError: dmlite-dpmhead-dome conflicts with dpm-srm-server-mysql-1.9.0-1.el7.x86_64\nError: Package: bionetgen-2.2.5-2.el7.x86_64 (epel)\n Requires: libsundials_cvode.so.1()(64bit)\nError: Package: python2-eventlet-0.18.4-1.el7.noarch (epel)\n Requires: python-greenlet\nError: libcint conflicts with qcint-1.8.6-1.el7.x86_64\nError: Package: python2-flask-multistatic-1.0-1.el7.noarch (epel)\n Requires: python-flask\nError: Package: python3-yamlordereddictloader-0.3.0-1.el7.noarch (epel)\n Requires: python3-PyYAML\nError: radcli-compat-devel conflicts with radiusclient-ng-devel-0.5.6-9.el7.x86_64\nError: Package: python-flask-babel-0.9-2.el7.noarch (epel)\n