ssh - 通过ansible yum在CentOS 7上安装Xfce

标签 ssh ansible centos7 yum

我有一台刚从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 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.



您将组指定为@^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/

相关文章:

ruby-on-rails - 每次在开发模式下加载Rails时,如何创建ssh隧道?

java - Jsch - 每个 session 多个 channel

amazon-web-services - 通过 Cloudformation 创建资源时无法通过 SSH 连接到我的 ec2 实例

apache - Centos7 Apache SSL

PHP Curl 错误 35 - 同行报告不兼容或不受支持的协议(protocol)版本

ruby - 如何通过 ssh 显示来自 shell 命令的进度条

Ansible 在单个任务中注册多个变量

linux - 如何在 'when'模块中包含特殊字符?

regex - 在 Ansible 中提取 {{ inventory_hostname }} 的一部分以在 playbook 中使用

linux - vim 和 sudo 可执行文件的路径