diff --git a/roles/service-fastd-mesh/meta/main.yml b/roles/service-fastd-mesh/meta/main.yml index d0f177f..a5b2bf1 100644 --- a/roles/service-fastd-mesh/meta/main.yml +++ b/roles/service-fastd-mesh/meta/main.yml @@ -1,3 +1,4 @@ --- dependencies: + - { role: git-repos } - { role: service-fastd } diff --git a/roles/service-fastd-mesh/tasks/main.yml b/roles/service-fastd-mesh/tasks/main.yml index 0e2c3c9..41a4f18 100644 --- a/roles/service-fastd-mesh/tasks/main.yml +++ b/roles/service-fastd-mesh/tasks/main.yml @@ -59,3 +59,27 @@ dest: "/etc/fastd/{{ item.key }}VPN/secret.conf" notify: restart fastd mesh instances 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 diff --git a/roles/service-fastd-mesh/templates/fastd-sync-meshkeys.service.j2 b/roles/service-fastd-mesh/templates/fastd-sync-meshkeys.service.j2 new file mode 100644 index 0000000..70a181b --- /dev/null +++ b/roles/service-fastd-mesh/templates/fastd-sync-meshkeys.service.j2 @@ -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 diff --git a/roles/service-fastd-mesh/templates/fastd-sync-meshkeys.timer.j2 b/roles/service-fastd-mesh/templates/fastd-sync-meshkeys.timer.j2 new file mode 100644 index 0000000..cea04f0 --- /dev/null +++ b/roles/service-fastd-mesh/templates/fastd-sync-meshkeys.timer.j2 @@ -0,0 +1,12 @@ +# +# {{ ansible_managed }} +# +[Unit] +Description=Update fastd mesh peers repos timer + +[Timer] +OnBootSec=5m +OnUnitActiveSec=15m + +[Install] +WantedBy=timers.target