Matrix Docker Ansible eploy
Du kannst nicht mehr als 25 Themen auswählen Themen müssen entweder mit einem Buchstaben oder einer Ziffer beginnen. Sie können Bindestriche („-“) enthalten und bis zu 35 Zeichen lang sein.
 
 

106 Zeilen
3.2 KiB

  1. - name: Ensure matrix-backup.service is installed
  2. template:
  3. src: "{{ role_path }}/templates/systemd/{{ item }}.j2"
  4. dest: "{{ matrix_systemd_path }}/{{ item }}"
  5. mode: 0644
  6. with_items:
  7. - "matrix-backup.service"
  8. register: matrix_backup_service_result
  9. when: matrix_postgres_enabled|bool and matrix_backup_enabled|bool
  10. - name: Ensure systemd reloaded after matrix-backup.service installation
  11. service:
  12. daemon_reload: yes
  13. when: "matrix_postgres_enabled|bool and matrix_backup_service_result.changed"
  14. - name: Ensure matrix backup paths exist
  15. file:
  16. path: "{{ item }}"
  17. state: directory
  18. mode: 0700
  19. owner: "{{ matrix_user_username }}"
  20. group: "{{ matrix_user_groupname }}"
  21. with_items:
  22. - "{{ matrix_backup_base_path }}"
  23. when: matrix_postgres_enabled|bool and matrix_backup_enabled|bool
  24. - name: Ensure matrix backup environment variables file created
  25. template:
  26. src: "{{ role_path }}/templates/{{ item }}.j2"
  27. dest: "{{ matrix_backup_base_path }}/{{ item }}"
  28. mode: 0640
  29. with_items:
  30. - "env-backup"
  31. when: matrix_postgres_enabled|bool and matrix_backup_enabled|bool
  32. - name: Creates a matrix synapse backup cron file under /etc/cron.d
  33. cron:
  34. name: Matrix Backup Service
  35. state: present
  36. day: "{{ matrix_backup_cron_day }}"
  37. minute: "0"
  38. hour: "2"
  39. user: root
  40. job: "systemctl start matrix-backup.service"
  41. cron_file: matrix-backup
  42. #
  43. # Tasks related to removing matrix-backup (if it was previously enabled)
  44. #
  45. - name: Check existence of matrix-backup service
  46. stat:
  47. path: "{{ matrix_systemd_path }}/matrix-backup.service"
  48. register: matrix_backup_service_stat
  49. when: "not matrix_postgres_enabled|bool or not matrix_backup_enabled|bool"
  50. - name: Ensure matrix-backup is stopped
  51. service:
  52. name: matrix-backup
  53. state: stopped
  54. daemon_reload: yes
  55. when:
  56. - (not matrix_postgres_enabled|bool or not matrix_backup_enabled|bool)
  57. - matrix_backup_service_stat.stat.exists|bool
  58. - name: Ensure matrix-backup.service doesn't exist
  59. file:
  60. path: "{{ matrix_systemd_path }}/{{ item }}"
  61. state: absent
  62. with_items:
  63. - "matrix-backup.service"
  64. when:
  65. - (not matrix_postgres_enabled|bool or not matrix_backup_enabled|bool)
  66. - matrix_backup_service_stat.stat.exists|bool
  67. - name: Ensure matrix-backup cronjob removed
  68. cron:
  69. name: Matrix Backup Service
  70. user: root
  71. cron_file: matrix-backup
  72. state: absent
  73. when:
  74. - (not matrix_postgres_enabled|bool or not matrix_backup_enabled|bool)
  75. - matrix_backup_service_stat.stat.exists|bool
  76. - name: Ensure matrix backup environment file doesn't exist
  77. file:
  78. path: "{{ matrix_backup_base_path }}"
  79. state: absent
  80. when:
  81. - (not matrix_postgres_enabled|bool or not matrix_backup_enabled|bool)
  82. - matrix_backup_service_stat.stat.exists|bool
  83. - name: Ensure systemd reloaded after matrix-backup timer
  84. service:
  85. daemon_reload: yes
  86. when:
  87. - (not matrix_postgres_enabled|bool or not matrix_backup_enabled|bool)
  88. - matrix_backup_service_stat.stat.exists|bool
  89. - name: Ensure awscli Docker image doesn't exist
  90. docker_image:
  91. name: "{{ matrix_backup_awscli_docker_image }}"
  92. state: absent
  93. when: "not matrix_postgres_enabled|bool or not matrix_backup_enabled|bool"