YUM module not installing/uninstall local JDK RPM

137 views
Skip to first unread message

Colin L

unread,
Aug 30, 2017, 4:18:37 PM8/30/17
to Ansible Project
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


Dick Visser

unread,
Aug 31, 2017, 4:55:17 AM8/31/17
to ansible...@googlegroups.com
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
> --
> You received this message because you are subscribed to the Google Groups
> "Ansible Project" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to ansible-proje...@googlegroups.com.
> To post to this group, send email to ansible...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/ansible-project/6fb676c9-1450-4a87-a8f5-56dc948fbd41%40googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.



--
Dick Visser
GÉANT

Want to join us? We're hiring: https://www.geant.org/jobs

Colin L

unread,
Sep 1, 2017, 10:49:22 AM9/1/17
to Ansible Project
Thank you Dick.

That makes sense that it is just how YUM (and other package managers work)
Reply all
Reply to author
Forward
0 new messages