aboutsummaryrefslogtreecommitdiff
path: root/setup_webserver.yml
blob: 7dc65c5c060877c81033412a7a4b71183fb85972 (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
48
49
50
51
52
- name: Copy first stage nginx config
  copy:
      src: nginx_nossl.conf
      dest: /etc/nginx/nginx.conf

- name: Add nginx user to uwsgi group for access to uwsgi socket
  user:
      name: nginx
      groups: uwsgi
      append: yes

- name: Copy uwsgi systemd socket config
  copy:
      src: uwsgi-app@.socket
      dest: /etc/systemd/system/

- name: Copy uwsgi systemd service config
  copy:
      src: uwsgi-app@.service
      dest: /etc/systemd/system/

- name: Set SELinux to permissive mode # FIXME this is to let nginx talk to uwsgi
  selinux:
    state: permissive
    policy: targeted

- name: Enable and launch nginx systemd service
  systemd:
      name: nginx.service
      enabled: yes
      state: restarted

- name: Create letsencrypt certificate
  command: certbot --nginx certonly -d gerbolyze.jaseg.net -n --agree-tos --email gerboweb@jaseg.net
  args:
      creates: /etc/letsencrypt/live/gerbolyze.jaseg.net/fullchain.pem

- name: Copy final nginx config
  copy:
      src: nginx.conf
      dest: /etc/nginx/nginx.conf

- name: Restart nginx to load new cert
  systemd:
      name: nginx.service
      state: restarted

- name: Enable certbot renewal timer
  systemd:
      name: certbot-renew.timer
      enabled: yes