2021-01-24 06:41:11 +00:00
|
|
|
---
|
2022-11-24 09:33:30 +00:00
|
|
|
|
2021-01-24 06:41:11 +00:00
|
|
|
- name: Fail if playbook called incorrectly
|
2022-07-18 07:39:08 +00:00
|
|
|
ansible.builtin.fail:
|
2021-01-24 06:41:11 +00:00
|
|
|
msg: "The `username` variable needs to be provided to this playbook, via --extra-vars"
|
|
|
|
when: "username is not defined or username == '<your-username>'"
|
|
|
|
|
|
|
|
- name: Fail if playbook called incorrectly
|
2022-07-18 07:39:08 +00:00
|
|
|
ansible.builtin.fail:
|
2021-01-24 06:41:11 +00:00
|
|
|
msg: "The `password` variable needs to be provided to this playbook, via --extra-vars"
|
|
|
|
when: "password is not defined or password == '<your-password>'"
|
|
|
|
|
2022-08-26 04:29:50 +00:00
|
|
|
- name: Fail if playbook called incorrectly
|
|
|
|
ansible.builtin.fail:
|
|
|
|
msg: "The `admin` variable needs to be provided to this playbook, via --extra-vars"
|
|
|
|
when: "admin is not defined or admin not in ['yes', 'no']"
|
|
|
|
|
2021-01-24 06:41:11 +00:00
|
|
|
- name: Ensure matrix-dendrite is started
|
2022-07-18 07:39:08 +00:00
|
|
|
ansible.builtin.service:
|
2021-01-24 06:41:11 +00:00
|
|
|
name: matrix-dendrite
|
|
|
|
state: started
|
2022-02-05 20:32:54 +00:00
|
|
|
daemon_reload: true
|
2021-01-24 06:41:11 +00:00
|
|
|
register: start_result
|
|
|
|
|
|
|
|
- name: Wait a while, so that Dendrite can manage to start
|
2022-07-18 08:22:05 +00:00
|
|
|
ansible.builtin.pause:
|
2021-01-24 06:41:11 +00:00
|
|
|
seconds: 7
|
2022-07-18 12:08:10 +00:00
|
|
|
when: start_result.changed | bool
|
2021-01-24 06:41:11 +00:00
|
|
|
|
|
|
|
- name: Register user
|
2022-07-18 12:08:10 +00:00
|
|
|
ansible.builtin.command:
|
2022-12-31 15:33:46 +00:00
|
|
|
cmd: "{{ matrix_dendrite_bin_path }}/create-account {{ username | quote }} {{ password | quote }} {{ '1' if admin == 'yes' else '0' }}"
|
2022-07-18 12:08:10 +00:00
|
|
|
register: matrix_dendrite_register_user_result
|
|
|
|
changed_when: matrix_dendrite_register_user_result.rc == 0
|