ssh 密钥
# 生成秘钥
ssh-keygen
# 将秘钥拷贝到被管理服务器上
ssh-copy-id -i ~/.ssh/id_rsa.pub -p 22 root@192.168.182.130
账号密码
1、命令行配置
# -k:交互式
ansible -uroot -k 192.168.182.130 -m ping
2、配置文件中配置
# 默认主机配置文件:/etc/ansible/hosts
192.168.182.130 ansible_ssh_user=root ansible_ssh_pass=123456
[web]
192.168.182.130 ansible_ssh_user=root ansible_ssh_pass=123456
常用的配置参数如下:
![图片[1]-Ansible连接被控端方式-编程社](https://cos.bianchengshe.com/wp-content/uploads/2023/01/image-116.png?imageMogr2/format/webp/interlace/1/quality/100)
© 版权声明
文章版权归作者所有,未经允许请勿转载。
THE END
暂无评论内容