Ansible Shared connectionエラーの解決方法

環境
Ansible
CentOS 8

エラー現象
FAILED!=>{
“changed":false,
“modulle_stderr";"Shared Connection to xxx closed \r\n"
“module_stdout":"/bin/sh:1:/usr/bin/python: not found\r\n"
“msg": “MODULE FAILURE"

原因
リモートサーバのPythonのバージョンはpython3.9です。

解決方法1

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
ansible all -m ping -e ansible_python_interpreter=/usr/bin/python3 -u xxx
ansible all -m ping -e ansible_python_interpreter=/usr/bin/python3 -u xxx
ansible all -m ping -e ansible_python_interpreter=/usr/bin/python3 -u xxx

解決方法2
# cd /etc/ansible
# sudo vi hosts
以下の内容を追記する

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
xxxx ansible_python_interpreter=/usr/bin/python3
xxxx ansible_python_interpreter=/usr/bin/python3
xxxx ansible_python_interpreter=/usr/bin/python3

 

Ansible

Posted by arkgame