2017-08-27 16 views
0

私は(迷惑メールを使って)インストールし、最初のリモートシェルスクリプトをAnsibleで実行しようとしています。私はできるだけホストにpingすることができません。しかし、私がサーバーに直接pingをすると、私はできるようになります。ホストファイルに記載されているNISアカウントでサーバにリモートログインすることもできます。まだリモートサーバーをpingできませんが、接続することはできません

誰かが私の設定で逃したものを見つけるのを助けることができますか?

[email protected]:~$ cat /etc/ansible/hosts 
# web 
web1 ansible_host=tomcat-serv-adm1 ansible_connection=ssh ansible_user=username ansible_ssh_pass=password 

[email protected]:~$ ansible web1 -m ping 
web1 | UNREACHABLE! => { 
    "changed": false, 
    "msg": "Authentication or permission failure. In some cases, you may have been able to authenticate and did not have permissions on the remote directory. Consider changing the remote temp path in ansible.cfg to a path rooted in \"/tmp\". Failed command was: (umask 77 && mkdir -p \"` echo ~/.ansible/tmp/ansible-tmp-1503856866.42-230229170728730 `\" && echo ansible-tmp-1503856866.42-230229170728730=\"` echo ~/.ansible/tmp/ansible-tmp-1503856866.42-230229170728730 `\"), exited with result 2", 
    "unreachable": true 
} 

[email protected]:~$ ping tomcat-serv-adm1 
PING tomcat-serv-adm1-e1000g1.waypoint.com (192.168.66.116) 56(84) bytes of data. 
64 bytes from tomcat-serv-adm1-e1000g1.waypoint.com (192.168.66.116): icmp_req=1 ttl=250 time=22.5 ms 
64 bytes from tomcat-serv-adm1-e1000g1.waypoint.com (192.168.66.116): icmp_req=2 ttl=250 time=19.5 ms 
64 bytes from tomcat-serv-adm1-e1000g1.waypoint.com (192.168.66.116): icmp_req=3 ttl=250 time=17.5 ms 
^C 
--- tomcat-serv-adm1-e1000g1.waypoint.com ping statistics --- 
3 packets transmitted, 3 received, 0% packet loss, time 2003ms 
rtt min/avg/max/mdev = 17.554/19.891/22.562/2.064 ms 
 
[email protected]:~$ ansible -vvv web1 -m ping 
Using /etc/ansible/ansible.cfg as config file 
META: ran handlers 
Using module file /usr/local/lib/python2.7/dist-packages/ansible/modules/system/ping.py 
ESTABLISH SSH CONNECTION FOR USER: None 
SSH: EXEC ssh -C -o ControlMaster=auto -o ControlPersist=60s -o Port=22 -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o ConnectTimeout=10 -o ControlPath=/home/vagrant/.ansible/cp/d37e71f71a tomcat-serv-adm1 '/bin/sh -c '"'"'echo ~ && sleep 0'"'"'' 
(255, '', 'Permission denied (gssapi-keyex,gssapi-with-mic,publickey,password,keyboard-interactive).\r\n') 
web1 | UNREACHABLE! => { 
    "changed": false, 
    "msg": "Failed to connect to the host via ssh: Permission denied (gssapi-keyex,gssapi-with-mic,publickey,password,keyboard-interactive).\r\n", 
    "unreachable": true 
} 
[email protected]:~$ 
+0

あなたはtomcat-にsshをすることができserv-adm1? Anipalの "ping"モジュールは 'ping'コマンドを使用しません。 –

+0

はい、「ssh username @ tomcat-serv-adm1」というコマンドでtomcat-serv-adm1にsshできます。パスワードを入力した後、私はサーバーに入ることができます。 – user3183426

答えて

0

エラーメッセージを見てみましょう。

は "を/ tmp \" \に 根ざしたパスに

をansible.cfgにおける遠隔一時パスの変更を検討Anibilitiesのpingはpingコマンドを使用しません。代わりに、sshを使用してホストに接続しようとします。 ssh接続をチェックします。あなたのansible.cfgファイルで構成されたように、その時点で、それはまた、ディレクトリremote_tmpでいくつかの一時ファイルを作成します(デフォルト:/etc/ansible/ansible.cfg)

この問題を解決するには、次の

  1. 編集しansible.cfgremote_tmp
  2. を探し、リモートホスト上のディレクトリは、あなたがそれを書き込み可能にすることができない場合は、誰でも書き込み可能なディレクトリ(例:/tmp)に値を変更するのsshユーザー
  3. によって書き込み可能であることを確認してください

最初のチェック:

$ grep remote_tmp /etc/ansible/ansible.cfg 
remote_tmp  = $HOME/.ansible/tmp 

あなたは、remote_tmp書き込み可能にするansible.cfgの値を変更できない場合:

remote_tmp  = /tmp/.ansible/tmp 

または

remote_tmp  = /tmp/.ansible-${USER}/tmp 
+0

私は/etc/ansible/ansible.cfgを持っていません 私はそれを新しいものとして作成することができますが、これに入れる必要のあるエントリは何ですか? – user3183426

+0

これがデフォルトです。 'anabilities -vvv web1 -m ping'の出力を投稿できますか? – helloV

+0

ここで文字の制限があるため、元の投稿を編集して詳細を尋ねました – user3183426

関連する問題