YUM module not installing/uninstall local JDK RPM

Hello,

YUM module doesn’t seem to find the correct state of a JDK module. When I run it with both ‘installed’ and ‘absent’ both of the playbooks run successfully.

Ad-hoc play:

ansible localhost -m yum -a “state=installed name=/root/Downloads/jdk-8u112-linux-x64.rpm”

Result:

localhost | SUCCESS => {
“changed”: false,
“failed”: false,
“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”: [
“/root/Downloads/jdk-8u112-linux-x64.rpm”
],
“security”: false,
“skip_broken”: false,
“state”: “installed”,
“update_cache”: false,
“validate_certs”: true
}
},
“msg”: “”,
“rc”: 0,
“results”:

When attempting to remove the package:

ansible localhost -m yum -a “state=absent name=/root/Downloads/jdk-8u112-linux-x64.rpm” -vvv

Result:
localhost | SUCCESS => {
“changed”: false,
“failed”: false,
“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”: [
“/root/Downloads/jdk-8u112-linux-x64.rpm”
],
“security”: false,
“skip_broken”: false,
“state”: “absent”,
“update_cache”: false,
“validate_certs”: true
}
},
“msg”: “”,
“rc”: 0,
“results”: [
“/root/Downloads/jdk-8u112-linux-x64.rpm is not installed”
]
}

When running the standard rpm command, it lists as being installed:

rpm -i /root/Downloads/jdk-8u112-linux-x64.rpm
package jdk1.8.0_112-2000:1.8.0_112-fcs.x86_64 is already installed

And checking through all installed rpm’s confirms it:

rpm -qa | grep jdk
jdk1.8.0_112-1.8.0_112-fcs.x86_64

Is my syntax incorrect? Can I not use the full path? Is there another flag that I am not using?

I find it very hard to believe that YUM doesn’t have this functionality.

Any thoughts?

Colin

You can install an rpm by it's file name, but you cannot uninstall it
by its file name.
You have to use the actual package name, so in this case probably "jdk1.8.0".

This isn't a limitation of ansible, but merely the way yum works (and
apt-get too, for that matter)

Dick

Thank you Dick.

That makes sense that it is just how YUM (and other package managers work)