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

91 строка
3.6 KiB

  1. # SPDX-FileCopyrightText: 2026 Slavi Pantaleev
  2. #
  3. # SPDX-License-Identifier: AGPL-3.0-or-later
  4. ---
  5. - name: Prepare mautrix-telegram Molecule tests
  6. hosts: all
  7. become: true
  8. vars_files:
  9. - "{{ lookup('env', 'MOLECULE_PROJECT_DIRECTORY') }}/../../../molecule-shared/vars.yml"
  10. - "{{ lookup('env', 'MOLECULE_PROJECT_DIRECTORY') }}/../../../molecule-shared/playbook-context.yml"
  11. gather_facts: true
  12. tasks:
  13. - name: Ensure apt cache is updated
  14. ansible.builtin.apt:
  15. update_cache: true
  16. cache_valid_time: 600
  17. when: ansible_os_family == 'Debian'
  18. - name: Ensure required packages are installed
  19. ansible.builtin.package:
  20. name:
  21. - python3-requests
  22. - fuse-overlayfs
  23. state: present
  24. - name: Ensure Docker is installed
  25. ansible.builtin.include_role:
  26. name: ansible-role-docker
  27. vars:
  28. docker_daemon_options:
  29. storage-driver: fuse-overlayfs
  30. # The role's file tasks resolve the owner/group by name. matrix-base creates them
  31. # in a full playbook run, so the scenario supplies that small piece of context.
  32. - name: Ensure the matrix group exists
  33. ansible.builtin.group:
  34. name: "{{ matrix_group_name }}"
  35. gid: "{{ matrix_user_gid }}"
  36. state: present
  37. - name: Ensure the matrix user exists
  38. ansible.builtin.user:
  39. name: "{{ matrix_user_name }}"
  40. uid: "{{ matrix_user_uid }}"
  41. group: "{{ matrix_group_name }}"
  42. create_home: false
  43. system: true
  44. state: present
  45. - name: Ensure the base data path exists
  46. ansible.builtin.file:
  47. path: "{{ matrix_base_data_path }}"
  48. state: directory
  49. owner: "{{ matrix_user_name }}"
  50. group: "{{ matrix_group_name }}"
  51. mode: "0750"
  52. # The dependencies must attach before converge asks the role to create the same network.
  53. - name: Ensure the container network the role attaches to exists
  54. ansible.builtin.command:
  55. argv:
  56. - docker
  57. - network
  58. - create
  59. - "{{ matrix_bridge_mautrix_telegram_container_network }}"
  60. register: mautrix_telegram_molecule_network
  61. changed_when: mautrix_telegram_molecule_network.rc == 0
  62. failed_when:
  63. - mautrix_telegram_molecule_network.rc != 0
  64. - "'already exists' not in mautrix_telegram_molecule_network.stderr"
  65. - name: Ensure Postgres is running
  66. ansible.builtin.include_tasks:
  67. file: "{{ lookup('env', 'MOLECULE_PROJECT_DIRECTORY') }}/../../../molecule-shared/tasks/postgres.yml"
  68. vars:
  69. molecule_shared_postgres_network: "{{ matrix_bridge_mautrix_telegram_container_network }}"
  70. molecule_shared_postgres_database: "{{ matrix_bridge_mautrix_telegram_database_name }}"
  71. molecule_shared_postgres_username: "{{ matrix_bridge_mautrix_telegram_database_username }}"
  72. molecule_shared_postgres_password: "{{ matrix_bridge_mautrix_telegram_database_password }}"
  73. # The bridge calls /whoami before opening its appservice listener. This proves the
  74. # Matrix-side startup only; no Telegram login or real external credential is involved.
  75. - name: Ensure the homeserver stub is running
  76. ansible.builtin.include_tasks:
  77. file: "{{ lookup('env', 'MOLECULE_PROJECT_DIRECTORY') }}/../../../molecule-shared/tasks/homeserver-stub.yml"
  78. vars:
  79. molecule_shared_stub_network: "{{ matrix_bridge_mautrix_telegram_container_network }}"
  80. molecule_shared_stub_server_name: "{{ matrix_bridge_mautrix_telegram_homeserver_domain }}"
  81. molecule_shared_stub_user_id: "@{{ matrix_bridge_mautrix_telegram_appservice_bot_username }}:{{ matrix_bridge_mautrix_telegram_homeserver_domain }}"