95 lines
2.7 KiB
YAML
95 lines
2.7 KiB
YAML
|
|
- name: Ensure /opt/synapse_modules directory exists
|
|
file:
|
|
path: /opt/synapse_modules
|
|
state: directory
|
|
owner: matrix-synapse
|
|
group: matrix-synapse
|
|
mode: '0755'
|
|
|
|
- name: Add PYTHONPATH to /lib/systemd/system/matrix-synapse.service file
|
|
lineinfile:
|
|
path: /lib/systemd/system/matrix-synapse.service
|
|
insertafter: "^[Service]"
|
|
regexp: '^Environment="PYTHONPATH=.*'
|
|
line: 'Environment="PYTHONPATH=$PYTHONPATH:/opt/synapse_modules"'
|
|
owner: root
|
|
group: root
|
|
mode: '0644'
|
|
|
|
- name: Reload systemd daemon
|
|
systemd:
|
|
daemon_reload: yes
|
|
|
|
- name: Ensure rsync is installed
|
|
apt:
|
|
name: rsync
|
|
state: present
|
|
|
|
- name: Clone redlight module to /tmp to ansible controller
|
|
delegate_to: localhost
|
|
git:
|
|
repo: https://code.glowers.club/PC-Admin/redlight.git
|
|
dest: /tmp/redlight
|
|
version: main
|
|
force: yes
|
|
|
|
- name: Synchronize /tmp/redlight content to /opt/synapse_modules/
|
|
synchronize:
|
|
src: /tmp/redlight/
|
|
dest: /opt/synapse_modules/
|
|
delete: yes
|
|
|
|
- name: Change ownership of /opt/synapse_modules/
|
|
file:
|
|
path: /opt/synapse_modules/
|
|
owner: matrix-synapse
|
|
group: matrix-synapse
|
|
recurse: yes
|
|
state: directory
|
|
|
|
- name: Add modules to homeserver.yaml
|
|
blockinfile:
|
|
path: /etc/matrix-synapse/homeserver.yaml
|
|
block: |
|
|
modules:
|
|
- module: redlight_client_module.RedlightClientModule
|
|
config:
|
|
homeserver_url: "{{ server_name }}"
|
|
redlight_alert_bot_token: "{{ redlight_alert_bot_token }}"
|
|
redlight_alert_room: "{{ redlight_alert_room }}"
|
|
redlight_server: "{{ redlight_server }}"
|
|
redlight_api_token: "{{ redlight_api_token }}"
|
|
- module: redlight_server_module.RedlightServerModule
|
|
config:
|
|
redlight_source_repo_url: "https://code.glowers.club/api/v1/repos/testing-org/rdlist"
|
|
redlight_git_token: "{{ redlight_git_token }}"
|
|
redlight_source_list_file_path: "dist/summaries.json"
|
|
redlight_client_tokens: "{{ redlight_client_tokens }}"
|
|
redlight_filtered_tags: {{ redlight_filtered_tags }}
|
|
state: present
|
|
owner: root
|
|
group: root
|
|
mode: '0644'
|
|
notify: Restart Synapse
|
|
|
|
- name: Create matrix_redlight role in PostgreSQL
|
|
become: yes
|
|
become_user: postgres
|
|
postgresql_user:
|
|
name: matrix_redlight
|
|
password: "{{ redlight_postgresql_password }}"
|
|
role_attr_flags: NOSUPERUSER,NOCREATEDB,NOCREATEROLE
|
|
encrypted: yes
|
|
|
|
- name: Create Database for matrix_redlight
|
|
become: yes
|
|
become_user: postgres
|
|
postgresql_db:
|
|
name: matrix_redlight
|
|
encoding: UTF8
|
|
lc_collate: C
|
|
lc_ctype: C
|
|
template: template0
|
|
owner: matrix_redlight
|