aboutsummaryrefslogtreecommitdiffstats
path: root/roles/rc/templates
diff options
context:
space:
mode:
authorRomain Gonçalves <me@rgoncalves.se>2021-12-15 18:21:17 +0000
committerRomain Gonçalves <me@rgoncalves.se>2021-12-15 21:39:50 +0000
commit2927544ce379f607670768cc61252039c627058a (patch)
tree216d9faab9f92e30db21a5f56954ab977b059730 /roles/rc/templates
parent46113df6b183c392a016053c29c694d65d5a9cfb (diff)
downloadrules-2927544ce379f607670768cc61252039c627058a.tar.gz
roles: Add rc for service file creation
Supports openrc and rc for Alpine and OpenBSD
Diffstat (limited to 'roles/rc/templates')
-rw-r--r--roles/rc/templates/os_alpine.j213
-rw-r--r--roles/rc/templates/os_openbsd.j217
2 files changed, 30 insertions, 0 deletions
diff --git a/roles/rc/templates/os_alpine.j2 b/roles/rc/templates/os_alpine.j2
new file mode 100644
index 0000000..a84d787
--- /dev/null
+++ b/roles/rc/templates/os_alpine.j2
@@ -0,0 +1,13 @@
+#!/sbin/openrc-run
+# managed by Ansible
+
+supervisor="supervise-daemon"
+
+description="{{ rc_name }} {{ rc_description }}"
+description_reload="Reload {{ rc_name }}"
+
+command="{{ rc_cmd }}"
+command_args="{{ rc_args }}"
+command_user="{{ rc_user }}"
+
+directory="{{ rc_runtime_dir }}"
diff --git a/roles/rc/templates/os_openbsd.j2 b/roles/rc/templates/os_openbsd.j2
new file mode 100644
index 0000000..cc1f444
--- /dev/null
+++ b/roles/rc/templates/os_openbsd.j2
@@ -0,0 +1,17 @@
+#!/bin/ksh
+# managed by Ansible
+
+daemon="{{ rc_cmd }}"
+daemon_flags="{{ rc_args }}"
+daemon_user="{{ rc_user }}"
+daemon_dir="{{ rc_runtime_dir }}"
+
+rc_bg="{{ "YES" if rc_bg else "NO" }}"
+
+{% if rc_pexp is defined and rc_pexp %}
+pexp="${daemon} ${daemon_flags}"
+{% endif %}
+
+. /etc/rc.d/rc.subr
+
+rc_cmd $1
remember that computers suck.