Matrix Docker Ansible eploy
您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符
 
 

87 行
3.8 KiB

  1. # SPDX-FileCopyrightText: 2023 - 2024 Nikita Chernyi
  2. # SPDX-FileCopyrightText: 2023 - 2024 Slavi Pantaleev
  3. # SPDX-FileCopyrightText: 2024 Suguru Hirahara
  4. #
  5. # SPDX-License-Identifier: AGPL-3.0-or-later
  6. # Shows help
  7. default:
  8. @{{ just_executable() }} --list --justfile "{{ justfile() }}"
  9. # Pulls external Ansible roles
  10. roles:
  11. #!/usr/bin/env sh
  12. echo "[NOTE] This command just updates the roles, but if you want to update everything at once (playbook, roles, etc.) - use 'just update'"
  13. if [ -x "$(command -v agru)" ]; then
  14. agru
  15. else
  16. rm -rf roles/galaxy
  17. ansible-galaxy install -r requirements.yml -p roles/galaxy/ --force
  18. fi
  19. # Updates the playbook and installs the necessary Ansible roles pinned in requirements.yml. If a -u flag is passed, also updates the requirements.yml file with new role versions (if available)
  20. update *flags: update-playbook-only
  21. #!/usr/bin/env sh
  22. if [ -x "$(command -v agru)" ]; then
  23. echo {{ if flags == "" { "Installing roles pinned in requirements.yml…" } else { if flags == "-u" { "Updating roles and pinning new versions in requirements.yml…" } else { "Unknown flags passed" } } }}
  24. agru {{ flags }}
  25. else
  26. echo "[NOTE] You are using the standard ansible-galaxy tool to install roles, which is slow and lacks other features. We recommend installing the 'agru' tool to speed up the process: https://github.com/etkecc/agru#where-to-get"
  27. echo "Installing roles…"
  28. rm -rf roles/galaxy
  29. ansible-galaxy install -r requirements.yml -p roles/galaxy/ --force
  30. fi
  31. # Updates the playbook without installing/updating Ansible roles
  32. update-playbook-only:
  33. @echo "Updating playbook…"
  34. @git stash -q
  35. @git pull -q
  36. @-git stash pop -q
  37. # Runs ansible-lint against all roles in the playbook
  38. lint:
  39. ansible-lint
  40. # Runs the playbook with --tags=install-all,ensure-matrix-users-created,start and optional arguments
  41. install-all *extra_args: (run-tags "install-all,ensure-matrix-users-created,start" extra_args)
  42. # Runs installation tasks for a single service
  43. install-service service *extra_args:
  44. {{ just_executable() }} --justfile "{{ justfile() }}" run \
  45. --tags=install-{{ service }},start-group \
  46. --extra-vars=group={{ service }} {{ extra_args }}
  47. # Runs the playbook with --tags=setup-all,ensure-matrix-users-created,start and optional arguments
  48. setup-all *extra_args: (run-tags "setup-all,ensure-matrix-users-created,start" extra_args)
  49. # Runs the playbook with the given list of arguments
  50. run +extra_args:
  51. ansible-playbook -i inventory/hosts setup.yml {{ extra_args }}
  52. # Runs the playbook with the given list of comma-separated tags and optional arguments
  53. run-tags tags *extra_args:
  54. {{ just_executable() }} --justfile "{{ justfile() }}" run --tags={{ tags }} {{ extra_args }}
  55. # Runs the playbook in user-registration mode
  56. register-user username password admin_yes_or_no *extra_args:
  57. ansible-playbook -i inventory/hosts setup.yml --tags=register-user --extra-vars="username={{ username }} password={{ password }} admin={{ admin_yes_or_no }}" {{ extra_args }}
  58. # Starts all services
  59. start-all *extra_args: (run-tags "start-all" extra_args)
  60. # Starts a specific service group
  61. start-group group *extra_args:
  62. @{{ just_executable() }} --justfile "{{ justfile() }}" run-tags start-group --extra-vars="group={{ group }}" {{ extra_args }}
  63. # Stops all services
  64. stop-all *extra_args: (run-tags "stop-all" extra_args)
  65. # Stops a specific service group
  66. stop-group group *extra_args:
  67. @{{ just_executable() }} --justfile "{{ justfile() }}" run-tags stop-group --extra-vars="group={{ group }}" {{ extra_args }}
  68. # Rebuilds the mautrix-meta-instagram Ansible role using the mautrix-meta-messenger role as a source
  69. rebuild-mautrix-meta-instagram:
  70. /bin/bash "{{ justfile_directory() }}/bin/rebuild-mautrix-meta-instagram.sh" "{{ justfile_directory() }}/roles/custom"