2023-08-10 13:51:55 -04:00
|
|
|
|
|
|
|
- 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
|
|
|
|
|
2023-08-13 11:54:32 -04:00
|
|
|
- name: Clone redlight module to /tmp to ansible controller
|
|
|
|
delegate_to: localhost
|
2023-08-10 13:51:55 -04:00
|
|
|
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:
|
2023-08-10 14:35:21 -04:00
|
|
|
- module: redlight_client_module.RedlightClientModule
|
2023-08-13 11:54:32 -04:00
|
|
|
config:
|
2023-08-14 10:29:11 -04:00
|
|
|
homeserver_url: "https://{{ server_name }}"
|
|
|
|
redlight_bot_token: "{{ redlight_bot_token }}"
|
|
|
|
redlight_alert_room: "{{ redlight_alert_room }}"
|
|
|
|
redlight_server: "https://{{ server_name }}/_matrix/loj/v1/abuse_lookup"
|
2023-08-10 14:35:21 -04:00
|
|
|
- module: redlight_server_module.RedlightServerModule
|
2023-08-10 13:51:55 -04:00
|
|
|
config: {}
|
|
|
|
state: present
|
|
|
|
owner: root
|
|
|
|
group: root
|
|
|
|
mode: '0644'
|
|
|
|
notify: Restart Synapse
|