ansible yum module can not be used

hi
I faced a problem when use ansible module yum.
my hosts file /etc/ansible/hosts add
eg:10.255.22.102 ansible_python_interpreter=/usr/local/python2.7/bin/python
this new interpreter is python2.7
when i came back to use yum

  • name: yum install ntp
    action: yum name=ntp state=present
    sudo: yes
    tags: ntpd
    when: ansible_distribution != ‘Suse’

problem appear

task failed to parsed
no module named yum

how to solve ,please help

Please paste text rather than include screenshots on this mailing list. It’s far easier for everyone reading it.

Thanks!

It sounds like you might have set ansible_python_interpreter to point at a non-system python, or perhaps are running locally against a virtualenv, where yum isn’t available. I’d suggest not doing these things, as you need to access the system python installed yum to proceed.