ansible利用proxyCommand实现IPV6的ssh跳转

ansible的Bastion_ssh_config文件内容如下:
ControlPersist 15m
StrictHostKeyChecking no
UserKnownHostsFile /dev/null

host [2000:172:20:21::*]
    ProxyCommand ssh -i  ~/.ssh/id_rsa root@2000:194:99:21::13 -W %h:%p -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null
host [FD00::335:0:0:8100:*]
    ProxyCommand ssh -i  ~/.ssh/id_rsa root@2000:194:99:51::13 -W %h:%p -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null

注意事项:

目标主机的IPV6地址需要加中括号,但是跳转机的IPV6地址不需要加。

ansible的inventory.ini文件内容如下:
[jumphost]    
jumphost1  ansible_ssh_host=2000:194:99:21::13 ansible_ssh_user=root ansible_ssh_pass=root123
jumphost2  ansible_ssh_host=2000:194:99:51::13 ansible_ssh_user=root ansible_ssh_pass=root123

[target_host]
target_host11  ansible_ssh_host=[2000:172:20:21::252] ansible_ssh_user=root ansible_ssh_pass=Root_123
target_host12  ansible_ssh_host=[2000:172:20:21::251] ansible_ssh_user=root ansible_ssh_pass=Root_123
target_host21   ansible_ssh_host=[FD00::335:0:0:8100:3302]  ansible_ssh_user=root ansible_ssh_pass=Root_123
target_host22   ansible_ssh_host=[FD00::335:0:0:8100:3303] ansible_ssh_user=root ansible_ssh_pass=Root_123
注意事项:

目标主机的IPV6地址需要加中括号,但是跳转机的IPV6地址不需要加。

一句话,目标主机的IPV6地址加中括号,跳转机的IPV6地址不需要加。

最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容