Monday 22 April 2019

How to use specific Python version as interpreter in Ansible?

Ansible needs 2.X version as interpreter.
we can declare required python version in inventory file
[ansible@ansibleserver ~]$ cat inventory_python
10.25.12.10 ansible_python_interpreter=/usr/bin/python2.7

[ansible@ansibleserver ~]$ ansible all -i inventory_python -m ping -u ansible
10.25.12.10 | SUCCESS => {
    "changed": false,
    "ping": "pong"
}

Note:- if version not existed throws error.

No comments:

Post a Comment