サーバ:192.168.2.211
対象:192.168.2.220
インストール直後、まずは、pingモジュールを試してみた。
[root@localhost ~]# ansible 192.168.2.220 -m ping paramiko: The authenticity of host '192.168.2.220' can't be established. The ssh-rsa key fingerprint is ********************************. Are you sure you want to continue connecting (yes/no)? yes 192.168.2.220 | FAILED => FAILED: No authentication methods available [root@localhost ~]#
SSHの接続設定を行っていないからか
「No authentication methods available」と。
"--ask-pass"オプションを指定します。
[root@localhost ~]# ansible 192.168.2.220 -m ping -u root --ask-pass SSH password: paramiko: The authenticity of host '192.168.2.220' can't be established. The ssh-rsa key fingerprint is ********************************. Are you sure you want to continue connecting (yes/no)? yes 192.168.2.220 | FAILED => FAILED: Authentication failed. [root@localhost ~]#
あ、パスワードを間違えた。
もう一度
[root@localhost ~]# ansible 192.168.2.220 -m ping -u root --ask-pass SSH password: paramiko: The authenticity of host '192.168.2.220' can't be established. The ssh-rsa key fingerprint is ********************************. Are you sure you want to continue connecting (yes/no)? yes Traceback (most recent call last): File "/usr/lib/python2.6/site-packages/ansible/runner/connection_plugins/paramiko_ssh.py", line 393, in close key_stat = os.stat(self.keyfile) OSError: [Errno 2] No such file or directory: '/root/.ssh/known_hosts' 192.168.2.220 | success >> { "changed": false, "ping": "pong" } [root@localhost ~]#
今度は、成功しました。
あ、でも、ファイルがないって怒られてます。。。
また、次回見てみます。