var/local/ansible
vi .ssh/config
Host sakura1 HostName 182.xx.xx.xx Host sakura2 HostName 49.xxx.xxx.xxx
公開鍵を作成する
# ssh-keygen -t rsa
Generating public/private rsa key pair.
Enter file in which to save the key (/root/.ssh/id_rsa): /var/local/ansible/.ssh/id_rsa
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in /var/local/ansible/.ssh/id_rsa.
Your public key has been saved in /var/local/ansible/.ssh/id_rsa.pub.
The key fingerprint is:
c8:43:16:c5:69:5e:ad:d9:bb:0c:0e:22:7e:06:9a:46 root@hoge.vs.sakura.ne.jp
The key’s randomart image is:
+–[ RSA 2048]—-+
|      .o.. .     |
|       .+ . .    |
|      oo . +     |
|     + .. o .    |
|      + S    .   |
|  E o … . .    |
| . + o . o o .   |
|  + . o   . o    |
| .   o           |
+—————–+
# ssh-copy-id sakura1
あれ? なんかうまくいかない。
# ansible all -i hosts -m ping
The authenticity of host ‘hoge’ can’t be established.
RSA key fingerprint is 0c:3.
Are you sure you want to continue connecting (yes/no)? The authenticity of host ‘1hoge)’ can’t be established.
RSA key fingerprint is 1f:3c:fa.
Are you sure you want to continue connecting (yes/no)? yes
hoge | UNREACHABLE! => {
    “changed”: false,
    “msg”: “Failed to connect to the host via ssh: Warning: Permanently added ‘hoge’ (RSA) to the list of known hosts.\r\nPermission denied (publickey,password).\r\n”,
    “unreachable”: true
}
Please type ‘yes’ or ‘no’: yes
hoge | UNREACHABLE! => {
    “changed”: false,
    “msg”: “Failed to connect to the host via ssh: Warning: Permanently added ‘1hoge’ (RSA) to the list of known hosts.\r\nPermission denied (publickey,password).\r\n”,
    “unreachable”: true
}
やはりRSA接続が上手くいっていない
インベントリファイルにパスワードを書く方法を模索か
 
					 
