mirror of
https://github.com/spantaleev/matrix-docker-ansible-deploy.git
synced 2026-08-29 20:13:13 +00:00
They were hard-wrapped at 80 characters, broke mid-parenthesis, and spent lines restating what the code below them does. Rewrapped at natural boundaries instead, with the narration dropped and only the reasons, gotchas and surprises kept. Section dividers stay - they delineate long plays rather than narrate them. Comments only; no scenario behaviour changes. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01SEH3vxYSQ5SV4N5z61eyGT
84 lines
3.0 KiB
YAML
84 lines
3.0 KiB
YAML
# SPDX-FileCopyrightText: 2026 Slavi Pantaleev
|
|
#
|
|
# SPDX-License-Identifier: AGPL-3.0-or-later
|
|
|
|
---
|
|
- name: Prepare hookshot 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_os_family == 'Debian'
|
|
|
|
- name: Ensure required packages are installed
|
|
ansible.builtin.package:
|
|
name:
|
|
- python3-requests
|
|
- fuse-overlayfs
|
|
state: present
|
|
|
|
- name: Ensure Docker is installed
|
|
ansible.builtin.include_role:
|
|
name: ansible-role-docker
|
|
vars:
|
|
docker_daemon_options:
|
|
storage-driver: fuse-overlayfs
|
|
|
|
# The role's file tasks set owner/group by name, which Ansible resolves through the
|
|
# passwd database, so they have to exist first. `matrix-base` creates them for real.
|
|
- 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 container network the role attaches to exists
|
|
ansible.builtin.command:
|
|
argv:
|
|
- docker
|
|
- network
|
|
- create
|
|
- "{{ matrix_bridge_hookshot_container_network }}"
|
|
register: hookshot_molecule_network
|
|
changed_when: hookshot_molecule_network.rc == 0
|
|
failed_when:
|
|
- hookshot_molecule_network.rc != 0
|
|
- "'already exists' not in hookshot_molecule_network.stderr"
|
|
|
|
# Hookshot contacts the homeserver as it starts, and - being an appservice -
|
|
# refuses to run if /whoami answers with a user other than the bot it was
|
|
# configured as, so the stub is told to claim the localpart the scenario set.
|
|
# It is not being asked to bridge anything, and nothing is asserted about it;
|
|
# see molecule-shared/homeserver-stub.py.
|
|
- name: Ensure the homeserver stub is running
|
|
ansible.builtin.include_tasks:
|
|
file: "{{ lookup('env', 'MOLECULE_PROJECT_DIRECTORY') }}/../../../molecule-shared/tasks/homeserver-stub.yml"
|
|
vars:
|
|
molecule_shared_stub_network: "{{ matrix_bridge_hookshot_container_network }}"
|
|
molecule_shared_stub_server_name: molecule.local
|
|
molecule_shared_stub_user_id: "@{{ matrix_bridge_hookshot_bot_localpart }}:molecule.local"
|