From e6e442e0fb39a87995bcd83a34807c6a19463eff Mon Sep 17 00:00:00 2001 From: Daniel Berteaud Date: Tue, 2 Aug 2022 18:00:20 +0200 Subject: [PATCH] Update to 2022-08-02 18:00 --- roles/nomad/tasks/install.yml | 6 ++++++ roles/nomad/templates/post-backup.j2 | 5 +++++ roles/nomad/templates/pre-backup.j2 | 5 +++++ 3 files changed, 16 insertions(+) create mode 100644 roles/nomad/templates/post-backup.j2 create mode 100644 roles/nomad/templates/pre-backup.j2 diff --git a/roles/nomad/tasks/install.yml b/roles/nomad/tasks/install.yml index a8df09f..b3280b4 100644 --- a/roles/nomad/tasks/install.yml +++ b/roles/nomad/tasks/install.yml @@ -53,3 +53,9 @@ when: nomad_unit.changed tags: nomad +- name: Install backup hooks + template: src={{ item }}-backup.j2 dest=/etc/backup/{{ item }}.d/nomad mode=755 + loop: + - pre + - post + tags: nomad diff --git a/roles/nomad/templates/post-backup.j2 b/roles/nomad/templates/post-backup.j2 new file mode 100644 index 0000000..1528a95 --- /dev/null +++ b/roles/nomad/templates/post-backup.j2 @@ -0,0 +1,5 @@ +#!/bin/sh + +set -eo pipefail + +rm -f {{ nomad_root_dir }}/backup/nomad.snap diff --git a/roles/nomad/templates/pre-backup.j2 b/roles/nomad/templates/pre-backup.j2 new file mode 100644 index 0000000..113fb58 --- /dev/null +++ b/roles/nomad/templates/pre-backup.j2 @@ -0,0 +1,5 @@ +#!/bin/sh + +set -eo pipefail + +{{ nomad_root_dir }}/bin/nomad operator snapshot save {{ nomad_root_dir }}/backup/nomad.snap