From 39c75e5f02aeadad62c9ff38de1a06b396db5e28 Mon Sep 17 00:00:00 2001 From: binary Date: Fri, 20 Nov 2020 20:57:51 +0100 Subject: Refactor rc scripts tasks. --- roles/rc/tasks/main.yml | 9 ++++++++- roles/rc/tasks/rc_alpine.yml | 7 +------ roles/rc/tasks/rc_openbsd.yml | 9 ++------- roles/rc/vars/main.yml | 3 +++ 4 files changed, 14 insertions(+), 14 deletions(-) (limited to 'roles/rc') diff --git a/roles/rc/tasks/main.yml b/roles/rc/tasks/main.yml index ef8d4f3..142b5b5 100644 --- a/roles/rc/tasks/main.yml +++ b/roles/rc/tasks/main.yml @@ -3,5 +3,12 @@ --- -- include_tasks: "rc_{{ ansible_distribution | lower }}.yml" +- name: include rc task per-system + include_tasks: "rc_{{ os_distribution }}.yml" + +- name: start and enable service on boot + service: + name: "{{ rc_name }}" + state: "{{ rc_state }}" + enabled: "{{ rc_enable }}" diff --git a/roles/rc/tasks/rc_alpine.yml b/roles/rc/tasks/rc_alpine.yml index 7d35528..24af1fb 100644 --- a/roles/rc/tasks/rc_alpine.yml +++ b/roles/rc/tasks/rc_alpine.yml @@ -10,12 +10,7 @@ - file: path: "{{ rc_alpine_dir }}/{{ rc_name }}" - owner: "root" + owner: "{{ user_root }}" group: "{{ group_root }}" mode: "0755" -- service: - name: "{{ rc_name }}" - state: started - enabled: true - diff --git a/roles/rc/tasks/rc_openbsd.yml b/roles/rc/tasks/rc_openbsd.yml index 3d89e55..2055de0 100644 --- a/roles/rc/tasks/rc_openbsd.yml +++ b/roles/rc/tasks/rc_openbsd.yml @@ -10,12 +10,7 @@ - file: path: "{{ rc_openbsd_dir }}/{{ rc_name }}" - owner: "root" + owner: "{{ user_root }}" group: "{{ group_root }}" - mode: "0555" - -- service: - name: "{{ rc_name }}" - state: started - enabled: true + mode: 0555 diff --git a/roles/rc/vars/main.yml b/roles/rc/vars/main.yml index 1ec55c3..764db13 100644 --- a/roles/rc/vars/main.yml +++ b/roles/rc/vars/main.yml @@ -5,3 +5,6 @@ rc_alpine_dir: "/etc/init.d" rc_openbsd_dir: "/etc/rc.d" + +rc_state: restarted +rc_enable: true -- cgit v1.2.3