Hi all,
Thank you for your help in my last post. I have come quite a way (small
compared to many of you) but nevertheless making good progress each day.
I hit roadblocks quite a bit and thankfully google has helped me quite a
bit. I have come across this problem now which I hope some of you can
explain and then help me with finding a solution. This is my code so far:
---
- hosts: all
serial: 3
become: yes
tasks:
- name: ping all the machines
ping:
- name: Import all GPG keys for repo
command: "rpm --import /etc/pki/rpm-gpg/RPM-GPG-KEY-*"
When I am trying to run the rpm --import as a command, I get this error on
my 3 test hosts:
1. What does it mean, why is this producing an error? I can enter this
directly as a command in shell and it works just fine, so where is Ansible
having issues?
2. How can I fix this and find a solution so that all my keys from the pki
directory is imported as I have a mixture of RHEL and CentOS systems?
TASK [Import all GPG keys for repo]
*****************************************************************************************************
[WARNING]: Consider using the yum, dnf or zypper module rather than running
'rpm'. If you need to use command because yum, dnf or
zypper is insufficient you can add 'warn: false' to this command task or
set 'command_warnings=False' in ansible.cfg to get rid of this
message.
fatal: [localhost]: FAILED! => {"changed": true, "cmd": ["rpm", "--import",
"/etc/pki/rpm-gpg/RPM-GPG-KEY-*"], "delta": "0:00:00.029904", "end":
"2020-05-06 05:08:49.909745", "msg": "non-zero return code", "rc": 1,
"start": "2020-05-06 05:08:49.879841", "stderr": "error:
/etc/pki/rpm-gpg/RPM-GPG-KEY-*: import read failed(2).", "stderr_lines":
["error: /etc/pki/rpm-gpg/RPM-GPG-KEY-*: import read failed(2)."],
"stdout": "", "stdout_lines": []}
fatal: [testb_centos78]: FAILED! => {"changed": true, "cmd": ["rpm",
"--import", "/etc/pki/rpm-gpg/RPM-GPG-KEY-*"], "delta": "0:00:00.027775",
"end": "2020-05-06 05:08:50.031696", "msg": "non-zero return code", "rc":
1, "start": "2020-05-06 05:08:50.003921", "stderr": "error:
/etc/pki/rpm-gpg/RPM-GPG-KEY-*: import read failed(2).", "stderr_lines":
["error: /etc/pki/rpm-gpg/RPM-GPG-KEY-*: import read failed(2)."],
"stdout": "", "stdout_lines": []}
fatal: [testa_centos78]: FAILED! => {"changed": true, "cmd": ["rpm",
"--import", "/etc/pki/rpm-gpg/RPM-GPG-KEY-*"], "delta": "0:00:00.027843",
"end": "2020-05-06 05:08:50.035566", "msg": "non-zero return code", "rc":
1, "start": "2020-05-06 05:08:50.007723", "stderr": "error:
/etc/pki/rpm-gpg/RPM-GPG-KEY-*: import read failed(2).", "stderr_lines":
["error: /etc/pki/rpm-gpg/RPM-GPG-KEY-*: import read failed(2)."],
"stdout": "", "stdout_lines": []}
Thanks in advance everyone.
--
You received this message because you are subscribed to the Google Groups
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/ansible-project/cf399d8a-bba9-49b8-afe9-6d07516eb99f%40googlegroups.com.