aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorbinary <me@rgoncalves.se>2020-11-20 20:57:51 +0100
committerbinary <me@rgoncalves.se>2020-11-20 20:57:51 +0100
commit39c75e5f02aeadad62c9ff38de1a06b396db5e28 (patch)
tree48ae97cca654772a101f8fa1aae5d57e662e9a4e
parent11f9b244db17d676181cf9394e9e281477cc224b (diff)
downloadinfrastructure-39c75e5f02aeadad62c9ff38de1a06b396db5e28.tar.gz
Refactor rc scripts tasks.
-rw-r--r--roles/rc/tasks/main.yml9
-rw-r--r--roles/rc/tasks/rc_alpine.yml7
-rw-r--r--roles/rc/tasks/rc_openbsd.yml9
-rw-r--r--roles/rc/vars/main.yml3
4 files changed, 14 insertions, 14 deletions
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
remember that computers suck.