mirror of
https://github.com/spantaleev/matrix-docker-ansible-deploy.git
synced 2026-08-21 00:00:53 +00:00
d839e45548
The homeserver only reads appservice registrations on startup, and the playbook only restarts it at the very end of a run. On the run which first enables Meowlnir, bot provisioning therefore talked to a homeserver still running without Meowlnir's registration, hitting M_UNKNOWN_TOKEN and hanging indefinitely. Provisioning now verifies the token upfront and restarts the homeserver itself when needed, so a single run completes even when Meowlnir was just enabled. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
39 lines
1.7 KiB
YAML
39 lines
1.7 KiB
YAML
# SPDX-FileCopyrightText: 2026 Slavi Pantaleev
|
|
#
|
|
# SPDX-License-Identifier: AGPL-3.0-or-later
|
|
|
|
---
|
|
|
|
# Validation lives in validate_config.yml so that it also runs on regular setup/install runs, catching mistakes long before anyone reaches for the `ensure-matrix-users-created` tag.
|
|
# It is repeated here because this tag can be run on its own, and creating a bot outside the appservice's user namespace fails in ways that are hard to trace back.
|
|
- name: Validate matrix-bot-meowlnir configuration before creating bots
|
|
ansible.builtin.include_tasks: "{{ role_path }}/tasks/validate_config.yml"
|
|
|
|
- name: Ensure matrix-bot-meowlnir is started before creating bots
|
|
ansible.builtin.service:
|
|
name: matrix-bot-meowlnir.service
|
|
state: started
|
|
daemon_reload: true
|
|
register: matrix_bot_meowlnir_start_result
|
|
|
|
- name: Wait a while, so that Meowlnir can manage to start before creating bots
|
|
ansible.builtin.pause:
|
|
seconds: "{{ matrix_bot_meowlnir_bots_start_wait_time_seconds }}"
|
|
when: matrix_bot_meowlnir_start_result.changed | bool
|
|
|
|
- name: Ensure the homeserver accepts Meowlnir's appservice token before creating bots
|
|
ansible.builtin.include_tasks: "{{ role_path }}/tasks/util/ensure_appservice_token_accepted.yml"
|
|
|
|
- name: Read which bots Meowlnir already has
|
|
ansible.builtin.include_tasks: "{{ role_path }}/tasks/util/read_meowlnir_state.yml"
|
|
|
|
- name: Ensure Meowlnir bots created
|
|
ansible.builtin.include_tasks: "{{ role_path }}/tasks/util/ensure_bot_created.yml"
|
|
with_items: "{{ matrix_bot_meowlnir_bots }}"
|
|
loop_control:
|
|
loop_var: bot
|
|
|
|
- name: Remove Meowlnir bots which are no longer declared
|
|
ansible.builtin.include_tasks: "{{ role_path }}/tasks/util/prune_bots.yml"
|
|
when: matrix_bot_meowlnir_bots_pruning_enabled | bool
|