1.安装 ansible Yum -y install ansible

2.修改ansible hosts部署:


3.配置ssh 公钥认证:


4.添加ssh-copy-id 端口参数选项



5.ansible 使用ping 模块查看是否成功


6.编写一键部署LAMP脚本 Vim lamp.sh


7.当前目录需要一个修改过的httpd 配置文件 和编写一个php测试页面 vim httpd.conf


Vim index.php


8.使用ansible的 cppy 模块 分发lamp脚本和httpd配置文件和PHP测试页面:




8.ansible一键启动脚本:


9.查看是否成功整合: 192.168.153.111


192.168.153.110