diff --git a/roles/fastd/files/fastd@.service b/roles/fastd/files/fastd@.service new file mode 100644 index 0000000..6a158e7 --- /dev/null +++ b/roles/fastd/files/fastd@.service @@ -0,0 +1,12 @@ +[Unit] +Description=Fast and Secure Tunnelling Daemon (connection %I) +After=network.target + +[Service] +Type=notify +ExecStart=/usr/bin/fastd --syslog-level info --syslog-ident fastd@%I -c /etc/fastd/%I/fastd.conf +ExecReload=/bin/kill -HUP $MAINPID +ExecStopPost=/bin/rm -f /run/fastd-%I.sock + +[Install] +WantedBy=multi-user.target diff --git a/roles/fastd/tasks/main.yml b/roles/fastd/tasks/main.yml index 1f498d7..1f46283 100644 --- a/roles/fastd/tasks/main.yml +++ b/roles/fastd/tasks/main.yml @@ -6,15 +6,8 @@ - name: Install haveged (to create entropy) apt: name=haveged -- name: Copy systemd unit file - command: /bin/cp /lib/systemd/system/fastd@.service /etc/systemd/system/fastd@.service creates=/etc/systemd/system/fastd@.service - -- name: Fix systemd unit for fastd - lineinfile: - dest: /etc/systemd/system/fastd@.service - line: "ExecStopPost=/bin/rm -f /run/fastd-%I.sock" - regexp: "^ExecStopPost=" - insertafter: "^ExecReload=" +- name: Systemd unit for fastd + copy: src=fastd@.service dest=/etc/systemd/system/fastd@.service notify: - Reload systemd - Restart fastd @@ -30,8 +23,8 @@ notify: Restart fastd - name: Generate fastd secret - fastd_key: path=/etc/fastd/{{ site_code }}/secret.conf + fastd_key: path=/etc/fastd/{{ fastd_instance }}/secret.conf notify: Restart fastd -- name: Enable fastd {{ site_code }} - service: name=fastd@{{ site_code }} enabled=yes +- name: Enable fastd {{ fastd_instance }} + service: name=fastd@{{ fastd_instance }} enabled=yes