aboutsummaryrefslogtreecommitdiffstats
path: root/roles/rc
diff options
context:
space:
mode:
Diffstat (limited to 'roles/rc')
-rw-r--r--roles/rc/tasks/main.yml7
-rw-r--r--roles/rc/tasks/rc_alpine.yml21
-rw-r--r--roles/rc/tasks/rc_openbsd.yml21
-rw-r--r--roles/rc/templates/rc_alpine.j27
-rw-r--r--roles/rc/templates/rc_openbsd.j211
-rw-r--r--roles/rc/vars/main.yml7
6 files changed, 74 insertions, 0 deletions
diff --git a/roles/rc/tasks/main.yml b/roles/rc/tasks/main.yml
new file mode 100644
index 0000000..ef8d4f3
--- /dev/null
+++ b/roles/rc/tasks/main.yml
@@ -0,0 +1,7 @@
+
+# openrc ~~ tasks/main.yml
+
+---
+
+- include_tasks: "rc_{{ ansible_distribution | lower }}.yml"
+
diff --git a/roles/rc/tasks/rc_alpine.yml b/roles/rc/tasks/rc_alpine.yml
new file mode 100644
index 0000000..7d35528
--- /dev/null
+++ b/roles/rc/tasks/rc_alpine.yml
@@ -0,0 +1,21 @@
+
+# openrc ~~ tasks/main.yml
+
+---
+
+- name: Generate rc script for desired service
+ template:
+ src: rc_alpine.j2
+ dest: "{{ rc_alpine_dir }}/{{ rc_name }}"
+
+- file:
+ path: "{{ rc_alpine_dir }}/{{ rc_name }}"
+ owner: "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
new file mode 100644
index 0000000..3d89e55
--- /dev/null
+++ b/roles/rc/tasks/rc_openbsd.yml
@@ -0,0 +1,21 @@
+
+# openrc ~~ tasks/main.yml
+
+---
+
+- name: Generate rc script for desired service
+ template:
+ src: rc_openbsd.j2
+ dest: "{{ rc_openbsd_dir }}/{{ rc_name }}"
+
+- file:
+ path: "{{ rc_openbsd_dir }}/{{ rc_name }}"
+ owner: "root"
+ group: "{{ group_root }}"
+ mode: "0555"
+
+- service:
+ name: "{{ rc_name }}"
+ state: started
+ enabled: true
+
diff --git a/roles/rc/templates/rc_alpine.j2 b/roles/rc/templates/rc_alpine.j2
new file mode 100644
index 0000000..217cd05
--- /dev/null
+++ b/roles/rc/templates/rc_alpine.j2
@@ -0,0 +1,7 @@
+#!/sbin/openrc-run
+#
+# managed by Ansible
+
+command="{{ rc_cmd }}"
+command_args="{{ rc_args }}"
+user="{{ rc_user }}"
diff --git a/roles/rc/templates/rc_openbsd.j2 b/roles/rc/templates/rc_openbsd.j2
new file mode 100644
index 0000000..30f1c0a
--- /dev/null
+++ b/roles/rc/templates/rc_openbsd.j2
@@ -0,0 +1,11 @@
+#!/bin/ksh
+#
+# managed by Ansible
+
+daemon="{{ rc_cmd }}"
+daemon_flags="{{ rc_args }}"
+daemon_user="{{ rc_user }}"
+
+. /etc/rc.d/rc.subr
+
+rc_cmd $1
diff --git a/roles/rc/vars/main.yml b/roles/rc/vars/main.yml
new file mode 100644
index 0000000..1ec55c3
--- /dev/null
+++ b/roles/rc/vars/main.yml
@@ -0,0 +1,7 @@
+
+# openrc ~~ vars/main.yml
+
+---
+
+rc_alpine_dir: "/etc/init.d"
+rc_openbsd_dir: "/etc/rc.d"
remember that computers suck.