Unable to run with yum module to install packages.
Below is the error message:
fatal: [sdtarget01p]: FAILED! => changed=false
module_stderr: |-
Shared connection to sdtarget01p.int.example.com closed.
module_stdout: |-
Traceback (most recent call last):
File “/home/aux502550/.ansible/tmp/ansible-tmp-1720531139.05-1803-207126550725931/AnsiballZ_yum.py”, line 102, in
_ansiballz_main()
File “/home/aux502550/.ansible/tmp/ansible-tmp-1720531139.05-1803-207126550725931/AnsiballZ_yum.py”, line 94, in _ansiballz_main
invoke_module(zipped_mod, temp_path, ANSIBALLZ_PARAMS)
File “/home/aux502550/.ansible/tmp/ansible-tmp-1720531139.05-1803-207126550725931/AnsiballZ_yum.py”, line 40, in invoke_module
runpy.run_module(mod_name=‘ansible.modules.core.packaging.os.yum’, init_globals=None, run_name=‘main’, alter_sys=True)
File “/usr/lib64/python3.6/runpy.py”, line 205, in run_module
return _run_module_code(code, init_globals, run_name, mod_spec)
File “/usr/lib64/python3.6/runpy.py”, line 96, in _run_module_code
mod_name, mod_spec, pkg_name, script_name)
File “/usr/lib64/python3.6/runpy.py”, line 85, in _run_code
exec(code, run_globals)
File “/tmp/ansible_yum_payload_1xqy_pbd/ansible_yum_payload.zip/ansible/modules/core/packaging/os/yum.py”, line 25, in
ModuleNotFoundError: No module named ‘yum’
msg: |-
MODULE FAILURE
See stdout/stderr for the exact error
rc: 1
atal: [sdtarget01p]: FAILED! => changed=false
module_stderr: |-
Shared connection to sdtarget01p.int.example
.com closed.
module_stdout: |-
Traceback (most recent call last):
File “/home/asadmin/.ansible/tmp/ansible-tmp-1720540285.17-17206-38800975450038/AnsiballZ_dnf.py”, line 102, in
_ansiballz_main()
File “/home/asadmin/.ansible/tmp/ansible-tmp-1720540285.17-17206-38800975450038/AnsiballZ_dnf.py”, line 94, in ansiballz_main
invoke_module(zipped_mod, temp_path, ANSIBALLZ_PARAMS)
File “/home/asadmin/.ansible/tmp/ansible-tmp-1720540285.17-17206-38800975450038/AnsiballZ_dnf.py”, line 40, in invoke_module
runpy.run_module(mod_name=‘ansible.modules.extras.packaging.os.dnf’, init_globals=None, run_name=‘main’, alter_sys=True)
File “/usr/lib64/python3.6/runpy.py”, line 205, in run_module
return run_module_code(code, init_globals, run_name, mod_spec)
File “/usr/lib64/python3.6/runpy.py”, line 96, in run_module_code
mod_name, mod_spec, pkg_name, script_name)
File “/usr/lib64/python3.6/runpy.py”, line 85, in run_code
exec(code, run_globals)
File "/tmp/ansible_ansible.builtin.dnf_payload_aa17bwb/ansible_ansible.builtin.dnf_payload.zip/ansible/modules/extras/packaging/os/dnf.py", line 436, in
File "/tmp/ansible_ansible.builtin.dnf_payload_aa17bwb/ansible_ansible.builtin.dnf_payload.zip/ansible/modules/extras/packaging/os/dnf.py", line 430, in main
File "/tmp/ansible_ansible.builtin.dnf_payload_aa17bwb/ansible_ansible.builtin.dnf_payload.zip/ansible/modules/extras/packaging/os/dnf.py", line 266, in ensure
File "/tmp/ansible_ansible.builtin.dnf_payload_aa17bwb/ansible_ansible.builtin.dnf_payload.zip/ansible/modules/extras/packaging/os/dnf.py", line 238, in _parse_spec_group_file
AttributeError: ‘list’ object has no attribute ‘endswith’
msg: |-
MODULE FAILURE
See stdout/stderr for the exact error
rc: 1
If you need to continue using the RHEL 7 server as a RHEL 7 Ansible control node, I would suggest yum remove ansible; yum install python3-pip; pip3 install ansible, and that will get you the latest version of Ansible for python 3.6.
However, I think it would be more prudent to build a new control node on RHEL 8 or 9 and eventually retire the RHEL 7 node, or perform a leapp in-place upgrade on the RHEL 7 control node. Whichever is easier.
First try running against one package specifically listed instead of using a list/variable. If that works, then you know it is something wrong with your list.
You also might need to have become: true, as that is usually needed for yum/dnf installs.