From 34ce42c73b9a03128f6b68fef82c9549aac98da4 Mon Sep 17 00:00:00 2001 From: Markus Hauschild Date: Thu, 9 Nov 2017 21:21:19 +0100 Subject: [PATCH] Cleanup fastd role --- roles/fastd/files/fastd@.service | 12 ++++++++++++ roles/fastd/tasks/main.yml | 17 +++++------------ 2 files changed, 17 insertions(+), 12 deletions(-) create mode 100644 roles/fastd/files/fastd@.service 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