]> git.ekhem.eu.org Git - turnup.git/commitdiff
Add a script for deploying notification scripts.
authorJakub Czajka <jakub@ekhem.eu.org>
Sat, 14 Oct 2023 22:55:39 +0000 (00:55 +0200)
committerJakub Czajka <jczajka@google.com>
Sun, 24 Dec 2023 18:46:45 +0000 (19:46 +0100)
notify.yaml [new file with mode: 0644]
sources.yaml
turnup.yaml

diff --git a/notify.yaml b/notify.yaml
new file mode 100644 (file)
index 0000000..1875f69
--- /dev/null
@@ -0,0 +1,55 @@
+# Copyright (c) 2023 Jakub Czajka <jakub@ekhem.eu.org>
+# License: GPL-3.0 or later.
+
+- hosts: servers
+  vars:
+    repos:
+      - /srv/git/notify.git
+    dest: "/srv/prod/notify"
+  tasks:
+    - name: Ensure user exists for executing scripts
+      user:
+        name: "notify"
+        shell: "/bin/sh"
+        home: "{{ dest }}"
+      become: yes
+    - name: Ensure destination directory exists
+      file:
+        path: "{{ dest }}"
+        mode: 0775
+        state: directory
+        owner: git
+        group: notify
+      become: true
+    - name: Ensure destination directory exists
+      file:
+        path: "{{ dest }}"
+        state: directory
+      become: true
+    - name: Checkout files to the destination directory
+      command: |
+        git --work-tree={{ dest }} --git-dir={{ item }} checkout main --force
+      become: yes
+      with_items: "{{ repos }}"
+    - name: Ensure correct ownership in the destination directory
+      file:
+        dest: "{{ dest }}"
+        owner: git
+        group: notify
+        recurse: yes
+      become: yes
+    - name: Symlink system configuration
+      file:
+        src: "{{ dest }}/{{ item }}"
+        dest: "/etc/systemd/system/{{ item }}"
+        state: link
+      become: true
+      with_items:
+        - notify_failure@.service
+    - name: Set execution mode to scripts
+      file:
+        dest: "{{ dest }}/{{ item }}"
+        mode: 0755
+      become: true
+      with_items:
+        - notify_on_failure.sh
index 073508754ff625da88e3f848c31ae9066de0f214..938a950d5e76dbc8502b1844af49f5f61ec3c7c4 100644 (file)
@@ -39,6 +39,11 @@ files:
     dest: "/srv/git"
     owner: "git"
     group: "www-data"
+  - name: "notify.git"
+    uid: "1JimiRQnm3drG8pSR_NrKs9q0ZXJ_KYzt"
+    dest: "/srv/git"
+    owner: "git"
+    group: "www-data"
   - name: "password_store.git"
     uid: "1ZWu643FJBuMF3ypj5VUsLin8rF7WWhmp"
     dest: "/srv/git"
index acc12d1e6a57f2c9ce35e2b69de36d50dc875dce..72a9280c90fac0271c206bcebf26e840133bc403 100644 (file)
@@ -42,6 +42,9 @@
 - name: Deploy password store
   import_playbook: password_store.yaml
 
+- name: Deploy notify
+  import_playbook: notify.yaml
+
 - name: Deploy storage drive
   import_playbook: storage_drive.yaml