Matrix Docker Ansible eploy
No puede seleccionar más de 25 temas Los temas deben comenzar con una letra o número, pueden incluir guiones ('-') y pueden tener hasta 35 caracteres de largo.
 
 

51 líneas
2.4 KiB

  1. #!/usr/bin/env bash
  2. # This is a bash script for generating strong passwords for the Jitsi role in this ansible project:
  3. # https://github.com/spantaleev/matrix-docker-ansible-deploy
  4. # This script assumes that you followed the documentation at https://github.com/spantaleev/matrix-docker-ansible-deploy/blob/master/docs/configuring-playbook.md and created a folder in the source code's directory like this: 'mkdir inventory/host_vars/matrix.<your-domain>'
  5. # it will put the generated passwords for Jitsi at the end of the vars.yml file in that directory
  6. function generatePassword() {
  7. openssl rand -hex 16
  8. }
  9. # helper function to get the matrix domain in the host_vars directory
  10. function get_domain_dir() {
  11. counter=0
  12. for f in *; do
  13. counter=$(( counter + 1 ))
  14. if [ ! -d "$f" ]; then
  15. echo "Error: could not find directory 'matrix.your.domain'"
  16. echo "Did you create it already? Please first setup your matrix homeserver before running this script."
  17. echo "You should start here: https://github.com/spantaleev/matrix-docker-ansible-deploy/blob/master/docs/prerequisites.md"
  18. exit 1
  19. elif [[ "$counter" -gt 1 ]]; then
  20. echo "Error: multiple directories found in ../host_vars/. Only one directory like 'matrix.your.domain' expected."
  21. echo "Please make sure there is only one directory holding your vars.yml for this ansible playbook."
  22. echo "Cannot continue script, exiting."
  23. exit 1
  24. fi
  25. # Will not set domain if zero or multiple directories are detected
  26. domain=$f
  27. done
  28. }
  29. cd ../host_vars
  30. get_domain_dir
  31. JICOFO_COMPONENT_SECRET=`generatePassword`
  32. JICOFO_AUTH_PASSWORD=`generatePassword`
  33. JVB_AUTH_PASSWORD=`generatePassword`
  34. JIBRI_RECORDER_PASSWORD=`generatePassword`
  35. JIBRI_XMPP_PASSWORD=`generatePassword`
  36. echo "" >> ../host_vars/${domain}/vars.yml
  37. echo "Jitsi passwords generated by inventory/scripts/gen-passwords.sh" >> ../host_vars/${domain}/vars.yml
  38. echo "matrix_jitsi_jicofo_component_secret: $JICOFO_COMPONENT_SECRET" >> ../host_vars/${domain}/vars.yml
  39. echo "matrix_jitsi_jicofo_auth_password: $JICOFO_AUTH_PASSWORD" >> ../host_vars/${domain}/vars.yml
  40. echo "matrix_jitsi_jvb_auth_password: $JVB_AUTH_PASSWORD" >> ../host_vars/${domain}/vars.yml
  41. echo "matrix_jitsi_jibri_recorder_password: $JIBRI_RECORDER_PASSWORD" >> ../host_vars/${domain}/vars.yml
  42. echo "matrix_jitsi_jibri_xmpp_password: $JIBRI_XMPP_PASSWORD" >> ../host_vars/${domain}/vars.yml