【小ネタ】Ansibleでpingを飛ばせない場合の対処方法
はじめに
Mac上にbrewでAnsibleをインストールしました。(Ansible勉強中)
そこで、pingの実行に少々苦戦をしましたので、対処方法を載せたいと思います。
事象
1つの対象にpingを実行すると、下記のようなエラーが表示される。
実行結果
% ansible -i 192.168.56.51 all -m ping --connection=local
[WARNING]: Unable to parse /Users/satton/etc/ansible/192.168.56.51 as an inventory source
[WARNING]: No inventory was parsed, only implicit localhost is available
[WARNING]: provided hosts list is empty, only localhost is available. Note that the implicit
localhost does not match 'all'
%
対処方法
IPアドレスの後に,
を付ける。
実行結果
% ansible -i 192.168.56.51, all -m ping --connection=local
[WARNING]: Platform darwin on host 192.168.56.51 is using the discovered Python interpreter at
/usr/bin/python, but future installation of another Python interpreter could change this. See
https://docs.ansible.com/ansible/2.9/reference_appendices/interpreter_discovery.html for more
information.
192.168.56.51 | SUCCESS => {
"ansible_facts": {
"discovered_interpreter_python": "/usr/bin/python"
},
"changed": false,
"ping": "pong"
}
%
※複数ホストにpingを実行することも可能
実行結果
% ansible -i 192.168.56.51,8.8.8.8,8.8.4.4 all -m ping --connection=local
[WARNING]: Platform darwin on host 8.8.4.4 is using the discovered Python interpreter at
/usr/bin/python, but future installation of another Python interpreter could change this. See
https://docs.ansible.com/ansible/2.9/reference_appendices/interpreter_discovery.html for more
information.
8.8.4.4 | SUCCESS => {
"ansible_facts": {
"discovered_interpreter_python": "/usr/bin/python"
},
"changed": false,
"ping": "pong"
}
[WARNING]: Platform darwin on host 192.168.56.51 is using the discovered Python interpreter at
/usr/bin/python, but future installation of another Python interpreter could change this. See
https://docs.ansible.com/ansible/2.9/reference_appendices/interpreter_discovery.html for more
information.
192.168.56.51 | SUCCESS => {
"ansible_facts": {
"discovered_interpreter_python": "/usr/bin/python"
},
"changed": false,
"ping": "pong"
}
[WARNING]: Platform darwin on host 8.8.8.8 is using the discovered Python interpreter at
/usr/bin/python, but future installation of another Python interpreter could change this. See
https://docs.ansible.com/ansible/2.9/reference_appendices/interpreter_discovery.html for more
information.
8.8.8.8 | SUCCESS => {
"ansible_facts": {
"discovered_interpreter_python": "/usr/bin/python"
},
"changed": false,
"ping": "pong"
}
%
参考
Author And Source
この問題について(【小ネタ】Ansibleでpingを飛ばせない場合の対処方法), 我々は、より多くの情報をここで見つけました https://qiita.com/satton6987/items/5b66a159a1fbcaffb596著者帰属:元の著者の情報は、元のURLに含まれています。著作権は原作者に属する。
Content is automatically searched and collected through network algorithms . If there is a violation . Please contact us . We will adjust (correct author information ,or delete content ) as soon as possible .