Matrix Docker Ansible eploy
Non puoi selezionare più di 25 argomenti Gli argomenti devono iniziare con una lettera o un numero, possono includere trattini ('-') e possono essere lunghi fino a 35 caratteri.
 
 

82 righe
3.4 KiB

  1. ---
  2. - name: Ensure cactus comments paths exist
  3. ansible.builtin.file:
  4. path: "{{ item.path }}"
  5. state: directory
  6. mode: 0750
  7. owner: "{{ matrix_user_username }}"
  8. group: "{{ matrix_user_groupname }}"
  9. with_items:
  10. - {path: "{{ matrix_cactus_comments_base_path }}", when: true}
  11. - {path: "{{ matrix_cactus_comments_docker_src_files_path }}", when: true}
  12. when: "item.when | bool"
  13. - name: Ensure cactus comments environment file created
  14. ansible.builtin.template:
  15. src: "{{ role_path }}/templates/env.j2"
  16. dest: "{{ matrix_cactus_comments_app_service_env_file }}"
  17. owner: "{{ matrix_user_username }}"
  18. group: "{{ matrix_user_groupname }}"
  19. mode: 0640
  20. - name: Ensure cactus comments appservice file created
  21. ansible.builtin.template:
  22. src: "{{ role_path }}/templates/cactus_appservice.yaml.j2"
  23. dest: "{{ matrix_cactus_comments_app_service_config_file }}"
  24. owner: "{{ matrix_user_username }}"
  25. group: "{{ matrix_user_groupname }}"
  26. mode: 0640
  27. - name: Ensure cactus comments image is pulled
  28. docker_image:
  29. name: "{{ matrix_cactus_comments_docker_image }}"
  30. source: "{{ 'pull' if ansible_version.major > 2 or ansible_version.minor > 7 else omit }}"
  31. force_source: "{{ matrix_cactus_comments_docker_image_force_pull if ansible_version.major > 2 or ansible_version.minor >= 8 else omit }}"
  32. force: "{{ omit if ansible_version.major > 2 or ansible_version.minor >= 8 else matrix_cactus_comments_docker_image_force_pull }}"
  33. when: "not matrix_cactus_comments_container_image_self_build | bool"
  34. register: result
  35. retries: "{{ matrix_container_retries_count }}"
  36. delay: "{{ matrix_container_retries_delay }}"
  37. until: result is not failed
  38. - name: Ensure cactus comments repository is present on self-build
  39. ansible.builtin.git:
  40. repo: "{{ matrix_cactus_comments_docker_repo }}"
  41. version: "{{ matrix_cactus_comments_docker_repo_version }}"
  42. dest: "{{ matrix_cactus_comments_docker_src_files_path }}"
  43. force: "yes"
  44. become: true
  45. become_user: "{{ matrix_user_username }}"
  46. register: matrix_cactus_comments_git_pull_results
  47. when: "matrix_cactus_comments_container_image_self_build | bool"
  48. - name: Ensure cactus comments image is built
  49. docker_image:
  50. name: "{{ matrix_cactus_comments_docker_image }}"
  51. source: build
  52. force_source: "{{ matrix_cactus_comments_git_pull_results.changed if ansible_version.major > 2 or ansible_version.minor >= 8 else omit }}"
  53. force: "{{ omit if ansible_version.major > 2 or ansible_version.minor >= 8 else matrix_mailer_git_pull_results.changed }}"
  54. build:
  55. dockerfile: Dockerfile
  56. path: "{{ matrix_cactus_comments_docker_src_files_path }}"
  57. pull: true
  58. when: "matrix_cactus_comments_container_image_self_build | bool"
  59. - name: Ensure matrix-cactus-comments.service installed
  60. ansible.builtin.template:
  61. src: "{{ role_path }}/templates/systemd/matrix-cactus-comments.service.j2"
  62. dest: "{{ matrix_systemd_path }}/matrix-cactus-comments.service"
  63. mode: 0644
  64. register: matrix_cactus_comments_systemd_service_result
  65. - name: Ensure systemd reloaded after matrix-cactus-comments.service installation
  66. ansible.builtin.service:
  67. daemon_reload: true
  68. when: "matrix_cactus_comments_systemd_service_result.changed | bool"
  69. - name: Ensure matrix-cactus-comments.service restarted, if necessary
  70. ansible.builtin.service:
  71. name: "matrix-cactus-comments.service"
  72. state: restarted