yum module: removing groups failing

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

`

anyone?

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:

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

Does that make sense?

-Steve

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)

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.

Same results with the DNF plugin?

`
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}

`

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

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

`

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