-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwebsite.playbook.yml
82 lines (72 loc) · 2.41 KB
/
website.playbook.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
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
---
# This file is part of Learning Sandbox Online.
#
# Learning Sandbox Online is free software: you can redistribute it
# and/or modify it under the terms of the GNU General Public License as
# published by the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# Learning Sandbox Online is distributed in the hope that it will be
# useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
# Public License for more details.
#
# You should have received a copy of the GNU General Public License along with
# Learning Sandbox Online. If not, see <https://www.gnu.org/licenses/>.
##
# Playbook for creating the parent website.
#
# @copyright 2023 Geoffrey Bernardo van Wyk (https://geoffreyvanwyk.dev)
##
- name: Website
hosts: all
vars_files:
- defaults/main.yml
tasks:
- name: Install TLS certificates
ansible.builtin.include_tasks: tasks/install_tls_certificates.yml
- name: Deploy Apache virtualhost configuration for sandbox
become: true
loop:
- .conf
- -ssl.conf
ansible.builtin.template:
src: sandbox_domain{{ item }}.j2
dest: /etc/apache2/sites-available/{{ sandbox_domain }}{{ item }}
owner: root
group: root
mode: u=rw,g=r,o=r
- name: Enable Apache virtual host configuration for sandbox
become: true
loop:
- "{{ sandbox_domain }}.conf"
- "{{ sandbox_domain }}-ssl.conf"
ansible.builtin.command: a2ensite {{ item }}
changed_when: true
tags:
- molecule-idempotence-notest
- name: Deploy and enable Apache virtualhosts for sandbox aliases
loop: "{{ sandbox_domain_aliases }}"
loop_control:
loop_var: sandbox_domain_alias
ansible.builtin.include_tasks: tasks/deploy_domain_alias_virtualhosts.yml
- name: Enable SSL module for Apache
become: true
community.general.apache2_module:
name: ssl
state: present
- name: Restart Apache web service
become: true
ansible.builtin.sysvinit:
name: apache2
state: restarted
tags:
- molecule-idempotence-notest
- name: Deploy website
become: true
ansible.builtin.copy:
src: website/_site/
dest: /var/www/html
owner: root
group: root
mode: u=rwX,g=rX,o=rX