LoginSignup
1
0

More than 3 years have passed since last update.

【小ネタ】Ansibleでpingを飛ばせない場合の対処方法

Posted at

はじめに

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"
}
% 

参考

[小ネタ] Pythonのバージョンを指定してAnsible実行時に表示される警告を消す

1
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
0