Matrix Docker Ansible eploy
Nie możesz wybrać więcej, niż 25 tematów Tematy muszą się zaczynać od litery lub cyfry, mogą zawierać myślniki ('-') i mogą mieć do 35 znaków.
 
 

86 wiersze
3.7 KiB

  1. # SPDX-FileCopyrightText: 2024 MDAD Team and contributors
  2. #
  3. # SPDX-License-Identifier: AGPL-3.0-or-later
  4. # Shows help
  5. default:
  6. @just --list --justfile {{ justfile() }}
  7. # Pulls external Ansible roles
  8. roles:
  9. #!/usr/bin/env sh
  10. echo "[NOTE] This command just updates the roles, but if you want to update everything at once (playbook, roles, etc.) - use 'just update'"
  11. if [ -x "$(command -v agru)" ]; then
  12. agru
  13. else
  14. rm -rf roles/galaxy
  15. ansible-galaxy install -r requirements.yml -p roles/galaxy/ --force
  16. fi
  17. # 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)
  18. update *flags: update-playbook-only
  19. #!/usr/bin/env sh
  20. if [ -x "$(command -v agru)" ]; then
  21. 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" } }}
  22. agru {{ flags }}
  23. else
  24. 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"
  25. echo "Installing roles…"
  26. rm -rf roles/galaxy
  27. ansible-galaxy install -r requirements.yml -p roles/galaxy/ --force
  28. fi
  29. # Updates the playbook without installing/updating Ansible roles
  30. update-playbook-only:
  31. @echo "Updating playbook…"
  32. @git stash -q
  33. @git pull -q
  34. @-git stash pop -q
  35. # Runs ansible-lint against all roles in the playbook
  36. lint:
  37. ansible-lint
  38. # Runs the playbook with --tags=install-all,ensure-matrix-users-created,start and optional arguments
  39. install-all *extra_args: (run-tags "install-all,ensure-matrix-users-created,start" extra_args)
  40. # Runs installation tasks for a single service
  41. install-service service *extra_args:
  42. just --justfile {{ justfile() }} run \
  43. --tags=install-{{ service }},start-group \
  44. --extra-vars=group={{ service }} \
  45. --extra-vars=devture_systemd_service_manager_service_restart_mode=one-by-one {{ extra_args }}
  46. # Runs the playbook with --tags=setup-all,ensure-matrix-users-created,start and optional arguments
  47. setup-all *extra_args: (run-tags "setup-all,ensure-matrix-users-created,start" extra_args)
  48. # Runs the playbook with the given list of arguments
  49. run +extra_args:
  50. ansible-playbook -i inventory/hosts setup.yml {{ extra_args }}
  51. # Runs the playbook with the given list of comma-separated tags and optional arguments
  52. run-tags tags *extra_args:
  53. just --justfile {{ justfile() }} run --tags={{ tags }} {{ extra_args }}
  54. # Runs the playbook in user-registration mode
  55. register-user username password admin_yes_or_no *extra_args:
  56. ansible-playbook -i inventory/hosts setup.yml --tags=register-user --extra-vars="username={{ username }} password={{ password }} admin={{ admin_yes_or_no }}" {{ extra_args }}
  57. # Starts all services
  58. start-all *extra_args: (run-tags "start-all" extra_args)
  59. # Starts a specific service group
  60. start-group group *extra_args:
  61. @just --justfile {{ justfile() }} run-tags start-group --extra-vars="group={{ group }}" {{ extra_args }}
  62. # Stops all services
  63. stop-all *extra_args: (run-tags "stop-all" extra_args)
  64. # Stops a specific service group
  65. stop-group group *extra_args:
  66. @just --justfile {{ justfile() }} run-tags stop-group --extra-vars="group={{ group }}" {{ extra_args }}
  67. # Rebuilds the mautrix-meta-instagram Ansible role using the mautrix-meta-messenger role as a source
  68. rebuild-mautrix-meta-instagram:
  69. /bin/bash {{ justfile_directory() }}/bin/rebuild-mautrix-meta-instagram.sh {{ justfile_directory() }}/roles/custom