From 1a0e26a998b75d95d05d08bbe564894f0255b1a9 Mon Sep 17 00:00:00 2001 From: Robert Kaussow Date: Tue, 19 Oct 2021 21:51:49 +0200 Subject: [PATCH] fix service name on rocky8 --- tasks/main.yml | 12 ++++++++++++ tasks/setup.yml | 2 +- vars/redhat-7.yml | 2 ++ vars/redhat-8.yml | 2 ++ 4 files changed, 17 insertions(+), 1 deletion(-) create mode 100644 vars/redhat-7.yml create mode 100644 vars/redhat-8.yml diff --git a/tasks/main.yml b/tasks/main.yml index 1f69f7a..6db920d 100644 --- a/tasks/main.yml +++ b/tasks/main.yml @@ -1,2 +1,14 @@ --- +- include_vars: "{{ var_files }}" + vars: + var_files: "{{ lookup('first_found', params, errors='ignore') }}" + params: + files: + - "{{ ansible_lsb.id | default('') | lower }}.yml" + - "{{ ansible_os_family | lower }}-{{ ansible_distribution_major_version }}.yml" + - "{{ ansible_os_family | lower }}.yml" + paths: + - "vars" + when: var_files + - include_tasks: setup.yml diff --git a/tasks/setup.yml b/tasks/setup.yml index ee4f997..a244dd9 100644 --- a/tasks/setup.yml +++ b/tasks/setup.yml @@ -59,7 +59,7 @@ - name: Ensure openvpn service is up and running service: - name: "openvpn@{{ openvpn_client_name }}" + name: "{{ __openvpn_service_prefix }}@{{ openvpn_client_name }}" state: "{{ openvpn_service_state }}" enabled: yes become: True diff --git a/vars/redhat-7.yml b/vars/redhat-7.yml new file mode 100644 index 0000000..ea40a43 --- /dev/null +++ b/vars/redhat-7.yml @@ -0,0 +1,2 @@ +--- +__openvpn_service_prefix: openvpn diff --git a/vars/redhat-8.yml b/vars/redhat-8.yml new file mode 100644 index 0000000..326f2c5 --- /dev/null +++ b/vars/redhat-8.yml @@ -0,0 +1,2 @@ +--- +__openvpn_service_prefix: openvpn-client