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.
 
 

43 lines
1.5 KiB

  1. # SPDX-FileCopyrightText: 2017 - 2022 Slavi Pantaleev
  2. # SPDX-FileCopyrightText: 2019 Dan Arnfield
  3. # SPDX-FileCopyrightText: 2019 Jan Christian Grünhage
  4. # SPDX-FileCopyrightText: 2020 MDAD project contributors
  5. # SPDX-FileCopyrightText: 2022 Marko Weltzer
  6. #
  7. # SPDX-License-Identifier: AGPL-3.0-or-later
  8. ---
  9. - name: Fail if playbook called incorrectly
  10. ansible.builtin.fail:
  11. msg: "The `username` variable needs to be provided to this playbook, via --extra-vars"
  12. when: "username is not defined or username == '<your-username>'"
  13. - name: Fail if playbook called incorrectly
  14. ansible.builtin.fail:
  15. msg: "The `password` variable needs to be provided to this playbook, via --extra-vars"
  16. when: "password is not defined or password == '<your-password>'"
  17. - name: Fail if playbook called incorrectly
  18. ansible.builtin.fail:
  19. msg: "The `admin` variable needs to be provided to this playbook, via --extra-vars"
  20. when: "admin is not defined or admin not in ['yes', 'no']"
  21. - name: Ensure matrix-synapse is started
  22. ansible.builtin.service:
  23. name: matrix-synapse
  24. state: started
  25. daemon_reload: true
  26. register: start_result
  27. - name: Wait a while, so that Synapse can manage to start
  28. ansible.builtin.pause:
  29. seconds: 7
  30. when: "start_result.changed"
  31. - name: Register user
  32. ansible.builtin.command:
  33. cmd: "{{ matrix_synapse_bin_path }}/register-user {{ username | quote }} {{ password | quote }} {{ '1' if admin == 'yes' else '0' }}"
  34. register: matrix_synapse_register_user_result
  35. changed_when: matrix_synapse_register_user_result.rc == 0