学习ansibleplaybook的基本操作(设计group,host,group_vars,host_vars,filter,安装等)
准备5个虚拟机(此处用vagrant)
vagrant init envimation/ubuntu-xenial-docker
修改Vagrantfile
配置网络模式和Ip(此处是10-12)
config.vm.network "public_network", ip:"192.168.1.10"
10中
sudo apt-get update
sudo apt-get install -y python python-dev python-pip python-setuptools git
pip install ansible
git clone https://github.com/wwq1988/ansibleplaybookexample.git
ssh-keygen
把~/.ssh/id_rsa.pub内容拷贝到11和12的~/.ssh/authorized_keys中
11,12中
sudo apt-get update
sudo apt-get install python
10中
cd ansibleplaybookexample
ansible-playbook -i inventories/production/ site.yml