--- /dev/null
+# 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
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"
- 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