我有以下 yaml ansible-playbook 并希望传输 rpm,然后将它们本地安装到远程机器上。直到传输文件步骤它工作正常但是在安装部分我出现以下错误:"Failure talking to yum: near \"gskcrypt64\": syntax error"
知道如何克服这部分吗?
Ansible 版本:
ansible 2.4.2.0
config file = /etc/ansible/ansible.cfg
configured module search path = [u'/root/.ansible/plugins/modules', u'/usr/share/ansible/plugins/modules']
ansible python module location = /usr/lib/python2.7/site-packages/ansible
executable location = /usr/bin/ansible
python version = 2.7.5 (default, Jun 11 2019, 12:19:05) [GCC 4.8.5 20150623 (Red Hat 4.8.5-36)]
Ansible 剧本:
---
- hosts: "1.2.3.4"
connection: "ssh"
vars:
RPM:
- gskcrypt64-8.0.50.86.linux.ppcle.rpm
- gskssl64-8.0.50.86.linux.ppcle.rpm
- TIVsm-API64.ppc64le.rpm
- TIVsm-BA.ppc64le.rpm
tasks:
- name: "Transfer Files"
copy: src=/root/ansible_playbooks/{{ item }} dest=/root/
with_items: "{{ RPM }}"
- name: "Install Local RPMs"
shell: yum localinstall -y /root/*.rpm
如果我更改 shell 模块,则会报告相同的错误
- name: "Install Local RPMs"
yum:
name: /root/{{ RPM }}
state: present
错误:
root@server [/root/ansible_playbooks] > ansible-playbook tsm
PLAY [1.2.3.4] ******************************************************************************************************************************************************************************************************
TASK [Gathering Facts] ***************************************************************************************************************************************************************************************************
ok: [1.2.3.4]
TASK [Transfer Files] ****************************************************************************************************************************************************************************************************
ok: [1.2.3.4] => (item=gskcrypt64-8.0.50.86.linux.ppcle.rpm)
ok: [1.2.3.4] => (item=gskssl64-8.0.50.86.linux.ppcle.rpm)
ok: [1.2.3.4] => (item=TIVsm-API64.ppc64le.rpm)
ok: [1.2.3.4] => (item=TIVsm-BA.ppc64le.rpm)
TASK [Install Local RPMs] ************************************************************************************************************************************************************************************************
fatal: [1.2.3.4]: FAILED! => {"changed": false, "msg": "Failure talking to yum: near \"gskcrypt64\": syntax error"}
to retry, use: --limit @/root/ansible_playbooks/tsm.retry
PLAY RECAP ***************************************************************************************************************************************************************************************************************
1.2.3.4 : ok=2 changed=0 unreachable=0 failed=1
Edit1:我尝试了以下循环,因为文件已经在另一边:
---
- hosts: "1.2.3.4"
connection: "ssh"
vars:
RPM:
- gskcrypt64-8.0.50.86.linux.ppcle.rpm
- gskssl64-8.0.50.86.linux.ppcle.rpm
- TIVsm-API64.ppc64le.rpm
- TIVsm-BA.ppc64le.rpm
tasks:
- name: "Install Local RPMs"
yum:
name: /root/"{{ item }}"
state: present
loop: "{{ RPM }}"
现在收到以下错误:
fatal: [1.2.3.4]: FAILED! => {"msg": "Unexpected failure in finding the lookup named '{{ RPM }}' in the available lookup plugins"}
编辑2:
尝试移动并测试 yum localinstall 的失败部分:
---
- hosts: "1.2.3.4"
connection: "ssh"
vars:
RPM:
- gskcrypt64-8.0.50.86.linux.ppcle.rpm
- gskssl64-8.0.50.86.linux.ppcle.rpm
- TIVsm-API64.ppc64le.rpm
- TIVsm-BA.ppc64le.rpm
tasks:
- name: "Install Local RPMs"
yum:
name: "/root/{{RPM}}"
state: present
但得到错误:
fatal: [1.2.3.4]: FAILED! => {"changed": false, "msg": "Failure talking to yum: near \"gskcrypt64\": syntax error"}