-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathduplicacy-init.yml
67 lines (58 loc) · 1.65 KB
/
duplicacy-init.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
---
# Installs duplicacy stuff as ROOT!!!
- hosts: utat
become: yes
gather_facts: yes
vars_files: duplicacy-vars.yml
tasks:
- name: Create duplicacy directory
file:
path: ~/duplicacy
state: directory
- name: Copy README
copy:
src: files/README_duplicacy.md
dest: ~/duplicacy/README.md
- name: Copy GCD key
copy:
src: "{{ gcd_key }}"
dest: ~/duplicacy/key.json
mode: u=r,go=
- name: Copy backup script
copy:
src: files/duplicacy-backup.sh
dest: /usr/local/bin/duplicacy-cron.sh
mode: a+x
become: yes
# This is useful for more limited setups
# - name: Symlink directories to backup
# file:
# src: "{{ item.src }}"
# dest: "~/duplicacy/{{ item.dest }}"
# state: link
# with_items:
# - "{{ backup_dirs }}"
- name: Initialize backup repo
shell:
cmd: "duplicacy init {{ ansible_hostname }} '{{ backup_location }}' -repository /"
chdir: ~/duplicacy
stdin: "./key.json\n"
- name: Make key persistant
command:
cmd: "duplicacy set -key gcd_token -value ./key.json"
chdir: ~/duplicacy
- name: Install filters
copy:
src: files/duplicacy_filters
dest: ~/duplicacy/.duplicacy/filters
- name: Install crontab
cron:
name: "Create duplicacy backup"
minute: 0
hour: 4
job: "/usr/local/bin/duplicacy-cron.sh > /tmp/duplicacy-backup.log 2>&1"
become: yes
# - name: Run first backup
# command:
# cmd: "duplicacy backup -t ansible-init"
# chdir: ~/duplicacy