-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathapache-setup.yml
55 lines (48 loc) · 1.26 KB
/
apache-setup.yml
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
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
---
- hosts: all
name: Install the web server and start it
become: yes
vars:
httpd_packages:
- httpd
- mod_wsgi
apache_test_message: This is a test message
apache_max_keep_alive_requests: 115
tasks:
- name: Install the apache web server
yum:
name: "{{ httpd_packages }}"
state: present
notify: restart apache service
- name: Generate apache's configuration file from jinja2 template
template:
src: templates/httpd.conf.j2
dest: /etc/httpd/conf/httpd.conf
notify: restart apache service
- name: Generate a basic homepage from jinja2 template
template:
src: templates/index.html.j2
dest: /var/www/html/index.html
force: yes
- name: Open the firewalld http port
firewalld:
port: 80/tcp
permanent: true
state: enabled
notify: restart firewalld service
- name: Start the apache web server
service:
name: httpd
state: started
enabled: yes
handlers:
- name: restart firewalld service
service:
name: firewalld
state: restarted
enabled: yes
- name: restart apache service
service:
name: httpd
state: restarted
enabled: yes