然而,在RHEL 6操作系统中,由于OpenSSH版本过于陈旧,可能不支持ControlPersist。在这些操作系统,Ansible将使用名为paramikoPython实现的OpenSSH调用。如果需要实现类似Kerberized SSH等高级功能,考虑使用Fedora, OS X或Ubuntu等使用了新版本OpenSSH的操作系统。
192.168.1.2|UNREACHABLE! =>{"changed":false,"msg":"ERROR! SSH encountered an unknown error during the connection. We recommend you re-run the command using -vvvv, which will enable SSH debugging output to help diagnose the issue","unreachable":true}192.168.1.3|SUCCESS =>{"changed":false,"ping":"pong"}192.168.1.1|SUCCESS =>{"changed":false,"ping":"pong"}
# as bruce$ansibleall-mping-ubruce# as bruce, sudoing to root$ansibleall-mping-ubruce--sudo# as bruce, sudoing to batman$ansibleall-mping-ubruce--sudo--sudo-userbatman# With latest version of ansible `sudo` is deprecated so use become# as bruce, sudoing to root$ansibleall-mping-ubruce-b# as bruce, sudoing to batman$ansibleall-mping-ubruce-b--become-userbatman
下面我们来测试一个简单的命令,向所有主机发送uname -a指令
ansibleall-a"uname -a"
192.168.1.2|UNREACHABLE! =>{"changed":false,"msg":"ERROR! SSH encountered an unknown error during the connection. We recommend you re-run the command using -vvvv, which will enable SSH debugging output to help diagnose the issue","unreachable":true}192.168.1.3|SUCCESS| rc=0 >>Linuxhost3.exmaple.com2.6.32-504.16.2.el6.x86_64#1 SMP Wed Apr 22 06:48:29 UTC 2015 x86_64 x86_64 x86_64 GNU/Linux192.168.1.2|SUCCESS| rc=0 >>Linuxhost2.exmaple.com2.6.32-220.el6.x86_64#1 SMP Wed Nov 9 08:03:13 EST 2011 x86_64 x86_64 x86_64 GNU/Linux