ansible-ffibk/roles/service-fastd-mesh/tasks/main.yml

124 lines
3.2 KiB
YAML

---
- name: create fastd directories
file:
path: "/etc/fastd/{{ item.0.id }}vpn-{{ item.1.mtu }}"
state: directory
mode: 0755
loop: "{{ meshes | subelements('fastd.nodes.instances') }}"
- name: template fastd mesh config
template:
src: fastd-mesh.conf.j2
dest: "/etc/fastd/{{ item.0.id }}vpn-{{ item.1.mtu }}/fastd.conf"
notify: restart fastd mesh instances
loop: "{{ meshes | subelements('fastd.nodes.instances') }}"
tags: debug
- name: write fastd mesh secret
template:
src: fastd-secret.conf.j2
dest: "/etc/fastd/{{ item.0.id }}vpn-{{ item.1.mtu }}/secret.conf"
notify: restart fastd mesh instances
loop: "{{ meshes | subelements('fastd.nodes.instances') }}"
- name: create peer_limit.txt if not exist
copy:
content: ""
dest: "/etc/fastd/peer_limit.txt"
owner: admin
group: admin
mode: 0640
force: no
- name: set file attributes for peer_limit.txt
file:
path: "/etc/fastd/peer_limit.txt"
mode: 0640
owner: admin
group: admin
- name: write systemd unit fastd-sync-meshkeys.service
template:
src: fastd-sync-meshkeys.service.j2
dest: /etc/systemd/system/fastd-sync-meshkeys.service
owner: root
group: root
mode: 0644
notify: reload systemd
- name: write systemd timer fastd-sync-meshkeys.timer
template:
src: fastd-sync-meshkeys.timer.j2
dest: /etc/systemd/system/fastd-sync-meshkeys.timer
owner: root
group: root
mode: 0644
notify: reload systemd
- name: write configuration for fastd-peer-limit-update script
template:
src: fastd_peer_limit.yaml.j2
dest: /home/admin/.ffmwu-config/fastd_peer_limit.yaml
owner: admin
group: admin
mode: 0644
- name: write systemd unit fastd-peer-limit-update.service
template:
src: fastd-peer-limit-update.service.j2
dest: /etc/systemd/system/fastd-peer-limit-update.service
owner: root
group: root
mode: 0644
notify: reload systemd
- name: write systemd timer fastd-peer-limit-update.timer
template:
src: fastd-peer-limit-update.timer.j2
dest: /etc/systemd/system/fastd-peer-limit-update.timer
owner: root
group: root
mode: 0644
notify: reload systemd
- name: configure systemd timers for fastd-mesh instance
systemd:
name: "{{ item }}.timer"
enabled: yes
state: started
loop:
- fastd-sync-meshkeys
- fastd-peer-limit-update
- name: configure systemd unit fastd@
systemd:
name: "fastd@{{ item.0.id }}vpn-{{ item.1.mtu }}"
enabled: yes
state: started
loop: "{{ meshes | subelements('fastd.nodes.instances') }}"
- name: build fastd-exporter binary
shell: "go get -v -u github.com/freifunk-darmstadt/fastd-exporter"
environment:
GOPATH: "{{ gopath }}"
notify: restart fastd-exporter
- name: copy vhost fastd_exporter.conf
template:
src: "fastd_exporter_vhost.conf.j2"
dest: "/etc/nginx/conf.d/fastd_exporter.conf"
notify: restart nginx
- name: create systemd unit for fastd-exporter
template:
src: "fastd-exporter.service.j2"
dest: "/etc/systemd/system/fastd-exporter.service"
notify:
- reload systemd
- restart fastd-exporter
- name: configure fastd-exporter systemd unit
systemd:
name: "fastd-exporter.service"
enabled: yes
state: started