[GIT] refactor submodules: add all to own repo

This commit is contained in:
Jannik Beyerstedt 2019-10-06 22:55:56 +02:00
commit be2b9bf3c0
27 changed files with 3311 additions and 0 deletions

57
tasks/borgbackup.yml Normal file
View file

@ -0,0 +1,57 @@
---
# Server/Borgbackup: Install and Setup Borgbackup Backup Crobjob
# Variables (must be set!):
# - borgbackup_host
# - borgbackup_sub
- name: borgbackup - Install
include_tasks: "{{ item }}"
with_first_found:
- "borgbackup-{{ ansible_distribution }}.{{ ansible_distribution_release }}.yml"
- "borgbackup-{{ ansible_distribution }}.yml"
- "borgbackup-{{ ansible_os_family }}.yml"
# copy backup script and enable cronjob
- name: borgbackup - Copy Borgbackup script
become: yes
template:
src: "{{ role_path }}/templates/borgbackup.sh"
dest: /usr/local/bin/borgbackup.sh
owner: "{{ ansible_user_id }}"
group: "{{ ansible_user_id }}"
mode: 0775
when:
- borgbackup_host is defined
- borgbackup_sub is defined
- name: borgbackup - Run Borgbackup script at 1:00 daily
become: yes
cron:
name: "Create Backup"
minute: "0"
hour: "1"
job: "/usr/local/bin/borgbackup.sh"
when:
- borgbackup_host is defined
- borgbackup_sub is defined
# safeguard, if the host variables were removed
- name: borgbackup - Remove Borgbackup script if no borgbackup config
become: yes
file:
path: /usr/local/bin/borgbackup.sh
state: absent
when:
- borgbackup_host is not defined
- borgbackup_sub is not defined
- name: borgbackup - Remove Cronjob if no borgbackup config
become: yes
cron:
name: "Create Backup"
minute: "0"
hour: "1"
job: "/usr/local/bin/borgbackup.sh"
state: absent
when:
- borgbackup_host is not defined
- borgbackup_sub is not defined