暫無描述
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.7KB

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