Brak opisu
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

tarsnap.yml 2.8KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  1. - name: Check if Tarsnap {{ tarsnap_version }} is installed
  2. shell: tarsnap --version | grep {{ tarsnap_version }} --color=never
  3. register: tarsnap_installed
  4. changed_when: "tarsnap_installed.stderr != ''"
  5. ignore_errors: yes
  6. tags:
  7. - dependencies
  8. - name: Install dependencies for Tarsnap
  9. when: tarsnap_installed|failed
  10. apt: pkg={{ item }} state=installed
  11. with_items:
  12. - e2fslibs-dev
  13. - libssl-dev
  14. - zlib1g-dev
  15. tags:
  16. - dependencies
  17. - name: Download the current tarsnap code signing key
  18. when: tarsnap_installed|failed
  19. get_url:
  20. url=https://www.tarsnap.com/tarsnap-signing-key.asc
  21. dest=/root/tarsnap-signing-key.asc
  22. - name: Add the tarsnap code signing key to your list of keys
  23. when: tarsnap_installed|failed
  24. command:
  25. gpg --import tarsnap-signing-key.asc
  26. chdir=/root/
  27. - name: Download tarsnap SHA file
  28. when: tarsnap_installed|failed
  29. get_url:
  30. url="https://www.tarsnap.com/download/tarsnap-sigs-{{ tarsnap_version }}.asc"
  31. dest="/root/tarsnap-sigs-{{ tarsnap_version }}.asc"
  32. - name: Make the command that gets the current SHA
  33. when: tarsnap_installed|failed
  34. template:
  35. src=getSha.sh
  36. dest=/root/getSha.sh
  37. mode=0755
  38. - name: Get the SHA256sum for this tarsnap release
  39. when: tarsnap_installed|failed
  40. command:
  41. ./getSha.sh
  42. chdir=/root
  43. register: tarsnap_sha
  44. - name: Download Tarsnap source
  45. when: tarsnap_installed|failed
  46. get_url:
  47. url="https://www.tarsnap.com/download/tarsnap-autoconf-{{ tarsnap_version }}.tgz"
  48. dest="/root/tarsnap-autoconf-{{ tarsnap_version }}.tgz"
  49. sha256sum={{ tarsnap_sha.stdout_lines[0] }}
  50. - name: Decompress Tarsnap source
  51. when: tarsnap_installed|failed
  52. unarchive: src=/root/tarsnap-autoconf-{{ tarsnap_version }}.tgz
  53. dest=/root copy=no
  54. creates=/root/tarsnap-autoconf-{{ tarsnap_version }}/COPYING
  55. - name: Configure Tarsnap for local build
  56. when: tarsnap_installed|failed
  57. command: ./configure chdir=/root/tarsnap-autoconf-{{ tarsnap_version }} creates=/root/tarsnap-autoconf-{{ tarsnap_version }}/Makefile
  58. - name: Build and install Tarsnap
  59. when: tarsnap_installed|failed
  60. command: make all install clean chdir=/root/tarsnap-autoconf-{{ tarsnap_version }} creates=/usr/local/bin/tarsnap
  61. - name: Copy Tarsnap key file into place
  62. copy: src=decrypted_tarsnap.key dest=/decrypted/tarsnap.key owner=root group=root mode="600" force=no
  63. - name: Create Tarsnap cache directory
  64. file: state=directory path=/usr/tarsnap-cache
  65. - name: Install Tarsnap configuration file
  66. copy: src=tarsnaprc dest=/root/.tarsnaprc mode="644"
  67. - name: Install Tarsnap backup handler script
  68. copy: src=tarsnap.sh dest=/root/tarsnap.sh mode="755"
  69. - name: Install nightly Tarsnap-generations cronjob
  70. cron: name="Tarsnap backup" hour="3" minute="0" job="sh /root/tarsnap.sh >> /var/log/tarsnap.log"