summaryrefslogtreecommitdiffstats
path: root/roles/ands_backup/tasks
diff options
context:
space:
mode:
authorSuren A. Chilingaryan <csa@suren.me>2018-03-11 19:56:38 +0100
committerSuren A. Chilingaryan <csa@suren.me>2018-03-11 19:56:38 +0100
commitf3c41dd13a0a86382b80d564e9de0d6b06fb1dbf (patch)
tree3522ce77203da92bb2b6f7cfa2b0999bf6cc132c /roles/ands_backup/tasks
parent6bc3a3ac71e11fb6459df715536fec373c123a97 (diff)
downloadands-f3c41dd13a0a86382b80d564e9de0d6b06fb1dbf.tar.gz
ands-f3c41dd13a0a86382b80d564e9de0d6b06fb1dbf.tar.bz2
ands-f3c41dd13a0a86382b80d564e9de0d6b06fb1dbf.tar.xz
ands-f3c41dd13a0a86382b80d564e9de0d6b06fb1dbf.zip
Various fixes before moving to hardware installation
Diffstat (limited to 'roles/ands_backup/tasks')
-rw-r--r--roles/ands_backup/tasks/main.yml29
1 files changed, 29 insertions, 0 deletions
diff --git a/roles/ands_backup/tasks/main.yml b/roles/ands_backup/tasks/main.yml
new file mode 100644
index 0000000..16a8ec3
--- /dev/null
+++ b/roles/ands_backup/tasks/main.yml
@@ -0,0 +1,29 @@
+- name: Install required packages
+ package: name={{item}} state=present
+ with_items:
+ - borgbackup
+ - heketi-client
+
+- name: Create scripts directory
+ file: path="{{ ands_script_path }}" state=directory
+
+- name: Populate backup script
+ template: src=backup.sh.j2 dest="{{ ands_script_path }}/ands_backup.sh" owner=root group=root mode=0755
+
+- name: Populate cron job
+ template: src=backup.cron.j2 dest="/etc/cron.d/9ands_backup" owner=root group=root mode=0644
+
+
+- name: Check if backup volume is mounted
+ command: mountpoint -q "{{ ands_backup_volume }}"
+
+
+- block:
+ - name: Check if borg is already initialized
+ stat: path="{{ ands_borg_path }}/config"
+ register: borg_stat_res
+
+ - name: Initialize borg repository
+ shell: "borg init {{ ands_borg_path }} --encryption=none"
+ when: not borg_stat_res.stat.exists
+ run_once: true