Matrix Docker Ansible eploy
Вы не можете выбрать более 25 тем Темы должны начинаться с буквы или цифры, могут содержать дефисы(-) и должны содержать не более 35 символов.

72 строки
2.7 KiB

  1. ---
  2. - name: Ensure AppService Slack paths exist
  3. file:
  4. path: "{{ item }}"
  5. state: directory
  6. mode: 0750
  7. owner: "{{ matrix_user_username }}"
  8. group: "{{ matrix_user_groupname }}"
  9. with_items:
  10. - "{{ matrix_appservice_slack_base_path }}"
  11. - "{{ matrix_appservice_slack_config_path }}"
  12. - "{{ matrix_appservice_slack_data_path }}"
  13. - set_fact:
  14. matrix_appservice_slack_requires_restart: false
  15. - block:
  16. - name: Check if a nedb database already exists
  17. stat:
  18. path: "{{ matrix_appservice_slack_data_path }}/teams.db"
  19. register: matrix_appservice_slack_nedb_database_path_local_stat_result
  20. - block:
  21. - import_tasks: "{{ role_path }}/tasks/migrate_nedb_to_postgres.yml"
  22. - set_fact:
  23. matrix_appservice_slack_requires_restart: true
  24. when: "matrix_appservice_slack_nedb_database_path_local_stat_result.stat.exists|bool"
  25. when: "matrix_appservice_slack_database_engine == 'postgres'"
  26. - name: Ensure Appservice Slack image is pulled
  27. docker_image:
  28. name: "{{ matrix_appservice_slack_docker_image }}"
  29. source: "{{ 'pull' if ansible_version.major > 2 or ansible_version.minor > 7 else omit }}"
  30. force_source: "{{ matrix_appservice_slack_docker_image_force_pull if ansible_version.major > 2 or ansible_version.minor >= 8 else omit }}"
  31. force: "{{ omit if ansible_version.major > 2 or ansible_version.minor >= 8 else matrix_appservice_slack_docker_image_force_pull }}"
  32. - name: Ensure Matrix Appservice Slack config installed
  33. copy:
  34. content: "{{ matrix_appservice_slack_configuration|to_nice_yaml }}"
  35. dest: "{{ matrix_appservice_slack_config_path }}/config.yaml"
  36. mode: 0644
  37. owner: "{{ matrix_user_username }}"
  38. group: "{{ matrix_user_groupname }}"
  39. - name: Ensure appservice-slack registration.yaml installed
  40. copy:
  41. content: "{{ matrix_appservice_slack_registration|to_nice_yaml }}"
  42. dest: "{{ matrix_appservice_slack_config_path }}/slack-registration.yaml"
  43. mode: 0644
  44. owner: "{{ matrix_user_username }}"
  45. group: "{{ matrix_user_groupname }}"
  46. - name: Ensure matrix-appservice-slack.service installed
  47. template:
  48. src: "{{ role_path }}/templates/systemd/matrix-appservice-slack.service.j2"
  49. dest: "{{ matrix_systemd_path }}/matrix-appservice-slack.service"
  50. mode: 0644
  51. register: matrix_appservice_slack_systemd_service_result
  52. - name: Ensure systemd reloaded after matrix-appservice-slack.service installation
  53. service:
  54. daemon_reload: yes
  55. when: "matrix_appservice_slack_systemd_service_result.changed"
  56. - name: Ensure matrix-appservice-slack.service restarted, if necessary
  57. service:
  58. name: "matrix-appservice-slack.service"
  59. state: restarted
  60. when: "matrix_appservice_slack_requires_restart|bool"