diff --git a/playbooks/backups.yml b/playbooks/backups.yml index 6919e1f..9d0ffa8 100644 --- a/playbooks/backups.yml +++ b/playbooks/backups.yml @@ -2,7 +2,7 @@ - name: "backups : yggdrasil" hosts: "yggdrasil" roles: - - role: "backups/snapshots" - tags: "backups:snapshots" - - role: "backups/restic" - tags: "backups:restic" + - role: "backups/snapshots/setup" + tags: "backups:snapshots:setup" + - role: "backups/restic/setup" + tags: "backups:restic:setup" diff --git a/playbooks/backups_start.yml b/playbooks/backups_start.yml new file mode 100644 index 0000000..39d30e1 --- /dev/null +++ b/playbooks/backups_start.yml @@ -0,0 +1,8 @@ +--- +- name: "backups : yggdrasil" + hosts: "yggdrasil" + roles: + - role: "backups/snapshots/start" + tags: "backups:snapshots:start" + - role: "backups/restic/start" + tags: "backups:restic:start" diff --git a/playbooks/backups_stop.yml b/playbooks/backups_stop.yml new file mode 100644 index 0000000..f51d786 --- /dev/null +++ b/playbooks/backups_stop.yml @@ -0,0 +1,8 @@ +--- +- name: "backups : yggdrasil" + hosts: "yggdrasil" + roles: + - role: "backups/snapshots/stop" + tags: "backups:snapshots:stop" + - role: "backups/restic/stop" + tags: "backups:restic:stop" diff --git a/playbooks/roles/backups/restic/files/restic-batch b/playbooks/roles/backups/restic/setup/files/restic-batch similarity index 100% rename from playbooks/roles/backups/restic/files/restic-batch rename to playbooks/roles/backups/restic/setup/files/restic-batch diff --git a/playbooks/roles/backups/restic/files/restic-batch.service b/playbooks/roles/backups/restic/setup/files/restic-batch.service similarity index 100% rename from playbooks/roles/backups/restic/files/restic-batch.service rename to playbooks/roles/backups/restic/setup/files/restic-batch.service diff --git a/playbooks/roles/backups/restic/files/restic-batch.timer b/playbooks/roles/backups/restic/setup/files/restic-batch.timer similarity index 100% rename from playbooks/roles/backups/restic/files/restic-batch.timer rename to playbooks/roles/backups/restic/setup/files/restic-batch.timer diff --git a/playbooks/roles/backups/restic/tasks/main.yml b/playbooks/roles/backups/restic/setup/tasks/main.yml similarity index 92% rename from playbooks/roles/backups/restic/tasks/main.yml rename to playbooks/roles/backups/restic/setup/tasks/main.yml index 4aad7e1..c6edadd 100644 --- a/playbooks/roles/backups/restic/tasks/main.yml +++ b/playbooks/roles/backups/restic/setup/tasks/main.yml @@ -62,9 +62,3 @@ when: backups_restic_restic_batch_service_file.changed or backups_restic_restic_batch_timer_file.changed - -- name: "enable and start restic-batch service" - ansible.builtin.systemd: - name: "restic-batch.timer" - enabled: true - state: "started" diff --git a/playbooks/roles/backups/restic/start/tasks/main.yml b/playbooks/roles/backups/restic/start/tasks/main.yml new file mode 100644 index 0000000..3ff9f5e --- /dev/null +++ b/playbooks/roles/backups/restic/start/tasks/main.yml @@ -0,0 +1,6 @@ +--- +- name: "enable and start restic-batch service" + ansible.builtin.systemd: + name: "restic-batch.timer" + enabled: true + state: "started" diff --git a/playbooks/roles/backups/restic/stop/tasks/main.yml b/playbooks/roles/backups/restic/stop/tasks/main.yml new file mode 100644 index 0000000..fcc8c3e --- /dev/null +++ b/playbooks/roles/backups/restic/stop/tasks/main.yml @@ -0,0 +1,6 @@ +--- +- name: "disable and stop restic-batch service" + ansible.builtin.systemd: + name: "restic-batch.timer" + enabled: false + state: "stopped" diff --git a/playbooks/roles/backups/snapshots/files/sanoid-templates.conf b/playbooks/roles/backups/snapshots/setup/files/sanoid-templates.conf similarity index 100% rename from playbooks/roles/backups/snapshots/files/sanoid-templates.conf rename to playbooks/roles/backups/snapshots/setup/files/sanoid-templates.conf diff --git a/playbooks/roles/backups/snapshots/files/syncoid-batch b/playbooks/roles/backups/snapshots/setup/files/syncoid-batch similarity index 100% rename from playbooks/roles/backups/snapshots/files/syncoid-batch rename to playbooks/roles/backups/snapshots/setup/files/syncoid-batch diff --git a/playbooks/roles/backups/snapshots/files/syncoid-batch.service b/playbooks/roles/backups/snapshots/setup/files/syncoid-batch.service similarity index 100% rename from playbooks/roles/backups/snapshots/files/syncoid-batch.service rename to playbooks/roles/backups/snapshots/setup/files/syncoid-batch.service diff --git a/playbooks/roles/backups/snapshots/meta/argument_specs.yml b/playbooks/roles/backups/snapshots/setup/meta/argument_specs.yml similarity index 100% rename from playbooks/roles/backups/snapshots/meta/argument_specs.yml rename to playbooks/roles/backups/snapshots/setup/meta/argument_specs.yml diff --git a/playbooks/roles/backups/snapshots/tasks/main.yml b/playbooks/roles/backups/snapshots/setup/tasks/main.yml similarity index 94% rename from playbooks/roles/backups/snapshots/tasks/main.yml rename to playbooks/roles/backups/snapshots/setup/tasks/main.yml index 2ee6a9c..09d3be3 100644 --- a/playbooks/roles/backups/snapshots/tasks/main.yml +++ b/playbooks/roles/backups/snapshots/setup/tasks/main.yml @@ -62,9 +62,3 @@ ansible.builtin.systemd: name: "syncoid-batch.service" enabled: true - -- name: "enable sanoid service" - ansible.builtin.systemd: - name: "sanoid.timer" - enabled: true - state: "started" diff --git a/playbooks/roles/backups/snapshots/start/tasks/main.yml b/playbooks/roles/backups/snapshots/start/tasks/main.yml new file mode 100644 index 0000000..523f7e1 --- /dev/null +++ b/playbooks/roles/backups/snapshots/start/tasks/main.yml @@ -0,0 +1,6 @@ +--- +- name: "enable and start sanoid service" + ansible.builtin.systemd: + name: "sanoid.timer" + enabled: true + state: "started" diff --git a/playbooks/roles/backups/snapshots/stop/tasks/main.yml b/playbooks/roles/backups/snapshots/stop/tasks/main.yml new file mode 100644 index 0000000..2202678 --- /dev/null +++ b/playbooks/roles/backups/snapshots/stop/tasks/main.yml @@ -0,0 +1,6 @@ +--- +- name: "disable and stop sanoid service" + ansible.builtin.systemd: + name: "sanoid.timer" + enabled: false + state: "stopped"