小工具知识网

当前位置: 首页 > 行业知识 > ansible免密登陆脚本

行业知识

ansible免密登陆脚本

2026-10-29 22:01:34 来源:互联网转载

ansiindex.php/tags-41973.html" >ble配置免密

()
group_vars/└── all.yml               #填写'k8s_cluster_info'变量信息inventory/                #填写主机信息├── hostsautossh/├── files│   └── ssh-key-gen.sh├── tasks│   └── main.yml└── templates    └── distribute_ssh_pubkey.sh.j2

1.ssh-key-gen.sh

#!/bin/bashexpect { item }} state=absent  with_items:    - distribute_ssh_pubkey.sh    - ssh-key-gen.sh% for item in k8s_cluster_info %}expect { item.ip }}expect {"*yes/no*" { send "yes\r"; exp_continue}"*password:" { send "{{ ansible_ssh_pass }}\r" }}expect eofEOF{% endfor %}

上一篇:DZ论坛邮件功能开启教程,轻松设置邮件通知,掌握最新资讯动态!

下一篇:去派出所申请备案怎么写材料