我试图在ansible中使用yum模块安装atomic-openshift-utils软件包。运行时出现错误
- name: atomic-openshift-utils
yum:
name: "{{packages}}"
vars:
packages:
- atomic-openshift-utils
FAILED! => {"changed": false, "msg": "No package matching 'atomic-openshift-utils' found available, installed or updated", "rc": 126, "results": ["No package matching 'atomic-openshift-utils' found available, installed or updated"]}```
答案 0 :(得分:0)
- name: install deps
yum:
name: "{{packages}}"
vars:
packages:
- centos-release-openshift-origin39
- centos-release-paas-common
- name: install atomic-openshift-utils
yum:
name: atomic-openshift-utils
答案 1 :(得分:0)
确保已启用相应的订阅,为此您可能需要稍微扩展定义。
如果我们在https://docs.openshift.com/enterprise/3.1/install_config/install/prerequisites.html上查看实际文档,就会发现我们需要启用一些订阅才能添加要查询的存储库。
Ansible中的外观:
- name: Enable all repositories starting with rhel-7-server-*
rhsm_repository:
name: rhel-7-server-*
state: enabled
之后,您应该对定义满意。因此,总的来说,您将得到以下内容:
- name: Enable all repositories starting with rhel-7-server-*
rhsm_repository:
name: rhel-7-server-*
state: enabled
- name: atomic-openshift-utils
yum:
name: "{{packages}}"
vars:
packages:
- atomic-openshift-utils
请注意,在回购协议上使用通配符可能会给您带来比您需要更多的东西。您已经根据需要进行了调整。