aboutsummaryrefslogtreecommitdiff
path: root/gerboweb/deploy/setup_dyndns.yml
blob: d9735c715c25c620d3361a9b91584acd132a19b0 (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
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
---
- name: Set local facts
  set_fact:
      dyndns_sqlite_dbfile: /var/lib/dyndns/db.sqlite3

- name: Copy nsd config
  copy:
    src: nsd.conf
    dest: /etc/nsd/nsd.conf
    owner: root
    group: root
    mode: 0644

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

- name: Create dyndns worker user and group
  user:
      name: uwsgi-dyndns
      create_home: no
      group: uwsgi
      password: '!'
      shell: /sbin/nologin
      system: yes

- name: Allow dyndns app to kick nsd
  lineinfile:
    path: /etc/sudoers
    line: 'uwsgi-dyndns ALL=(nsd) NOPASSWD: /usr/sbin/nsd-control reload dyn.jaseg.de'

- name: Create webapp dir
  file:
      path: /var/lib/dyndns
      state: directory
      owner: uwsgi-dyndns
      group: nsd
      mode: 0750

- name: Copy webapp sources
  copy:
      src: dyndns.py
      dest: /var/lib/dyndns/
      owner: uwsgi-dyndns
      group: uwsgi
      mode: 0440

- name: Template webapp config
  template:
    src: dyndns_config.py.j2
    dest: /var/lib/dyndns/config.py
    owner: uwsgi-dyndns
    group: root
    mode: 0660

- name: Copy uwsgi config
  copy:
      src: uwsgi-dyndns.ini
      dest: /etc/uwsgi.d/dyndns.ini
      owner: uwsgi-dyndns
      group: uwsgi
      mode: 0440

- name: Enable uwsgi systemd socket
  systemd:
      daemon-reload: yes
      name: uwsgi-app@dyndns.socket
      enabled: yes

- name: Create sqlite db file
  file:
    path: "{{dyndns_sqlite_dbfile}}"
    owner: uwsgi-dyndns
    group: uwsgi
    mode: 0660
    state: touch