mirror of
https://github.com/nikdoof/ansible-borgmatic.git
synced 2025-12-11 09:52:18 +00:00
Compare commits
4 Commits
6706fad99d
...
90994a827d
| Author | SHA1 | Date | |
|---|---|---|---|
|
90994a827d
|
|||
|
19167bcce0
|
|||
|
2d657da73d
|
|||
|
fc6a5c8256
|
@@ -1,4 +1,6 @@
|
|||||||
---
|
---
|
||||||
|
borgmatic_enabled: true
|
||||||
|
|
||||||
borgmatic_ssh_keys: []
|
borgmatic_ssh_keys: []
|
||||||
|
|
||||||
borgmatic_config:
|
borgmatic_config:
|
||||||
|
|||||||
@@ -20,8 +20,8 @@
|
|||||||
|
|
||||||
- name: Initialize borg check_repositories
|
- name: Initialize borg check_repositories
|
||||||
ansible.builtin.shell: "borgmatic init --encryption repokey"
|
ansible.builtin.shell: "borgmatic init --encryption repokey"
|
||||||
environment:
|
environment:
|
||||||
PATH: "{{ ansible_env.PATH}}:/usr/local/bin"
|
PATH: "{{ ansible_env.PATH}}:/usr/local/bin"
|
||||||
|
|
||||||
- name: Enable borgmatic.timer
|
- name: Enable borgmatic.timer
|
||||||
ansible.builtin.systemd:
|
ansible.builtin.systemd:
|
||||||
|
|||||||
@@ -4,6 +4,15 @@
|
|||||||
with_first_found:
|
with_first_found:
|
||||||
- "os/{{ ansible_os_family }}/{{ ansible_distribution_major_version }}.yaml"
|
- "os/{{ ansible_os_family }}/{{ ansible_distribution_major_version }}.yaml"
|
||||||
- "os/{{ ansible_os_family }}.yaml"
|
- "os/{{ ansible_os_family }}.yaml"
|
||||||
- include_tasks: install.yaml
|
|
||||||
- include_tasks: config.yaml
|
- name: Borgmatic - Install and configure
|
||||||
- include_tasks: init.yaml
|
when: borgmatic_enabled | default(true)
|
||||||
|
block:
|
||||||
|
- include_tasks: install.yaml
|
||||||
|
- include_tasks: config.yaml
|
||||||
|
- include_tasks: init.yaml
|
||||||
|
|
||||||
|
- name: Borgmatic - Uninstall and clean up
|
||||||
|
when: not borgmatic_enabled | default(true)
|
||||||
|
block:
|
||||||
|
- include_tasks: uninstall.yaml
|
||||||
|
|||||||
35
tasks/uninstall.yaml
Normal file
35
tasks/uninstall.yaml
Normal file
@@ -0,0 +1,35 @@
|
|||||||
|
---
|
||||||
|
- name: Disable borgmatic.timer if installed
|
||||||
|
ansible.builtin.systemd:
|
||||||
|
name: borgmatic.timer
|
||||||
|
enabled: false
|
||||||
|
state: stopped
|
||||||
|
failed_when: false
|
||||||
|
|
||||||
|
- name: Remove borgmatic systemd units
|
||||||
|
ansible.builtin.file:
|
||||||
|
path: "/etc/systemd/system/{{ item }}"
|
||||||
|
state: absent
|
||||||
|
loop:
|
||||||
|
- borgmatic.service
|
||||||
|
- borgmatic.timer
|
||||||
|
when:
|
||||||
|
- borgmatic_install_from_pip | default(false)
|
||||||
|
notify: reload systemd
|
||||||
|
|
||||||
|
- name: Uninstall borgmatic package
|
||||||
|
ansible.builtin.package:
|
||||||
|
name: borgmatic
|
||||||
|
state: absent
|
||||||
|
when:
|
||||||
|
- not (borgmatic_install_from_pip | default(false))
|
||||||
|
|
||||||
|
- name: Remove borgmatic configuration directory
|
||||||
|
ansible.builtin.file:
|
||||||
|
path: "/etc/borgmatic"
|
||||||
|
state: absent
|
||||||
|
|
||||||
|
- name: Remove borgmatic files in the root user home
|
||||||
|
ansible.builtin.file:
|
||||||
|
path: "/root/.borgmatic"
|
||||||
|
state: absent
|
||||||
Reference in New Issue
Block a user