-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathsetup_webserver.yml
More file actions
54 lines (47 loc) · 1.1 KB
/
setup_webserver.yml
File metadata and controls
54 lines (47 loc) · 1.1 KB
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
---
- name: Setup Web Server and Firewall
hosts: all
user: opc
become: true
tasks:
- name: Install Apache Web Server
yum:
name: httpd
state: latest
notify: Restart Apache
- name: Start and Enable Apache Service
service:
name: httpd
state: started
enabled: yes
- name: Copy Default Web Page
copy:
content: "<h1>🐽</h1>"
dest: /var/www/html/index.html
notify: Restart Apache
- name: Ensure firewalld is Installed
yum:
name: firewalld
state: latest
notify: Restart Firewalld
- name: Start and Enable Firewalld Service
service:
name: firewalld
state: started
enabled: yes
- name: Allow HTTP Traffic (Port 80)
firewalld:
service: http
permanent: yes
state: enabled
immediate: yes
notify: Restart Firewalld
handlers:
- name: Restart Apache
service:
name: httpd
state: restarted
- name: Restart Firewalld
service:
name: firewalld
state: restarted