yum module doesn't update package

Hi list,
I’ve a strange problem here. I’ve a simple playbook to install monit like that :

  • name: monit - install monit (if necessary)
    yum: name=monit enablerepo=rpmforge state=latest

However :
If monit is already installed, the playbook returns “results”: [“All packages providing monit are up to date”], whatever the version that is installed, and doesn’t update it.
I’ve backuped the script created by ansible on the target (something like /root/.ansible/tmp/ansible-xxxxx/yum), it returns the same message.
But, I’ve tried locally (and manually) a yum update on the target, yum find the right version (5.5) on rpmforge repo, and propose to update it !
And, definitely strange, if I remove monit on the target, the same playbook find and install the latest version 5.5 !

Any idea to try to debug that ??

Thanks
Frank

Can you add a task beforehand to do a “yum clean all”, to see if perhaps it’s a yum caching issue?

Oh yes, I’ve tried that in the playbook, before the yum command, but not better…
I’ve also deleted the /var/cache/yum directory content on the target.

To be sure :
I’ve just tried the “yum clean all” manually on the target + remove /var/cache/yum/*
I must say that the yum command (in the playbook from the server, or locally with the python script that I backuped) is very slow, about 1 minute to finally say “up to date”, when a local yum command take about 10s.

If the rpmforge repo is disabled by default, you might need to add --enablerepo=rpmforge to the yum clean call, otherwise yum will ignore it during the clean too.

Are you sure ? the clean option without enablerepo says ‘Cleaning up Everything’ and ‘Cleaning up list of fastest mirrors’, and same messages with enablerepo.
Anyway, even with it, the playbook doesn’t update the package and says “up to date”.

Dear Frank,

I was going to ask you to try with specifying the latest version number, however i can see that the current yum module/documentation at least does not provide that option, it would useful option as for us we have certain environments that are capped as per vendor/solution certification and support matrix.

regards

Walid

Frank: Yes, I have run into that issue before where clean will not clean up disabled repos. Go ahead and file a github issue in regards to your problem if you would, and we will look into it.

Walid, that is not accurate. You can specify name=pkg-1.0 which will install a specific version.

James,

thank you, i stand corrected.

kind regards

Walid

James,
I spent some time to try to debug the python script created on the target. It seems that in is_update function, the variables “pkgs” is always empty, so “my.returnPackagesByDep(pkgspec) + my.returnInstalledPackagesByDep(pkgspec)” and “my.pkgSack.matchPackageNames([pkgspec])” return nothing, but “pkgspec” is correctly filled with all possible versions of monit, including those in repo rpmforge.
Do you know what should this YumBase module normally return ?

Well. I’ve tested a simple script like that :

import yum
pkgspec=‘monit’
my = yum.YumBase()
my.repos.enableRepo(‘rpmforge’)
print ‘RET=’,my.returnPackagesByDep(pkgspec),‘RET’
print ‘INST=’,my.returnInstalledPackagesByDep(pkgspec)

This returns packages lists with pkgspec=‘monit’ like above, but nothing if I test with pkgspec=‘monit-5.5-1.el5.rf.i386’, which, if I’ve correctly traced the ansible script, is what it does…
Please say if it can be a bug or if I made something wrong ?
If bug, I’ll post all that as an issue on github.

Hi,
digging in github/ansible, I find some tips. Finally, installing yum-utils (so repoquery) seems to solve this problem.
But it seems also to me that it’s not a normal behavior, yes ? For now I install yum-util on all my servers.

Bye.
Frank

That is actually a known issue we’re tracking on github (https://github.com/ansible/ansible/issues/2002). It was thought to only impact older RHEL versions talking to an RHN server, however it appears to be cropping up more on newer EL6 systems as well, so I’ll take a look at getting that fixed ASAP.

Thanks James,
I’ve seen this issue, I took in it the idea of installing yum-utils, but it wasn’t clear because it is closed, first, and as you said concerns only RHN, on the other hand.
Just keep in mind that I noted this problem on CentOS 5 (5.3, 5.4) systems as on CentOS 6 (6.3, 6.4).
Maybe this issue can be reopen on github, I’ll can comment it with my tests, especially those showing that returnPackagesByDep seems to works with only the short package name (like “monit”) but not with the full name (“monit-5.5-1.el5.rf.i386”).

Best regards, and again thanks for the job done.
Frank