Переглянути джерело

[galene] Add initial config

Colin Powell 3 роки тому
батько
коміт
3119c7a584

+ 42 - 0
ansible/roles/galene/files/galene.rc

@@ -0,0 +1,42 @@
+#!/bin/sh
+# Start script for FreeBSD, contributed by user Fabian Abplanalp
+# Put this script in /usr/local/etc/rc.d then adjust GALENE_BIN and
+# GALENE_CFG values in /etc/defaults/galene
+
+GALENE_BIN="/usr/local/bin/galene"
+GALENE_PID="/var/run/galene.pid"
+
+# Read configuration variable file if it is present
+[ -r /etc/defaults/galene ] && . /etc/defaults/galene
+
+case "$1" in
+"start")
+	echo "Starting galene..."
+	${GALENE_BIN} &
+	echo $! >${GALENE_PID}
+	echo "done"
+	;;
+
+"stop")
+	echo "Stopping galene..."
+	if [ -f ${GALENE_PID} ]; then
+		kill $(cat ${GALENE_PID})
+		rm ${GALENE_PID}
+		echo "done"
+	else
+		echo "not running?"
+	fi
+	;;
+
+"restart")
+	echo "Restarting galene..."
+	$0 stop
+	sleep 2
+	$0 start
+	;;
+
+*)
+	echo "$0 [start|stop|restart]"
+	;;
+
+esac

+ 5 - 0
ansible/roles/galene/handlers/main.yml

@@ -0,0 +1,5 @@
+---
+- name: Galene restarted
+  service:
+    name: galene
+    state: restarted

+ 38 - 0
ansible/roles/galene/tasks/main.yml

@@ -0,0 +1,38 @@
+- name: Galene deps installed
+  community.general.pkgng:
+    name: "git go"
+    state: latest
+
+- name: Galene source deployed
+  git:
+    repo: "https://github.com/jech/galene"
+    dest: /usr/local/src/galene
+    accept_hostkey: yes
+    force: yes
+    update: yes
+
+- name: limit_unix.go patched to build on FreeBSD
+  shell:
+    cmd: 'sed -i -e "s/uint64/int64/g" /usr/local/src/galene/limit/limit_unix.go'
+    warn: false
+
+- name: Galene binary built
+  shell:
+    chdir: /usr/local/src/galene
+    cmd: go build .
+
+- name: Galene rc file installed
+  ansible.builtin.copy:
+    src: galene.rc
+    dest: /usr/local/etc/rc.d/galene
+    mode: a+x
+
+- name: Galene enabled
+  shell: sysrc galene_enable="YES"
+
+- name: Install galene
+  ansible.builtin.copy:
+    src: /usr/local/src/galene/galene
+    dest: /usr/local/bin/galene
+    remote_src: yes
+  notify: Galene restarted