Generate secrets for Matrix

This commit is contained in:
Salt 2020-06-22 04:08:03 -05:00
parent 46e0dff885
commit e766baf63d
2 changed files with 17 additions and 0 deletions

View File

@ -19,6 +19,7 @@
- awscli - awscli
- net-tools - net-tools
- openssh-server - openssh-server
- pwgen
- python3-apt - python3-apt
- vim - vim
- name: Copy system configs - name: Copy system configs

View File

@ -56,4 +56,20 @@
- { src: "homeserver.yaml", dest: "/etc/matrix-synapse/homeserver.yaml", mode: "0644" } - { src: "homeserver.yaml", dest: "/etc/matrix-synapse/homeserver.yaml", mode: "0644" }
- { src: "server_name.yaml", dest: "/etc/matrix-synapse/conf.d/server_name.yaml", mode: "0644" } - { src: "server_name.yaml", dest: "/etc/matrix-synapse/conf.d/server_name.yaml", mode: "0644" }
notify: restart synapse notify: restart synapse
- name: Check for secrets
stat: path="/etc/matrix-synapse/conf.d/shared_secrets.yaml"
register: p
- name: Generate secrets
block:
- name: Generate registration_shared_secret
command: pwgen 32 1
register: matrix_reg_secret
- name: Template out shared_secrets.yaml
template:
src: "shared-secrets.yaml"
dest: "/etc/matrix-synapse/conf.d/shared_secrets.yaml"
mode: "0640"
owner: "matrix-synapse"
group: "root"
when: not p.stat.exists
become: yes become: yes