通过 ansible yum 在 CentOS 7 上安装 Xfce
Installing Xfce on CentOS 7 via ansible yum
我有一台刚从 centos/7
vagrant base box 启动的 Centos 7 机器。我通过 ansible 提供了盒子,但以下不起作用:
- name: Install xfce
yum:
name: "@^Xfce"
state: present
enablerepo: "epel"
错误是:
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"]}
然而,运行 机器内部的以下命令有效:
sudo yum --enablerepo=epel -y groups install "Xfce"
我做错了什么?
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.
您将组指定为 @^Xfce
,这是 "environment group" 的语法,但是如果您查看 yum group list hidden ids
的输出,则没有 "Xfce" 环境组。 是一个同名的包组,这个剧本似乎安装成功:
---
- hosts: localhost
gather_facts: false
tasks:
- name: install xfce
yum:
name: "@Xfce"
state: "present"
enablerepo: "epel"
我有一台刚从 centos/7
vagrant base box 启动的 Centos 7 机器。我通过 ansible 提供了盒子,但以下不起作用:
- name: Install xfce
yum:
name: "@^Xfce"
state: present
enablerepo: "epel"
错误是:
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"]}
然而,运行 机器内部的以下命令有效:
sudo yum --enablerepo=epel -y groups install "Xfce"
我做错了什么?
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.
您将组指定为 @^Xfce
,这是 "environment group" 的语法,但是如果您查看 yum group list hidden ids
的输出,则没有 "Xfce" 环境组。 是一个同名的包组,这个剧本似乎安装成功:
---
- hosts: localhost
gather_facts: false
tasks:
- name: install xfce
yum:
name: "@Xfce"
state: "present"
enablerepo: "epel"