ansible-初始playbook安装nginx
1. ansible-初始playbook安装nginx 1) 创建一个ansible存放路径 1 [ root@test - 1 scripts ]# mkdir - p / ansible / nginx /{ conf , bin } 2) 验证存放路径 1 [ root@test - 1 bin ]# tree / ansible / 2 / ansible / 3 └―― nginx 4 ├―― bin 5 │ └―― nginx . yaml 6 └―― conf 7 └―― site . conf 8 9 3 directories , 2 files 2. 编写playbook的nginx安装yaml文件 1) 编写nginx.yaml配置文件 1 [ root@test - 1 bin ]# vim / ansible / nginx / bin / nginx . yaml 2 [ root@test - 1 bin ]# cat / ansible / nginx / bin / nginx . yaml 3 - hosts : web1 4 remote_user : root 5 vars : 6 hello : Ansible 7 8 tasks : 9 - name : Add repo 10 yum_repository : 11 name :