# in 1.9x (ansible.cfg)sudo_flags=-H
# in 2.xsudo_flags=-H-S-n
# 配置是使用的 python 解析器# in the scope of a task-hosts:test_server
tasks:
-name:installpip
apt:
name:python-pip
vars:
ansible_python_interpreter:/usr/bin/python2
# or in the scope of a play-hosts:test_server
vars:
ansible_python_interpreter:/usr/bin/python
tasks:
-name:installpip
apt:
name:python-pip
# or global-set_fact:
ansible_python_interpreter:/usr/bin/python3
when:-ansible_distribution=='Kylin Linux Advanced Server'