From 8b3ecdbb9cb4c455638cf185cd7f0946118fae52 Mon Sep 17 00:00:00 2001 From: Ryan Cavicchioni Date: Tue, 3 Dec 2019 20:17:37 -0600 Subject: [PATCH] Set autossh systemd RuntimeDirectory --- roles/autossh/tasks/main.yaml | 7 ++----- roles/autossh/templates/autossh.j2 | 1 + roles/autossh/templates/autossh.service.j2 | 1 + 3 files changed, 4 insertions(+), 5 deletions(-) diff --git a/roles/autossh/tasks/main.yaml b/roles/autossh/tasks/main.yaml index f0dc374..0241a8d 100644 --- a/roles/autossh/tasks/main.yaml +++ b/roles/autossh/tasks/main.yaml @@ -19,16 +19,13 @@ - id_ed25519 - id_rsa -- name: create directories +- name: "create {{ autossh_etc_path }}" file: - path: "{{ item }}" + path: "{{ autossh_etc_path }}" owner: root group: root mode: 0755 state: directory - loop: - - "{{ autossh_etc_path }}" - - "{{ autossh_run_path }}" - name: install package package: diff --git a/roles/autossh/templates/autossh.j2 b/roles/autossh/templates/autossh.j2 index 18c4a25..93de6e6 100644 --- a/roles/autossh/templates/autossh.j2 +++ b/roles/autossh/templates/autossh.j2 @@ -4,5 +4,6 @@ AUTOSSH_POLL=60 AUTOSSH_FIRST_POLL=30 AUTOSSH_GATETIME=0 AUTOSSH_PORT=22000 +AUTOSSH_PIDFILE={{ autossh_run_path }}/{{ item.name }}.pid SSH_OPTIONS="{{ item.options | join(' ') }}" SSH_HOST={{ item.host }} diff --git a/roles/autossh/templates/autossh.service.j2 b/roles/autossh/templates/autossh.service.j2 index 535a0b9..f4bb79b 100644 --- a/roles/autossh/templates/autossh.service.j2 +++ b/roles/autossh/templates/autossh.service.j2 @@ -13,6 +13,7 @@ ExecStart= ExecStart=/usr/bin/autossh -C -q -l {{ autossh_user }} -N -o ExitOnForwardFailure=yes -o ServerAliveInterval=15 -o ServerAliveCountMax=3 -o StrictHostKeyChecking=no $SSH_OPTIONS $SSH_HOST Restart=always RestartSec=60 +RuntimeDirectory=autossh PIDFile={{ autossh_run_path }}/%i.pid [Install]