yum module not updating local rpm

Running ansible 2.1.1.0 on CentOS 6.

I have a package (v5.5.0) that is installed on the remote host:

[remotehost ~] $ rpm -q mypkg
mypkg-5.5.0-1.el6.x86_64

I tried to use this command on the ansible server to update the package to v5.5.2 on the remotehost:

ansible remotehost -m yum -a “name=/nfs/RPMS/mypkg-5.5.2-1.el6.x86_64.rpm state=present” -vvvv

remotehost | SUCCESS => {
“changed”: false,
“invocation”: {
“module_args”: {
“conf_file”: null,
“disable_gpg_check”: false,
“disablerepo”: null,
“enablerepo”: null,
“exclude”: null,
“install_repoquery”: true,
“list”: null,
“name”: [
“/nfs/RPMS/mypkg-5.5.2-1.el6.x86_64.rpm”
],
“state”: “present”,
“update_cache”: false,
“validate_certs”: true
},
“module_name”: “yum”
},
“msg”: “”,
“rc”: 0,
“results”:
}

But the package doesn’t update. “changed” is false. It remains at 5.5.0, not 5.5.2 as expected.

If i try to change state to latest, I get the following error:

remotehost | FAILED! => {
“changed”: false,
“failed”: true,
“invocation”: {
“module_args”: {
“conf_file”: null,
“disable_gpg_check”: false,
“disablerepo”: null,
“enablerepo”: null,
“exclude”: null,
“install_repoquery”: true,
“list”: null,
“name”: [
“/nfs/RPMS/mypkg-5.5.2-1.el6.x86_64.rpm”
],
“state”: “latest”,
“update_cache”: false,
“validate_certs”: true
},
“module_name”: “yum”
},
“msg”: “No Package matching ‘/nfs/RPMS/mypkg-5.5.2-1.el6.x86_64.rpm’ found available, installed or updated”,
“rc”: 0,
“results”:
}

But both machines mount this NFS share and I can stat the file on both the ansible server and the remotehost.

Am I missing something obvious?

Thanks,
Giovanni

Check yum module documentation and take a look on state attribute.

http://docs.ansible.com/ansible/yum_module.html

You use present which mean - check if package install and install if not.
If you want to upgrade use latest.