# yum module:  removing groups failing

**URL:** <https://forum.ansible.com/t/yum-module-removing-groups-failing/25881>\
**Category:** Ansible Project\
**Created:** [October 31, 2017, 7:45pm UTC](https://forum.ansible.com/t/yum-module-removing-groups-failing/25881 "2017-10-31T19:45:54Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![John\_Harmon](https://avatars.discourse-cdn.com/v4/letter/j/edb3f5/32.png) [@John\_Harmon](https://forum.ansible.com/u/John_Harmon)\
**Post date:** [October 31, 2017, 7:45pm UTC](https://forum.ansible.com/t/yum-module-removing-groups-failing/25881/1 "2017-10-31T19:45:54Z")

</div>

I have the following, but it fails. Do I have a syntax issue or something? I can’t seem to find the problem.

`

- hosts: “{{ host }}”  
tasks:
- name: Remove GUI  
yum:  
name: “{{ item }}”  
state: absent  
with\_items:
- “@Console internet tools”
- “@General Purpose Desktop”
- “@Graphical Administration Tools”
- “@Graphics Creation Tools”
- “@Internet Browser”
- “@KDE Desktop”
- “@Legacy X Window System compatibility”
- “@Remote Desktop Clients”
- “@TeX support”
- “@Technical Writing”
- “@X Window System”
- “@Desktop”
- “@Desktop Debugging and Performance Tools”
- “@Dial-up Networking Support”
- “@Remote Desktop Clients”

`

Result:

`  
TASK [Remove GUI]  
failed: [ansible-oel6] (item=[u’@Console internet tools’, u’@General Purpose Desktop’, u’@Graphical Administration Tools’, u’@Graphics Creation Tools’, u’@Internet Browser’, u’@KDE Desktop’, u’@Legacy X Window System compatibility’, u’@Remote Desktop Clients’, u’@TeX support’, u’@Technical Writing’, u’@X Window System’, u’@Desktop’, u’@Desktop Debugging and Performance Tools’, u’@Dial-up Networking Support’, u’@Remote Desktop Clients’]) =\> {“changed”: false, “failed”: true, “item”: [“@Console internet tools”, “@General Purpose Desktop”, “@Graphical Administration Tools”, “@Graphics Creation Tools”, “@Internet Browser”, “@KDE Desktop”, “@Legacy X Window System compatibility”, “@Remote Desktop Clients”, “@TeX support”, “@Technical Writing”, “@X Window System”, “@Desktop”, “@Desktop Debugging and Performance Tools”, “@Dial-up Networking Support”, “@Remote Desktop Clients”], “msg”: “”, “rc”: 0, “results”: [“@Console internet tools is not installed”, “@General Purpose Desktop is not installed”, “@Graphical Administration Tools is not installed”, “@Graphics Creation Tools is not installed”, “@Internet Browser is not installed”, “@KDE Desktop is not installed”, “@Legacy X Window System compatibility is not installed”, “@Remote Desktop Clients is not installed”, “@TeX support is not installed”, “@Technical Writing is not installed”, “@X Window System is not installed”, “@Desktop is not installed”, “@Dial-up Networking Support is not installed”, “@Remote Desktop Clients is not installed”, “Loaded plugins: security\nSetting up Remove Process\nNo Packages marked for removal\n”]}

PLAY RECAP \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*  
ansible-oel6 : ok=1 changed=0 unreachable=0 failed=1

`

---

<div class="post-metadata">

**Author:** ![John\_Harmon](https://avatars.discourse-cdn.com/v4/letter/j/edb3f5/32.png) [@John\_Harmon](https://forum.ansible.com/u/John_Harmon)\
**Post date:** [November 2, 2017, 9:36pm UTC](https://forum.ansible.com/t/yum-module-removing-groups-failing/25881/2 "2017-11-02T21:36:58Z")

</div>

anyone?

---

<div class="post-metadata">

**Author:** ![Steve\_McKuhr](https://avatars.discourse-cdn.com/v4/letter/s/bbce88/32.png) [@Steve\_McKuhr](https://forum.ansible.com/u/Steve_McKuhr)\
**Post date:** [November 3, 2017, 3:17am UTC](https://forum.ansible.com/t/yum-module-removing-groups-failing/25881/3 "2017-11-03T03:17:33Z")

</div>

It looks to me like that's the clue: are any of the groups in  
'with\_items' installed?

So although Ansible command completed successfully the yum return code  
is 1 which accounts for a failure:

&nbsp;&nbsp;&nbsp;[root@leel ~]# dnf remove "@x" ; echo $?  
&nbsp;&nbsp;&nbsp;Warning: Group 'x' is not installed.  
&nbsp;&nbsp;&nbsp;Error: No groups marked for removal.  
&nbsp;&nbsp;&nbsp;1

Does that make sense?

-Steve

---

<div class="post-metadata">

**Author:** ![John\_Harmon](https://avatars.discourse-cdn.com/v4/letter/j/edb3f5/32.png) [@John\_Harmon](https://forum.ansible.com/u/John_Harmon)\
**Post date:** [November 3, 2017, 4:47pm UTC](https://forum.ansible.com/t/yum-module-removing-groups-failing/25881/4 "2017-11-03T16:47:02Z")

</div>

All of the groups are installed on the managed server. If I run yum groupremove on the server it removes fine. It is just within ansible that it is failing. Ansible has you reference groups with @groupname in the yum module. These aren’t environment groups (referenced with @^groupname)

---

<div class="post-metadata">

**Author:** ![John\_Harmon](https://avatars.discourse-cdn.com/v4/letter/j/edb3f5/32.png) [@John\_Harmon](https://forum.ansible.com/u/John_Harmon)\
**Post date:** [November 3, 2017, 6:04pm UTC](https://forum.ansible.com/t/yum-module-removing-groups-failing/25881/5 "2017-11-03T18:04:46Z")

</div>

Is this a bug perhaps? If I change state to present, it will install the packages just fine. If I changed the state to absent or removed, it fails. If I leave it at absent, and change my first with\_item to include {} within the quotes, then some of the packages are removed and some fail. This is just weird.

---

<div class="post-metadata">

**Author:** ![Steve\_McKuhr](https://avatars.discourse-cdn.com/v4/letter/s/bbce88/32.png) [@Steve\_McKuhr](https://forum.ansible.com/u/Steve_McKuhr)\
**Post date:** [November 3, 2017, 6:44pm UTC](https://forum.ansible.com/t/yum-module-removing-groups-failing/25881/6 "2017-11-03T18:44:26Z")

</div>

Same results with the DNF plugin?

---

<div class="post-metadata">

**Author:** ![John\_Harmon](https://avatars.discourse-cdn.com/v4/letter/j/edb3f5/32.png) [@John\_Harmon](https://forum.ansible.com/u/John_Harmon)\
**Post date:** [November 3, 2017, 6:47pm UTC](https://forum.ansible.com/t/yum-module-removing-groups-failing/25881/7 "2017-11-03T18:47:57Z")

</div>

`  
TASK [Remove GUI from servers] \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*  
failed: [ansible-oel6] (item=[u’@Console internet tools’, u’@General Purpose Desktop’, u’@Graphical Administration Tools’, u’@Graphics Creation Tools’, u’@Internet Browser’, u’@KDE Desktop’, u’@Legacy X Window System compatibility’, u’@Remote Desktop Clients’, u’@TeX support’, u’@Technical Writing’, u’@X Window System’, u’@Desktop’, u’@Desktop Debugging and Performance Tools’, u’@Dial-up Networking Support’, u’@Remote Desktop Clients’]) =\> {“changed”: false, “cmd”: “dnf install -y python2-dnf”, “failed”: true, “item”: [“@Console internet tools”, “@General Purpose Desktop”, “@Graphical Administration Tools”, “@Graphics Creation Tools”, “@Internet Browser”, “@KDE Desktop”, “@Legacy X Window System compatibility”, “@Remote Desktop Clients”, “@TeX support”, “@Technical Writing”, “@X Window System”, “@Desktop”, “@Desktop Debugging and Performance Tools”, “@Dial-up Networking Support”, “@Remote Desktop Clients”], “msg”: “[Errno 2] No such file or directory”, “rc”: 2}

`

---

<div class="post-metadata">

**Author:** ![John\_Harmon](https://avatars.discourse-cdn.com/v4/letter/j/edb3f5/32.png) [@John\_Harmon](https://forum.ansible.com/u/John_Harmon)\
**Post date:** [November 3, 2017, 7:03pm UTC](https://forum.ansible.com/t/yum-module-removing-groups-failing/25881/8 "2017-11-03T19:03:19Z")

</div>

dnf… interesting. I learned something new.

These boxes do not have dnf on then, nor do the epel-repos tied to them. They are OEL 6.5 boxes for the most part. Some are OEL 6.9

---

<div class="post-metadata">

**Author:** ![John\_Harmon](https://avatars.discourse-cdn.com/v4/letter/j/edb3f5/32.png) [@John\_Harmon](https://forum.ansible.com/u/John_Harmon)\
**Post date:** [November 21, 2017, 5:19pm UTC](https://forum.ansible.com/t/yum-module-removing-groups-failing/25881/9 "2017-11-21T17:19:26Z")

</div>

Anyone else? This is still an issue.

`  
TASK [Remove GUI from servers] \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*  
failed: [ansible-oel6] (item=[u’@Console internet tools’, u’@General Purpose Desktop’, u’@Graphical Administration Tools’, u’@Graphics Creation Tools’, u’@Internet Browser’, u’@KDE Desktop’, u’@Legacy X Window System compatibility’, u’@Remote Desktop Clients’, u’@TeX support’, u’@Technical Writing’, u’@X Window System’, u’@Desktop’, u’@Desktop Debugging and Performance Tools’, u’@Dial-up Networking Support’, u’@Remote Desktop Clients’]) =\> {“changed”: false, “cmd”: “dnf install -y python2-dnf”, “failed”: true, “item”: [“@Console internet tools”, “@General Purpose Desktop”, “@Graphical Administration Tools”, “@Graphics Creation Tools”, “@Internet Browser”, “@KDE Desktop”, “@Legacy X Window System compatibility”, “@Remote Desktop Clients”, “@TeX support”, “@Technical Writing”, “@X Window System”, “@Desktop”, “@Desktop Debugging and Performance Tools”, “@Dial-up Networking Support”, “@Remote Desktop Clients”], “msg”: “[Errno 2] No such file or directory”, “rc”: 2}  
…ignoring

`

---

<div class="post-metadata">

**Author:** ![John\_Harmon](https://avatars.discourse-cdn.com/v4/letter/j/edb3f5/32.png) [@John\_Harmon](https://forum.ansible.com/u/John_Harmon)\
**Post date:** [November 21, 2017, 6:28pm UTC](https://forum.ansible.com/t/yum-module-removing-groups-failing/25881/10 "2017-11-21T18:28:10Z")

</div>

Well, the last failure is due to using dnf on this box, which doesn’t exist… that makes sense. I tried this same yml on a rhel6 box and it worked fine… it must be something specific to OEL
