安装ansible和设置ansible

730阅读 0评论2021-07-06 huyanshu
分类:系统运维

ansible 一个主服务器,其它都是客户端
1、安装  yum install ansible -y  所有服务器
2、在主服务器上生成一个 sshkey
     ssh-keygen -t rsa
3、ssh-copy-id -i /root/.ssh/id_rsa.pub 所有客户端ip.    有其它端口的在 ssh-copy-id 后面带个 -p 端口
4、编缉 /etc/ansible/hosts文件
5、设置dns,要使其计算机名解析到ip.
6、可以做个测试 ansible ********** -m command -a 'w' 
备注:如果远程主机登陆有端口,不是默认的,需要在/etc/ansible/hosts文件里 ip 后面增加
ansible_ssh_user=root ansible_ssh_port=1212
ansible ip -m command -a '命令'




上一篇:docker 部署elk
下一篇:当 docker 和jenkins的结合出现这么个问题的时候