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