ansible使用密码远程登录
服务器:192.168.80.1node1192.168.80.2node2192.168.80.3node3修改/etc/hosts192.168.80.1 node1192.168.80.2 node2192.168.80.3 node3修改ansible hostsvim /etc/ansible/hosts[k8s]k8smaster ansible_ssh_user=root ansib
·
- 服务器:
- 192.168.80.1 node1
- 192.168.80.2 node2
- 192.168.80.3 node3
修改/etc/hosts
192.168.80.1 node1
192.168.80.2 node2
192.168.80.3 node3
修改ansible hosts
vim /etc/ansible/hosts
[k8s]
k8smaster ansible_ssh_user=root ansible_ssh_port=22 ansible_ssh_pass=james
k8snode1 ansible_ssh_user=root ansible_ssh_port=22 ansible_ssh_pass=james
k8snode2 ansible_ssh_user=root ansible_ssh_port=22 ansible_ssh_pass=james
修改/etc/ansible/ansible.cfg
sed -i 's/.*\(host_key_checking\)/\1/' /etc/ansible/ansible.cfg
# 去掉配置文件中的注释
#host_key_checking = False
host_key_checking = False
最后结果
# ansible all -m ping
node1 | SUCCESS => {
"changed": false,
"ping": "pong"
}
node2 | SUCCESS => {
"changed": false,
"ping": "pong"
}
node3 | SUCCESS => {
"changed": false,
"ping": "pong"
}
更多推荐
已为社区贡献23条内容
所有评论(0)