-
Notifications
You must be signed in to change notification settings - Fork 826
/
tarsnap.yml
87 lines (72 loc) · 2.81 KB
/
tarsnap.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
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
- name: Check if Tarsnap {{ tarsnap_version }} is installed
shell: tarsnap --version | grep {{ tarsnap_version }} --color=never
register: tarsnap_installed
changed_when: tarsnap_installed.rc != 0
ignore_errors: yes
tags:
- dependencies
- name: Install dependencies for Tarsnap
when: tarsnap_installed is failed
apt: pkg={{ item }} state=present
with_items:
- e2fslibs-dev
- libssl-dev
- zlib1g-dev
tags:
- dependencies
- name: Download the current tarsnap code signing key
when: tarsnap_installed is failed
get_url:
url=https://www.tarsnap.com/tarsnap-signing-key.asc
dest=/root/tarsnap-signing-key.asc
- name: Add the tarsnap code signing key to your list of keys
when: tarsnap_installed is failed
command:
gpg --import tarsnap-signing-key.asc
chdir=/root/
- name: Download tarsnap SHA file
when: tarsnap_installed is failed
get_url:
url="https://www.tarsnap.com/download/tarsnap-sigs-{{ tarsnap_version }}.asc"
dest="/root/tarsnap-sigs-{{ tarsnap_version }}.asc"
- name: Make the command that gets the current SHA
when: tarsnap_installed is failed
template:
src=getSha.sh
dest=/root/getSha.sh
mode=0755
- name: Get the SHA256sum for this tarsnap release
when: tarsnap_installed is failed
command:
./getSha.sh
chdir=/root
register: tarsnap_sha
- name: Download Tarsnap source
when: tarsnap_installed is failed
get_url:
url="https://www.tarsnap.com/download/tarsnap-autoconf-{{ tarsnap_version }}.tgz"
dest="/root/tarsnap-autoconf-{{ tarsnap_version }}.tgz"
sha256sum={{ tarsnap_sha.stdout_lines[0] }}
- name: Decompress Tarsnap source
when: tarsnap_installed is failed
unarchive: src=/root/tarsnap-autoconf-{{ tarsnap_version }}.tgz
dest=/root copy=no
creates=/root/tarsnap-autoconf-{{ tarsnap_version }}/COPYING
- name: Configure Tarsnap for local build
when: tarsnap_installed is failed
command: >-
./configure chdir=/root/tarsnap-autoconf-{{ tarsnap_version }}
creates=/root/tarsnap-autoconf-{{ tarsnap_version }}/Makefile
- name: Build and install Tarsnap
when: tarsnap_installed is failed
command: make all install clean chdir=/root/tarsnap-autoconf-{{ tarsnap_version }} creates=/usr/local/bin/tarsnap
- name: Copy Tarsnap key file into place
copy: src=decrypted_tarsnap.key dest=/decrypted/tarsnap.key owner=root group=root mode="0600" force=no
- name: Create Tarsnap cache directory
file: state=directory path=/usr/tarsnap-cache
- name: Install Tarsnap configuration file
copy: src=tarsnaprc dest=/root/.tarsnaprc mode="0644"
- name: Install Tarsnap backup handler script
copy: src=tarsnap.sh dest=/root/tarsnap.sh mode="0755"
- name: Install nightly Tarsnap-generations cronjob
cron: name="Tarsnap backup" hour="3" minute="0" job="sh /root/tarsnap.sh >> /var/log/tarsnap.log"