Matrix Docker Ansible eploy
Você não pode selecionar mais de 25 tópicos Os tópicos devem começar com uma letra ou um número, podem incluir traços ('-') e podem ter até 35 caracteres.
 
 
 

84 linhas
3.0 KiB

  1. # SPDX-FileCopyrightText: 2026 Slavi Pantaleev
  2. #
  3. # SPDX-License-Identifier: AGPL-3.0-or-later
  4. ---
  5. - name: Prepare hookshot 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 set owner/group by name, which Ansible resolves through the
  31. # passwd database, so they have to exist first. `matrix-base` creates them for real.
  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. - name: Ensure the container network the role attaches to exists
  53. ansible.builtin.command:
  54. argv:
  55. - docker
  56. - network
  57. - create
  58. - "{{ matrix_bridge_hookshot_container_network }}"
  59. register: hookshot_molecule_network
  60. changed_when: hookshot_molecule_network.rc == 0
  61. failed_when:
  62. - hookshot_molecule_network.rc != 0
  63. - "'already exists' not in hookshot_molecule_network.stderr"
  64. # Hookshot contacts the homeserver as it starts, and - being an appservice -
  65. # refuses to run if /whoami answers with a user other than the bot it was
  66. # configured as, so the stub is told to claim the localpart the scenario set.
  67. # It is not being asked to bridge anything, and nothing is asserted about it;
  68. # see molecule-shared/homeserver-stub.py.
  69. - name: Ensure the homeserver stub is running
  70. ansible.builtin.include_tasks:
  71. file: "{{ lookup('env', 'MOLECULE_PROJECT_DIRECTORY') }}/../../../molecule-shared/tasks/homeserver-stub.yml"
  72. vars:
  73. molecule_shared_stub_network: "{{ matrix_bridge_hookshot_container_network }}"
  74. molecule_shared_stub_server_name: molecule.local
  75. molecule_shared_stub_user_id: "@{{ matrix_bridge_hookshot_bot_localpart }}:molecule.local"