-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathcertbot.yml
75 lines (64 loc) · 2.1 KB
/
certbot.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
---
- name: Setup, configure, and install Certbot
hosts: webserver
become: true
tasks:
- name: Turn off Apache listening on IP6
template:
src: ports.conf.j2
dest: "{{ apache_conf_path }}/ports.conf"
owner: root
group: root
mode: "0644"
when: "'gamma' in inventory_hostname"
- name: Install certbot snap
snap:
name: certbot
classic: true
when: env == "production"
- name: Symlink certbot executable
file:
src: /snap/bin/certbot
dest: /usr/bin/certbot
state: link
when: env == "production"
- name: Check if certificate exists
stat:
path: /etc/letsencrypt/live/{{ drupal_domain }}/fullchain.pem
register: certbot_certificate_exists
- name: Stop Apache to install certificates
service:
name: apache2
state: stopped
when: env == "production" and not certbot_certificate_exists.stat.exists
- name: Certbot setup
command: certbot --apache certonly --agree-tos --email "{{ certbot_admin_email }}" --noninteractive -d "{{ drupal_domain }}"i
args:
creates: /etc/letsencrypt/live/{{ drupal_domain }}/fullchain.pem
when: env == "production"
- name: Add PRODUCTION https config
template:
src: gamma.islandora-le-ssl.conf.j2
dest: "{{ apache_conf_path }}/sites-available/digital.library.yorku.ca-le-ssl.conf"
owner: root
group: root
mode: "0644"
when: env == "production"
- name: Add PRODUCTION http config
template:
src: gamma.islandora.conf.j2
dest: "{{ apache_conf_path }}/sites-available/digital.library.yorku.ca.conf"
owner: root
group: root
mode: "0644"
when: env == "production"
- name: Enable https site
command: a2ensite digital.library.yorku.ca-le-ssl.conf
args:
creates: /etc/apache2/sites-enabled/digital.library.yorku.ca-le-ssl.conf
when: env == "production"
- name: Start Apache
service:
name: apache2
state: started
when: env == "production"