ansible: install & configure alarmd on iapetus
authorKristof Provost <kp@FreeBSD.org>
Tue, 30 Apr 2024 21:05:46 +0000 (23:05 +0200)
committerKristof Provost <kp@FreeBSD.org>
Tue, 30 Apr 2024 21:05:46 +0000 (23:05 +0200)
ansible/playbook-push.yaml
ansible/roles/alarmd/tasks/main.yaml [new file with mode: 0644]
ansible/roles/alarmd/templates/settings.py [new file with mode: 0644]
ansible/roles/alarmd/templates/start_tmux.sh [new file with mode: 0644]

index c863b9c..c6d7fa9 100644 (file)
@@ -6,3 +6,7 @@
   hosts: routers
   roles:
     - router
+- name: alarmd on iapetus
+  hosts: iapetus
+  roles:
+    - alarmd
diff --git a/ansible/roles/alarmd/tasks/main.yaml b/ansible/roles/alarmd/tasks/main.yaml
new file mode 100644 (file)
index 0000000..6dfe533
--- /dev/null
@@ -0,0 +1,26 @@
+- name: clone alarmd
+  ansible.builtin.git:
+    repo: https://github.com/kprovost/alarmd.git
+    dest: /home/kp/alarmd
+- name: alarmd settings
+  template:
+    src: settings.py
+    dest: /home/kp/alarmd/settings.py
+    mode: 0644
+- name: start_tmux.sh
+  template:
+    src: start_tmux.sh
+    dest: /home/kp/alarmd/start_tmux.sh
+    mode: 0755
+- name: install required python modules
+  pip:
+    name: "{{ item }}"
+    extra_args: "--upgrade"
+  with_items:
+    - daemon
+    - httplib2
+- name: start at reboot
+  ansible.builtin.cron:
+    name: "start alarmd at reboot"
+    special_time: reboot
+    job: "/home/kp/alarmd/start_tmux.sh"
diff --git a/ansible/roles/alarmd/templates/settings.py b/ansible/roles/alarmd/templates/settings.py
new file mode 100644 (file)
index 0000000..9fda1e0
--- /dev/null
@@ -0,0 +1,14 @@
+$ANSIBLE_VAULT;1.1;AES256
+65653965306331373761633561393366303038316536306263306434386361643466363835353739
+3539313362313033346362336661643961313832646132330a373366316661346330363831313861
+32626436336139393566346164613539333165366261393861383433373435633065306361343834
+6132663832363630300a633934393164306539396231383864313631313730326338333566313331
+65633233323734643735393730613734313364346666376264656664313731326566343930386534
+38326531393032313731646466373338646265633132643837326333343265333363623630393733
+66666166356565396365666462353562333539623832353031366332303439646439396165386161
+31386566633066636235316534633738313539613962633935616433346539666138353762303231
+62353837646234333566383139326665373235653634373065666266323534323437336161623835
+38346564353564643938353461336532656463636132306632653537646166666134333035373131
+65313636333937623963373833393734643164333766336663343266383365656131383132303163
+31633564636139313535333335326237656436386431356361316431373231663264376132386263
+3732
diff --git a/ansible/roles/alarmd/templates/start_tmux.sh b/ansible/roles/alarmd/templates/start_tmux.sh
new file mode 100644 (file)
index 0000000..39f3feb
--- /dev/null
@@ -0,0 +1,3 @@
+#!/bin/sh
+
+/usr/local/bin/tmux new-session -d "PYTHONPATH=/home/kp/libs7comm-python/ /home/kp/alarmd/alarmd.py -f -d"