-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathapache.yaml
35 lines (33 loc) · 1.03 KB
/
apache.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
---
- hosts: linux
become: yes
tasks:
- name: install apache on ubuntu
apt: name=apache2 update_cache=yes state=latest
when: ansible_os_family == "Debian"
- name: start apache on ubuntu
service: name=apache2 enabled=yes state=started
when: ansible_os_family == "Debian"
- name: install apache on centos
yum: name=httpd update_cache=yes state=latest
when: ansible_os_family == "RedHat"
- name: start apache on centos
service: name=httpd enabled=yes state=started
when: ansible_os_family == "RedHat"
- name: create index.html
template:
src: /root/index.html.j2
dest: /var/www/html/index.html
notify: start httpd
when: ansible_os_family == "RedHat"
- name: create index.html
template:
src: /root/index.html.j2
dest: /var/www/html/index.html
notify: start apache2
when: ansible_os_family == "Debian"
handlers:
- name: start apache2
service: name=apache2 enabled=yes state=started
- name: start httpd
service: name=httpd enabled=yes state=started