Role service-fastd-mesh: add systemd unit + timer to update mesh peers

This commit is contained in:
Tobias Hachmer 2017-10-03 23:30:02 +02:00
parent 04d12c1fb5
commit 0fa92eef1c
4 changed files with 47 additions and 0 deletions

View file

@ -1,3 +1,4 @@
--- ---
dependencies: dependencies:
- { role: git-repos }
- { role: service-fastd } - { role: service-fastd }

View file

@ -59,3 +59,27 @@
dest: "/etc/fastd/{{ item.key }}VPN/secret.conf" dest: "/etc/fastd/{{ item.key }}VPN/secret.conf"
notify: restart fastd mesh instances notify: restart fastd mesh instances
with_dict: "{{ meshes }}" with_dict: "{{ meshes }}"
- 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: configure systemd unit/timer fastd-sync-meshkeys
systemd:
name: fastd-sync-meshkeys.timer
enabled: yes
state: started

View file

@ -0,0 +1,10 @@
#
# {{ ansible_managed }}
#
[Unit]
Description=Update fastd mesh peers repos
[Service]
ExecStart=/home/admin/clones/backend-scripts/sync_meshkeys_gw.sh
User=admin
Group=admin

View file

@ -0,0 +1,12 @@
#
# {{ ansible_managed }}
#
[Unit]
Description=Update fastd mesh peers repos timer
[Timer]
OnBootSec=5m
OnUnitActiveSec=15m
[Install]
WantedBy=timers.target