# YUM module not installing/uninstall local JDK RPM

**URL:** <https://forum.ansible.com/t/yum-module-not-installing-uninstall-local-jdk-rpm/25376>\
**Category:** Ansible Project\
**Created:** [August 30, 2017, 8:18pm UTC](https://forum.ansible.com/t/yum-module-not-installing-uninstall-local-jdk-rpm/25376 "2017-08-30T20:18:37Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Colin\_L](https://avatars.discourse-cdn.com/v4/letter/c/f04885/32.png) [@Colin\_L](https://forum.ansible.com/u/Colin_L)\
**Post date:** [August 30, 2017, 8:18pm UTC](https://forum.ansible.com/t/yum-module-not-installing-uninstall-local-jdk-rpm/25376/1 "2017-08-30T20:18:37Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Dick\_Visser](https://avatars.discourse-cdn.com/v4/letter/d/d9b06d/32.png) [@Dick\_Visser](https://forum.ansible.com/u/Dick_Visser)\
**Post date:** [August 31, 2017, 8:54am UTC](https://forum.ansible.com/t/yum-module-not-installing-uninstall-local-jdk-rpm/25376/2 "2017-08-31T08:54:44Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Colin\_L](https://avatars.discourse-cdn.com/v4/letter/c/f04885/32.png) [@Colin\_L](https://forum.ansible.com/u/Colin_L)\
**Post date:** [September 1, 2017, 2:49pm UTC](https://forum.ansible.com/t/yum-module-not-installing-uninstall-local-jdk-rpm/25376/3 "2017-09-01T14:49:22Z")

</div>

Thank you Dick.

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