The name is a package specification, so qualifiers like >= and so on
can be used at install time. I'm also not immediately sure whether
those can be used at removal time, and haven't tried this yet, but:
instead of:
ansible el5-c1 -m yum -a "name=kernel-2.6.18-308.13.1.el5 state=removed"
try:
ansible el5-c1 -m yum -a "name=kernel=2.6.18-308.13.1 state=removed"
(be sure you're on latest Ansible 0.7)
if that doesn't work, you could also use the "installonlyn" yum plugin
too, and then it's self managing. (Unless that's not
recommended in yum anymore -- which I'm not sure of -- but it
basically keeps the last N kernels around)
I tried this, no joy:
[steve@ansible ansible]$ ansible el5-c1 -m yum -a “name=kernel=2.6.18-308.13.1 state=removed”
el5-c1 | FAILED >> {
“changed”: false,
“failed”: true,
“item”: “”,
“module”: “yum”,
“msg”: “No Package matching ‘kernel=2.6.18-308.13.1’ found available, installed or updated”,
“rc”: 0,
“results”:
}
Yum erase does catch it though:
[root@el5-c3 yum.repos.d]# yum erase kernel-2.6.18-308.13.1.el5
Loaded plugins: fastestmirror
Setting up Remove Process
Resolving Dependencies
→ Running transaction check
—> Package kernel.i686 0:2.6.18-308.13.1.el5 set to be erased
I can work around this with using shell or command for now. I’m no Python wiz but maybe I’ll look to see if I can’t submit a patch in case others run into this. Admittedly this is a bizarro corner case, but I figure I’d attack those straight away since ansible already works well for the normal stuff.
This is an excellent tool; I love the simplicity of it’s design, and the power that simplicity gives it.
Steve
I can work around this with using shell or command for now. I'm no Python wiz but maybe I'll look to see if I can't submit a patch in case others run into this. Admittedly this is a bizarro corner case, but I figure I'd attack those straight away since ansible already works well for the normal stuff.
Sounds good. I think the kernel case is pretty much the only time someone would try this and my version of CentOS ships with installonly_limit=5, so yeah, I would agree it's a bit of a corner case. Patch would still be nice though.
This is an excellent tool; I love the simplicity of it's design, and the power that simplicity gives it.
Glad you like it!