diff --git a/roles/strongswan/defaults/main.yml b/roles/strongswan/defaults/main.yml index 3a2a6f1..65bc8ea 100644 --- a/roles/strongswan/defaults/main.yml +++ b/roles/strongswan/defaults/main.yml @@ -3,6 +3,7 @@ ipsec_config_path: "configs/{{ IP_subject_alt_name }}/ipsec/" ipsec_pki_path: "{{ ipsec_config_path }}/.pki/" strongswan_shell: /usr/sbin/nologin strongswan_home: /var/lib/strongswan +strongswan_service: "{{ 'strongswan-starter' if ansible_distribution_major_version|int > 19 else 'strongswan' }}" BetweenClients_DROP: true algo_ondemand_cellular: false algo_ondemand_wifi: false diff --git a/roles/strongswan/handlers/main.yml b/roles/strongswan/handlers/main.yml index 5f35003..a3d504f 100644 --- a/roles/strongswan/handlers/main.yml +++ b/roles/strongswan/handlers/main.yml @@ -1,5 +1,5 @@ - name: restart strongswan - service: name=strongswan state=restarted + service: name={{ strongswan_service }} state=restarted - name: daemon-reload systemd: daemon_reload=true diff --git a/roles/strongswan/tasks/main.yml b/roles/strongswan/tasks/main.yml index cab979e..1c4c267 100644 --- a/roles/strongswan/tasks/main.yml +++ b/roles/strongswan/tasks/main.yml @@ -24,7 +24,7 @@ - name: strongSwan started service: - name: strongswan + name: "{{ strongswan_service }}" state: started enabled: true diff --git a/roles/strongswan/tasks/ubuntu.yml b/roles/strongswan/tasks/ubuntu.yml index 945aa39..2510511 100644 --- a/roles/strongswan/tasks/ubuntu.yml +++ b/roles/strongswan/tasks/ubuntu.yml @@ -35,12 +35,12 @@ service: name={{ item }} enabled=yes with_items: - apparmor - - strongswan + - "{{ strongswan_service }}" - netfilter-persistent - name: Ubuntu | Ensure that the strongswan service directory exists file: - path: /etc/systemd/system/strongswan.service.d/ + path: /etc/systemd/system/{{ strongswan_service }}.service.d/ state: directory mode: 0755 owner: root @@ -49,7 +49,7 @@ - name: Ubuntu | Setup the cgroup limitations for the ipsec daemon template: src: 100-CustomLimitations.conf.j2 - dest: /etc/systemd/system/strongswan.service.d/100-CustomLimitations.conf + dest: /etc/systemd/system/{{ strongswan_service }}.service.d/100-CustomLimitations.conf notify: - daemon-reload - restart strongswan