From: Jakub Czajka Date: Sat, 14 Oct 2023 22:55:39 +0000 (+0200) Subject: Add a script for deploying notification scripts. X-Git-Url: https://git.ekhem.eu.org/?a=commitdiff_plain;h=0c8a5d683775fa5e3f4cb27d46234286fdcb5859;p=turnup.git Add a script for deploying notification scripts. --- diff --git a/notify.yaml b/notify.yaml new file mode 100644 index 0000000..1875f69 --- /dev/null +++ b/notify.yaml @@ -0,0 +1,55 @@ +# Copyright (c) 2023 Jakub Czajka +# 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 diff --git a/sources.yaml b/sources.yaml index 0735087..938a950 100644 --- a/sources.yaml +++ b/sources.yaml @@ -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" diff --git a/turnup.yaml b/turnup.yaml index acc12d1..72a9280 100644 --- a/turnup.yaml +++ b/turnup.yaml @@ -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