-
Notifications
You must be signed in to change notification settings - Fork 0
/
httpd.yml
50 lines (45 loc) · 1.04 KB
/
httpd.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
---
- name: install web-server Apache
hosts: node
become: true
vars:
project_root: /var/www/html
tasks:
- name: install httpd
ansible.builtin.yum:
name: httpd
state: present
notify: reload httpd
when:
- ansible_distribution == "CentOS"
- name: copy index.html
ansible.builtin.copy:
src: index.html.j2
dest: "{{ project_root }}/index.html"
owner: apache
group: apache
mode: 0644
notify: reload httpd
- name: Enable service to start
ansible.builtin.service:
name: httpd
enabled: yes
notify: reload httpd
- name : Configure firewall to allow http/https
firewalld:
service: "{{ item }}"
permanent: yes
state: enabled
notify: reload firewalld
loop:
- http
- https
handlers:
- name: reload httpd
service:
name: httpd
state: restarted
- name: reload firewalld
service:
name: firewalld
state: restarted