aboutsummaryrefslogtreecommitdiff
path: root/setup_vcd_render.yml
blob: db43b1b8f27f5f569604b05ffcf8d86e6ca567e0 (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
---
- name: Set local facts
  set_fact:
    vcdrender_cache: /var/cache/vcd-render

- name: Install host requisites
  dnf:
    name: python3-lxml
    state: latest

- name: Copy webapp sources
  synchronize:
      src: checkouts/vcd-render/
      dest: /var/lib/vcd-render
      delete: true
      group: no
      owner: no

- name: Setup webapp python requirements
  pip:
    name:
      - beautifulsoup4
      - flask
      - vcdvcd
    virtualenv: /var/lib/vcd-render/venv
    virtualenv_site_packages: true

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

- name: Template webapp config
  template:
    src: vcdrender.cfg.j2
    dest: /var/lib/vcd-render/vcdrender_prod.cfg
    owner: uwsgi-vcdrender
    group: root
    mode: 0660

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

- name: Enable uwsgi systemd socket
  systemd:
      daemon-reload: yes
      name: uwsgi-app@vcdrender.socket
      enabled: yes
      state: started

# FIXME the socket doesn't seem to work properly
- name: Enable uwsgi systemd service
  systemd:
      daemon-reload: yes
      name: uwsgi-app@vcdrender.service
      enabled: yes

- name: Copy vcdrender cache dir tmpfiles.d config
  template:
      src: tmpfiles-vcdrender.conf.j2
      dest: /etc/tmpfiles.d/vcdrender.conf
      owner: root
      group: root
      mode: 0644
  register: vcdrender_tmpfiles_config

- name: Kick systemd tmpfiles service to create cache dir
  command: systemd-tmpfiles --create
  when: vcdrender_tmpfiles_config is changed