赞
踩
目录
环境使用3台机器
Ansible主机:ip1
服务端主机01:ip2
服务端主机02:ip3
- vim /etc/hosts
- ip1 ansible
- ip2 host1
- ip3 host2
- wget -O /etc/yum.repos.d/epel.repo http://mirrors.aliyun.com/repo/epel-7.repo
-
- wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo
-
- yum install -y epel-release
-
- yum install -y ansible
-
- rpm -qc ansible(查看配置文件,是否部署完成)
- /etc/ansible/ansible.cfg
- /etc/ansible/hosts
- ssh-keygen
-
- ssh-copy-id ip
- vim /etc/ansible/hosts
- host1
- host2
ansible localhost -m ping
ansible host1 -m ping -o
- vim /etc/ansible/hosts
- [webserver]
- host1
- host2
ansible webserver -m ping –o
- vim /etc/ansible/hosts
- [webserver]
- host[1:2] ansible_ssh_user='root' ansible_ssh_pass='密码'
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。