summaryrefslogtreecommitdiff
path: root/roles/install_fastd/tasks/main.yml
blob: 8f01e4737620ef5ab8d0277ad7f475fdaad9e1f4 (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
---
- name: install fastd
  become: yes
  become_user: '{{ aur_user }}'
  aur:
      name: fastd
      tool: yaourt

- name: create site folder
  file:
      path: /etc/fastd/ff{{ item.name }}
      state: directory
  with_items: "{{ sites }}"

- name: fastd.conf
  template:
      src: fastd.conf.j2
      dest: /etc/fastd/ff{{ item.name }}/fastd.conf
      mode: 0640
  notify: restart fastd{{ item.name }}
  with_items: "{{ sites }}"

- name: add fastd bin folder
  file:
      path: /etc/fastd/ff{{ item.name }}/bin
      state: directory
  with_items: "{{ sites }}"

- name: add fastd up script
  template:
      src: fastd_up.sh.j2
      dest: /etc/fastd/ff{{ item.name }}/bin/up.sh
      mode: 0744
  notify: restart fastd{{ item.name }}
  with_items: "{{ sites }}"

- name: add fastd peers folder
  file:
      path: /etc/fastd/ff{{ item.name }}/peers
      state: directory
  with_items: "{{ sites }}"

- name: add fastd peer api script
  template:
      src: fastd-api.php.j2
      dest: /etc/fastd/ff{{ item.name }}/bin/fastd-api.php
  with_items: "{{ sites }}"

- name: setup cronjob for fastd-api
  cron:
      name: fastd-api-{{ item.name }}
      minute: '*/10'
      user: root
      cron_file: fastd-api
      job: '/usr/bin/php /etc/fastd/ff{{ item.name }}/bin/fastd-api.php'
  with_items: "{{ sites }}"

- name: start and enable fastd service
  systemd:
      name: fastd@ff{{ item.name }}.service
      enabled: yes
      state: started
  with_items: "{{ sites }}"