ansible yum not working

13,722

I find the solution, just add a python path to hosts file

ansible_python_interpreter=/usr/bin/python2.7
Share:
13,722
zimmer
Author by

zimmer

Updated on June 13, 2022

Comments

  • zimmer
    zimmer almost 2 years

    when i run command on the ops machine:

    ansible web -b -l 192.168.31.101 -m yum -a "name=gcc state=latest"
    

    it returns error shows below:

    192.168.31.101 | FAILED! => {
        "changed": false,
        "failed": true,
        "msg": "python2 bindings for rpm are needed for this module. python2 yum module is needed for this  module" 
    }
    

    but when i execute the command sudo yum install gcc directly on 192.168.31.101, executed properly.

    it seems like ansible can't use the right yum and python

  • Mort
    Mort over 3 years
    You probably mean pip install yum ?