yum module: removing groups failing

65 views
Skip to first unread message

John Harmon

unread,
Oct 31, 2017, 3:45:54 PM10/31/17
to Ansible Project
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



John Harmon

unread,
Nov 2, 2017, 5:36:58 PM11/2/17
to Ansible Project
anyone?

Steve McKuhr

unread,
Nov 2, 2017, 11:17:48 PM11/2/17
to ansible...@googlegroups.com
On Tue Oct 31 2017 12:45:54 GMT-0700 (PDT) John Harmon <jharmon...@gmail.com> wrote:
> 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"]}

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

John Harmon

unread,
Nov 3, 2017, 12:47:02 PM11/3/17
to Ansible Project
All of the groups are installed on the managed server.  If I run yum groupremove <groupname> 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)

John Harmon

unread,
Nov 3, 2017, 2:04:46 PM11/3/17
to Ansible Project
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.

Steve McKuhr

unread,
Nov 3, 2017, 2:44:35 PM11/3/17
to ansible...@googlegroups.com
On Fri Nov 03 2017 11:04:46 GMT-0700 (PDT) John Harmon
Same results with the DNF plugin?

--
Viorel
Message has been deleted

John Harmon

unread,
Nov 3, 2017, 2:47:57 PM11/3/17
to Ansible Project
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}

John Harmon

unread,
Nov 3, 2017, 3:03:19 PM11/3/17
to Ansible Project
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

John Harmon

unread,
Nov 21, 2017, 12:19:26 PM11/21/17
to Ansible Project
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



John Harmon

unread,
Nov 21, 2017, 1:28:11 PM11/21/17
to Ansible Project
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
Reply all
Reply to author
Forward
0 new messages