-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathansible.yml
51 lines (45 loc) · 1.17 KB
/
ansible.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
- name: Configure Apache2 virtual hosts
hosts: your_server
become: true
vars:
apache_port: 80
tasks:
- name: Install Apache2
apt:
name: apache2
state: present
- name: Enable Apache2 Rewrite module
command: a2enmod rewrite
- name: Create directories for virtual hosts
file:
path: "/var/www/{{ item }}"
state: directory
mode: '0755'
with_items:
- www.hei.school
- api.hei.school
- front.hei.school
- back.hei.school
- name: Configure virtual hosts
template:
src: virtualhost.conf.j2
dest: "/etc/apache2/sites-available/{{ item }}"
with_items:
- www.hei.school.conf
- api.hei.school.conf
- front.hei.school.conf
- back.hei.school.conf
notify: Restart Apache2
- name: Enable virtual hosts
command: a2ensite "{{ item }}"
with_items:
- www.hei.school.conf
- api.hei.school.conf
- front.hei.school.conf
- back.hei.school.conf
notify: Restart Apache2
handlers:
- name: Restart Apache2
service:
name: apache2
state: restarted