我有一台刚从centos/7
vagrant基本框启动的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
,这是“环境组”的语法,但是如果查看yum group list hidden ids
的输出,则没有“Xfce”环境组。有一个同名的软件包组,此剧本似乎已成功安装它:---
- hosts: localhost
gather_facts: false
tasks:
- name: install xfce
yum:
name: "@Xfce"
state: "present"
enablerepo: "epel"
关于ssh - 通过ansible yum在CentOS 7上安装Xfce,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/59579917/