I am getting below error
FAILED! => {“changed”: false, “msg”: “The Python 2 yum module is needed for this module. If you require Python 3 support use the dnf
Ansible module instead.”}
Please help
I am getting below error
FAILED! => {“changed”: false, “msg”: “The Python 2 yum module is needed for this module. If you require Python 3 support use the dnf
Ansible module instead.”}
Please help
The Python 2 yum module is needed for this module. If you require Python 3 support use the dnf
Ansible module instead.
You need to install yum bindings for Python2 or dnf bindings for Python3 on the remote machine.
Use the ‘package’ module instead of ‘yum’. It will do the right thing on each OS. Also, pass all the packages in a single task.
hosts: all
become: true
vars:
ansible_become_pass:
pkgs:
vim
ntp
tasks:
name: “install packages {{ pkgs }}”
package:
name: “{{ pkgs }}”
state: present
notify: “packages installed”
handlers:
name: start and enable ntp
service:
name: ntp
state: started
enabled: true
listen: “packages installed”
name: update yum cache
yum:
update_cache: yes
listen: “packages installed”
Walter