1

I have a Centos 7 machine freshly started from the centos/7 vagrant base box. I provision the box via ansible but the following does not work:

- name: Install xfce
  yum:
    name: "@^Xfce"
    state: present
    enablerepo: "epel"

The error is:

TASK [desktop : Install xfce] ************************************************** fatal: [xxx]: FAILED! => {"changed": false, "changes": {"installed": ["@^Xfce"]}, "msg": "Error: Nothing to do\n", "rc": 1, "results": ["Loaded plugins: fastestmirror\nLoading mirror speeds from cached hostfile\n * base: mirror.ratiokontakt.de\n * epel: mirror.de.leaseweb.net\n * extras: centos.schlundtech.de\n * updates: centos.schlundtech.de\nGroup Xfce does not exist.\n"]}

Yet, running the following command from within the machine works:

sudo yum --enablerepo=epel -y groups install "Xfce"

What am I doing wrong?

1 Answer 1

3

According to the yum module documentation:

Yum itself has two types of groups. “Package groups” are specified in the rpm itself while “environment groups” are specified in a separate file (usually by the distribution). Unfortunately, this division becomes apparent to ansible users because ansible needs to operate on the group of packages in a single transaction and yum requires groups to be specified in different ways when used in that way. Package groups are specified as “@development-tools” and environment groups are “@^gnome-desktop-environment”. Use the “yum group list hidden ids” command to see which category of group the group you want to install falls into.

You're specifying your grouop as @^Xfce, which is the syntax for an "environment group", but if you look at the output of yum group list hidden ids there is no "Xfce" environment group. There is a package group by that name, and this playbook seems to install it successfully:

---
- hosts: localhost
  gather_facts: false
  tasks:
    - name: install xfce
      yum:
        name: "@Xfce"
        state: "present"
        enablerepo: "epel"

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.