12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485 |
- - name: Check if tarsnap {{ tarsnap_version }} is installed
- shell: tarsnap --version | grep {{ tarsnap_version }} --color=never
- register: tarsnap_installed
- changed_when: "tarsnap_installed.stderr != ''"
- ignore_errors: yes
- tags:
- - dependencies
-
- - name: Install dependencies for Tarsnap
- when: tarsnap_installed|failed
- apt: pkg={{ item }} state=installed
- with_items:
- - e2fslibs-dev
- - libssl-dev
- - zlib1g-dev
- tags:
- - dependencies
-
- - name: Download the current tarsnap code signing key
- when: tarsnap_installed|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|failed
- command:
- gpg --import tarsnap-signing-key.asc
- chdir=/root/
-
- - name: Download tarsnap SHA file
- when: tarsnap_installed|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|failed
- template:
- src=getSha.sh
- dest=/root/getSha.sh
- mode=0755
-
- - name: get the SHA256sum for this tarsnap release
- when: tarsnap_installed|failed
- command:
- ./getSha.sh
- chdir=/root
- register: tarsnap_sha
-
- - name: Download Tarsnap source
- when: tarsnap_installed|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|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|failed
- command: ./configure chdir=/root/tarsnap-autoconf-{{ tarsnap_version }} creates=/root/tarsnap-autoconf-{{ tarsnap_version }}/Makefile
-
- - name: Build and install Tarsnap
- when: tarsnap_installed|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="600" 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="644"
-
- - name: Install Tarsnap backup handler script
- copy: src=tarsnap.sh dest=/root/tarsnap.sh mode="755"
-
- - name: Install nightly Tarsnap-generations cronjob
- cron: name="Tarsnap backup" hour="3" minute="0" job="sh /root/tarsnap.sh >> /var/log/tarsnap.log"
|