# SPDX-FileCopyrightText: 2026 Slavi Pantaleev # # SPDX-License-Identifier: AGPL-3.0-or-later --- - name: Prepare matrix-livekit-jwt-service Molecule tests hosts: all become: true vars_files: - "{{ lookup('env', 'MOLECULE_PROJECT_DIRECTORY') }}/../../../molecule-shared/vars.yml" - "{{ lookup('env', 'MOLECULE_PROJECT_DIRECTORY') }}/../../../molecule-shared/playbook-context.yml" gather_facts: true tasks: - name: Ensure apt cache is updated ansible.builtin.apt: update_cache: true cache_valid_time: 600 when: ansible_facts['os_family'] == 'Debian' - name: Ensure required packages are installed ansible.builtin.package: name: - python3-requests - fuse-overlayfs - openssl state: present - name: Ensure Docker is installed ansible.builtin.include_role: name: ansible-role-docker vars: docker_daemon_options: storage-driver: fuse-overlayfs - name: Ensure the matrix group exists ansible.builtin.group: name: "{{ matrix_group_name }}" gid: "{{ matrix_user_gid }}" state: present - name: Ensure the matrix user exists ansible.builtin.user: name: "{{ matrix_user_name }}" uid: "{{ matrix_user_uid }}" group: "{{ matrix_group_name }}" create_home: false system: true state: present - name: Ensure the base data path exists ansible.builtin.file: path: "{{ matrix_base_data_path }}" state: directory owner: "{{ matrix_user_name }}" group: "{{ matrix_group_name }}" mode: "0750" - name: Ensure the OpenID fixture directory exists ansible.builtin.file: path: /matrix/molecule-livekit-openid-fixture state: directory mode: "0755" - name: Install the OpenID fixture server ansible.builtin.copy: src: openid-fixture.py dest: /matrix/molecule-livekit-openid-fixture/openid-fixture.py mode: "0644" - name: Generate a self-signed certificate for the OpenID fixture ansible.builtin.command: argv: - openssl - req - -x509 - -newkey - rsa:2048 - -nodes - -keyout - /matrix/molecule-livekit-openid-fixture/key.pem - -out - /matrix/molecule-livekit-openid-fixture/cert.pem - -days - "2" - -subj - /CN=matrix-openid-fixture creates: /matrix/molecule-livekit-openid-fixture/key.pem - name: Ensure the scenario container network exists ansible.builtin.command: argv: - docker - network - create - "{{ matrix_livekit_jwt_service_container_network }}" register: matrix_livekit_jwt_service_molecule_network changed_when: matrix_livekit_jwt_service_molecule_network.rc == 0 failed_when: - matrix_livekit_jwt_service_molecule_network.rc != 0 - "'already exists' not in matrix_livekit_jwt_service_molecule_network.stderr" - name: Ensure the HTTPS OpenID fixture is running community.docker.docker_container: name: matrix-livekit-jwt-openid-fixture image: "{{ molecule_shared_image_python }}" pull: always command: - python3 - /fixture/openid-fixture.py mounts: - source: /matrix/molecule-livekit-openid-fixture target: /fixture type: bind read_only: true networks: - name: "{{ matrix_livekit_jwt_service_container_network }}" aliases: - matrix-openid-fixture comparisons: networks: strict state: started