Matrix Docker Ansible eploy
Du kannst nicht mehr als 25 Themen auswählen Themen müssen entweder mit einem Buchstaben oder einer Ziffer beginnen. Sie können Bindestriche („-“) enthalten und bis zu 35 Zeichen lang sein.
 
 

51 Zeilen
2.2 KiB

  1. # SPDX-FileCopyrightText: 2026 Slavi Pantaleev
  2. #
  3. # SPDX-License-Identifier: AGPL-3.0-or-later
  4. ---
  5. # Makes the declared bot list authoritative: anything Meowlnir still knows about but which is no longer declared gets removed.
  6. # Meowlnir's own records are re-read first, because the provisioning that just ran will have changed them.
  7. - name: Re-read Meowlnir's bots before pruning
  8. ansible.builtin.include_tasks: "{{ role_path }}/tasks/util/read_meowlnir_state.yml"
  9. - name: Determine which Meowlnir bots are no longer declared
  10. ansible.builtin.set_fact:
  11. matrix_bot_meowlnir_undeclared_bots: >-
  12. {{
  13. matrix_bot_meowlnir_live_bots
  14. | rejectattr('username', 'in', matrix_bot_meowlnir_bots | map(attribute='username') | list)
  15. | list
  16. }}
  17. - name: Fail if pruning would remove every Meowlnir bot
  18. ansible.builtin.fail:
  19. msg: >-
  20. No bots are declared in `matrix_bot_meowlnir_bots`, but Meowlnir still has
  21. {{ matrix_bot_meowlnir_undeclared_bots | length }} of them
  22. ({{ matrix_bot_meowlnir_undeclared_bots | map(attribute='username') | join(', ') }}).
  23. Removing them would make Meowlnir forget them along with their management rooms, so the
  24. playbook will not act on what is far more often a mistake (a commented-out block, an
  25. unset variable) than an instruction.
  26. If you really do want them all gone, set
  27. `matrix_bot_meowlnir_bots_pruning_on_empty_roster_enabled: true`.
  28. To stop the playbook managing bots at all, set
  29. `matrix_bot_meowlnir_bots_pruning_enabled: false`.
  30. when: >-
  31. matrix_bot_meowlnir_bots | length == 0
  32. and matrix_bot_meowlnir_undeclared_bots | length > 0
  33. and not matrix_bot_meowlnir_bots_pruning_on_empty_roster_enabled | bool
  34. - name: Remove management rooms which are no longer declared
  35. ansible.builtin.include_tasks: "{{ role_path }}/tasks/util/prune_bot_management_rooms.yml"
  36. with_items: "{{ matrix_bot_meowlnir_live_bots }}"
  37. loop_control:
  38. loop_var: live_bot
  39. - name: Remove Meowlnir bots which are no longer declared
  40. ansible.builtin.include_tasks: "{{ role_path }}/tasks/util/prune_bot.yml"
  41. with_items: "{{ matrix_bot_meowlnir_undeclared_bots }}"
  42. loop_control:
  43. loop_var: live_bot