blob: 60dda4e27607b5d87adebf16a1b0e7a5f6faa310 (
plain)
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
|
---
- name: Setup website
hosts: raspberry
gather_facts: false
tasks:
- name: Install packages
become: true
tags:
- slow
apt:
pkg:
- nginx
- certbot
- python3-certbot-nginx
- name: Copy nginx configuration
become: true
copy:
src: ./files/nginx/website
dest: /etc/nginx/sites-available
- name: Enable website
become: true
command: "ln -sf /etc/nginx/sites-available/website /etc/nginx/sites-enabled"
- name: Install SSL certificate
become: true
shell: "certbot --nginx --non-interactive --agree-tos -m eugene@eug-vs.xyz -d eug-vs.xyz -d www.eug-vs.xyz"
- name: Setup auto-renewing certificates
become: true
shell: |
echo "0 12 * * * /usr/bin/certbot renew --quiet" >> /tmp/crontab
crontab /tmp/crontab
- name: Allow user to write to website location
become: true
shell: |
mkdir -p /var/www/website
chown -R eug-vs:eug-vs /var/www/website
- name: Restart and enable nginx
become: true
systemd:
name: nginx
enabled: yes
state: restarted
|