mirror of
https://github.com/nikdoof/ansible-borgmatic.git
synced 2025-12-13 10:52:19 +00:00
Initial commit
This commit is contained in:
30
tasks/config.yaml
Normal file
30
tasks/config.yaml
Normal file
@@ -0,0 +1,30 @@
|
||||
---
|
||||
- name: Create /etc/borgmatic folder
|
||||
ansible.builtin.file:
|
||||
path: /etc/borgmatic
|
||||
state: directory
|
||||
owner: root
|
||||
group: root
|
||||
mode: "0700"
|
||||
- name: Write borgmatic config
|
||||
template:
|
||||
src: config.yaml.j2
|
||||
dest: /etc/borgmatic/config.yaml
|
||||
owner: root
|
||||
group: root
|
||||
mode: "0600"
|
||||
- name: Create /root/.borgmatic folder
|
||||
ansible.builtin.file:
|
||||
path: /root/.borgmatic
|
||||
state: directory
|
||||
owner: root
|
||||
group: root
|
||||
mode: "0700"
|
||||
- name: "Copy SSH key {{ item }} to borgmatic config folder"
|
||||
ansible.builtin.copy:
|
||||
src: "ssh_keys/{{ item }}"
|
||||
dest: "/etc/borgmatic/{{ item }}"
|
||||
owner: root
|
||||
group: root
|
||||
mode: "0600"
|
||||
loop: "{{ borgmatic_ssh_keys }}"
|
||||
12
tasks/init.yaml
Normal file
12
tasks/init.yaml
Normal file
@@ -0,0 +1,12 @@
|
||||
---
|
||||
- name: Initialize borg check_repositories
|
||||
ansible.builtin.command: "/usr/local/bin/borgmatic init --encryption repokey" # noqa 301
|
||||
no_log: true
|
||||
async: 300
|
||||
poll: 0
|
||||
- name: Enable borgmatic.timer
|
||||
ansible.builtin.systemd:
|
||||
name: borgmatic.timer
|
||||
enabled: true
|
||||
masked: false
|
||||
state: started
|
||||
25
tasks/install.yaml
Normal file
25
tasks/install.yaml
Normal file
@@ -0,0 +1,25 @@
|
||||
---
|
||||
- name: Install BorgBackup
|
||||
ansible.builtin.package:
|
||||
name: "{{ packages }}"
|
||||
state: installed
|
||||
vars:
|
||||
packages:
|
||||
- borgbackup
|
||||
- name: Install Borgmatic
|
||||
ansible.builtin.pip:
|
||||
name: "{{ packages }}"
|
||||
vars:
|
||||
packages:
|
||||
- borgmatic
|
||||
- name: Add borgmatic systemd units
|
||||
ansible.builtin.copy:
|
||||
src: "systemd/{{ item }}"
|
||||
dest: "/etc/systemd/system/{{ item }}"
|
||||
owner: root
|
||||
group: root
|
||||
mode: "0644"
|
||||
notify: reload systemd
|
||||
loop:
|
||||
- borgmatic.service
|
||||
- borgmatic.timer
|
||||
4
tasks/main.yaml
Normal file
4
tasks/main.yaml
Normal file
@@ -0,0 +1,4 @@
|
||||
---
|
||||
- include: install.yaml
|
||||
- include: config.yaml
|
||||
- include: init.yaml
|
||||
Reference in New Issue
Block a user