[root@localhost file]
eee myplay qqq tangjunpeng
.conf users
.yml www
[root@localhost file]
/etc
/ansible
/file
虚拟主机配置文件
[root@localhost file]
<VirtualHost
*:80>
ServerName www
.tang
.com
DocumentRoot
"/var/www/html/qqq"
<Directory
/var/www
/html
/qqq>
<RequireAll>
Require all granted
<
/RequireAll>
<
/Directory>
<
/VirtualHost>
Listen 81
<VirtualHost
*:81>
ServerName www
.jun
.com
DocumentRoot
"/var/www/html/www"
<Directory
/var/www
/html
/www>
<RequireAll>
Require all granted
<
/RequireAll>
<
/Directory>
<
/VirtualHost>
<VirtualHost
*:81>
ServerName www
.peng
.com
DocumentRoot
"/var/www/html/eee"
<Directory
/var/www
/html
/eee>
<RequireAll>
Require all granted
<
/RequireAll>
<
/Directory>
<
/VirtualHost>
[root@localhost file]vim users
.yml
---
- name: 所有受控机的网络仓库从主控机上复制
hosts: all
tasks:
- name:
copy CentOS
-Base
.repo
copy:
src: myplay
/files
/CentOS
-Base
.repo
dest:
/etc
/yum
.repos
.d
/
- name: 安装阿帕奇
hosts: all
tasks:
- name: yum install httpd
yum:
name: httpd
state: present
- name: 启动服务
hosts: all
tasks:
- name:
start httpd service
service:
name: httpd
state: started
enabled: yes
- name: 传模板
hosts: all
tasks:
- name:
copy tangjunpeng
.conf
copy:
src: tangjunpeng
.conf
dest:
/etc
/httpd
/conf
.d
/
- name:
copy www
copy:
src: www
dest:
/var/www
/html
/www
- name:
copy qqq
copy:
src: qqq
dest:
/var/www
/html
/qqq
- name:
copy eee
copy:
src: eee
dest:
/var/www
/html
/eee
- name: 重启
/加载
hosts: all
tasks:
- name:
service:
name: httpd
state: restarted