Matrix Docker Ansible eploy
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.
 
 

64 lines
1.7 KiB

  1. ---
  2. - name: Ensure Matrix group is created
  3. group:
  4. name: "{{ matrix_user_username }}"
  5. gid: "{{ matrix_user_gid }}"
  6. state: present
  7. - name: Ensure Matrix user is created
  8. user:
  9. name: "{{ matrix_user_username }}"
  10. uid: "{{ matrix_user_uid }}"
  11. state: present
  12. group: "{{ matrix_user_username }}"
  13. - name: Ensure environment variables data path exists
  14. file:
  15. path: "{{ matrix_environment_variables_data_path }}"
  16. state: directory
  17. mode: 0700
  18. - name: Ensure Matrix base path exists
  19. file:
  20. path: "{{ item }}"
  21. state: directory
  22. mode: 0750
  23. owner: "{{ matrix_user_username }}"
  24. group: "{{ matrix_user_username }}"
  25. with_items:
  26. - "{{ matrix_base_data_path }}"
  27. - "{{ matrix_synapse_base_path }}"
  28. # `docker_network` doesn't work as expected when the given network
  29. # is a substring of a network that already exists.
  30. #
  31. # See:
  32. # - https://github.com/spantaleev/matrix-docker-ansible-deploy/issues/12
  33. # - https://github.com/ansible/ansible/issues/32926
  34. #
  35. # Due to that, we employ a workaround below.
  36. #
  37. # - name: Ensure Matrix network is created in Docker
  38. # docker_network:
  39. # name: "{{ matrix_docker_network }}"
  40. # driver: bridge
  41. - name: Check existence of Matrix network in Docker
  42. shell:
  43. cmd: "docker network ls -q --filter='name=^{{ matrix_docker_network }}$'"
  44. register: result_check_docker_network
  45. changed_when: false
  46. - name: Create Matrix network in Docker
  47. shell:
  48. cmd: "docker network create --driver=bridge {{ matrix_docker_network }}"
  49. when: "result_check_docker_network.stdout == ''"
  50. - name: Ensure matrix-remove-all script created
  51. template:
  52. src: "{{ role_path }}/templates/usr-local-bin/matrix-remove-all.j2"
  53. dest: "/usr/local/bin/matrix-remove-all"
  54. mode: 0750