main.yml 2.57 KB
Newer Older
1
---
2
3
4
5
6
7
8
9
10
- name: run maintenance mode
  include_role:
    name: maintenance
  vars:
    service_name: "security tracker"
    service_domain: "{{ security_tracker_domain }}"
    service_alternate_domains: []
    service_nginx_conf: "{{ security_tracker_nginx_conf }}"
  when: maintenance is defined
11
12

- name: install packages
13
14
15
16
17
18
19
20
21
22
23
24
  pacman:
    state: present
    name:
      - git
      - python
      - python-sqlalchemy
      - python-flask
      - python-flask-sqlalchemy
      - python-flask-wtf
      - python-flask-login
      - python-flask-talisman
      - python-requests
25
      - python-flask-migrate
26
27
28
29
30
      - python-scrypt
      - pyalpm
      - sqlite
      - expac
      - uwsgi-plugin-python
31
32
33
34
35
36
37
38

- name: make security user
  user: name=security shell=/bin/false home="{{ security_tracker_dir }}" createhome=no

- name: fix home permissions
  file: state=directory owner=security group=security path="{{ security_tracker_dir }}"

- name: clone security-tracker repo
39
  git: repo=https://github.com/archlinux/arch-security-tracker.git version="fa5acdf20f30b070fe388340b464dae58d30e23f" dest="{{ security_tracker_dir }}"
40
41
  become: true
  become_user: security
42
  register: release
43

44
45
46
47
48
- name: run initial setup
  become: true
  become_user: security
  command: /usr/bin/make chdir="{{ security_tracker_dir }}" creates=*.db

49
50
- name: fix home permissions
  file: state=directory owner=security group=security path="{{ security_tracker_dir }}"
51
52

- name: set up nginx
53
  template: src=nginx.d.conf.j2 dest="{{ security_tracker_nginx_conf }}" owner=root group=root mode=644
54
  notify:
55
    - reload nginx
56
  when: maintenance is not defined
57
  tags: ['nginx']
58
59

- name: make nginx log dir
60
  file: path=/var/log/nginx/{{ security_tracker_domain }} state=directory owner=root group=root mode=0755
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75

- name: copy security-tracker units
  copy: src="{{ item }}" dest="/etc/systemd/system/{{ item }}" owner=root group=root mode=0644
  with_items:
    - security-tracker-update.timer
    - security-tracker-update.service
  notify:
    - daemon reload

- name: configure security-tracker
  template: src=20-user.local.conf.j2 dest={{ security_tracker_dir }}/config/20-user.local.conf owner=security group=security mode=0640

- name: deploy security-tracker
  template: src=security-tracker.ini.j2 dest=/etc/uwsgi/vassals/security-tracker.ini owner=security group=http mode=0644

76
77
78
79
80
81
- name: deploy new release
  become: true
  become_user: security
  file: path=/etc/uwsgi/vassals/security-tracker.ini state=touch
  when: release.changed

82
83
- name: start and enable security-tracker timer
  service: name="security-tracker-update.timer" enabled=yes state=started