|
[iyunv@10_1_162_39 host_vars]# cat hosts
[web]
10.1.162.18:322
10.1.167.36:32200
[iyunv@10_1_162_39 host_vars]# ssh-copy-id -i ~/.ssh/id_rsa.pub "-p 322 root@10.1.162.18 "
root@10.1.162.18's password:
Now try logging into the machine, with "ssh '-p 322 root@10.1.162.18 '", and check in:
.ssh/authorized_keys
to make sure we haven't added extra keys that you weren't expecting.
[iyunv@10_1_162_39 host_vars]# ansible web -m shell -a ifconfig -i hosts
10.1.162.18 | SUCCESS | rc=0 >>
eth0 Link encap:Ethernet HWaddr 00:0C:29:21:BD:17
inet addr:192.168.238.129 Bcast:192.168.238.255 Mask:255.255.255.0
inet6 addr: fe80::20c:29ff:fe21:bd17/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:301306 errors:0 dropped:0 overruns:0 frame:0
TX packets:121768 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:364185541 (347.3 MiB) TX bytes:6774878 (6.4 MiB)
Interrupt:19 Base address:0x2000
lo Link encap:Local Loopback
inet addr:127.0.0.1 Mask:255.0.0.0
inet6 addr: ::1/128 Scope:Host
UP LOOPBACK RUNNING MTU:65536 Metric:1
RX packets:8 errors:0 dropped:0 overruns:0 frame:0
TX packets:8 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:480 (480.0 b) TX bytes:480 (480.0 b)
10.1.167.36 | UNREACHABLE! => {
"changed": false,
"msg": "Failed to connect to the host via ssh: Permission denied (publickey,gssapi-keyex,gssapi-with-mic,password).\r\n",
"unreachable": true
} |
|
|