Neha,
This is amazing! Thank you so much for your reply and the time you took to
actually run it for me.
Stay awesome as you are Neha :)
On Wednesday, May 6, 2020 at 7:35:45 AM UTC-4, Neha Pithadiya wrote:
>
> I tried locally on my setup and faced same issue.
>
> seems this rpm command uses shell , so you need to use "shell" module
> instead of "command" module.
>
> eg : shell: "rpm --import /etc/pki/rpm-gpg/RPM-GPG-KEY-*"
>
> Results of execution:
>
> changed: [localhost] => {
> "changed": true,
> "cmd": "rpm --import /etc/pki/rpm-gpg/RPM-GPG-KEY-*",
> "delta": "0:00:00.072035",
> "end": "2020-05-06 16:57:24.092604",
> "invocation": {
> "module_args": {
> "_raw_params": "rpm --import /etc/pki/rpm-gpg/RPM-GPG-KEY-*",
> "_uses_shell": true,
> "argv": null,
> "chdir": null,
> "creates": null,
> "executable": null,
> "removes": null,
> "stdin": null,
> "stdin_add_newline": true,
> "strip_empty_ends": true,
> "warn": true
> }
> },
> "rc": 0,
> "start": "2020-05-06 16:57:24.020569",
> "stderr": "",
> "stderr_lines": [],
> "stdout": "",
> "stdout_lines": []
>
> Thanks and Regards,
> Neha Pithadiya.
>
> On Wednesday, May 6, 2020 at 3:47:17 PM UTC+5:30, Quad Zero wrote:
>>
>> 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/964175e4-a800-4129-ab8a-dec760215c91%40googlegroups.com.