ansible/roles/matrix-bridge-facebook/tasks/main.yml

82 lines
1.9 KiB
YAML

---
- name: Setup postgres
include_role:
name: postgre
vars:
postgres_users:
- name: bridge_facebook_user
password: "{{ matrix_bridge_facebook_postgre_user_pwd }}"
databases:
- name: bridge_facebook
owner: bridge_facebook_user
local: C
template: template0
no_log: true
- name: Install dependencies
apt:
name:
- python3
- python3-virtualenv
- python3-pip
state: latest
update_cache: true
register: apt_result
retries: 3
until: apt_result is succeeded
- name: Create the mautrix-facebook user
user:
name: mautrix-facebook
home: /opt/mautrix-facebook
password_lock: yes
system: yes
- name: Install bridge
become: yes
become_user: mautrix-facebook
pip:
chdir: /opt/mautrix-facebook # is it really needed?
name: mautrix-facebook[animated_stickers]
virtualenv: /opt/mautrix-facebook
virtualenv_command: virtualenv
virtualenv_python: /usr/bin/python3
- name: Configure the bridge
template:
src: config.yaml
dest: /opt/mautrix-facebook/config.yaml
owner: mautrix-facebook
group: nogroup
mode: '0600'
notify: Restart the facebook bridge
no_log: true
- name: Generate facebook-registration.yaml
shell:
cmd: "/opt/mautrix-facebook/bin/python -m mautrix_facebook -g"
chdir: /opt/mautrix-facebook
creates: /opt/mautrix-facebook/registration.yaml
notify: Restart synapse
no_log: true
- name: Copy config for synapse
become: yes
become_user: mautrix-facebook
file:
src: /opt/mautrix-facebook/registration.yaml
dest: /etc/matrix-synapse/facebook-registration.yaml
state: link
- name: Copy the daemon configuration
template:
src: bridge_facebook.service
dest: /etc/systemd/system/bridge_facebook.service
notify: Restart the facebook bridge
- name: Enable the daemon
systemd:
name: bridge_facebook
state: started
enabled: yes