Matrix Docker Ansible eploy
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 

82 line
3.7 KiB

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