Synapse role
This commit is contained in:
65
roles/synapse/tasks/matrix-synchrotrons.yml
Normal file
65
roles/synapse/tasks/matrix-synchrotrons.yml
Normal file
@@ -0,0 +1,65 @@
|
||||
---
|
||||
|
||||
- block:
|
||||
- name: Add backports
|
||||
apt_repository:
|
||||
repo: "deb http://deb.debian.org/debian/ buster-backports main"
|
||||
filename: backports
|
||||
mode: '644'
|
||||
- name: Install go from backports
|
||||
apt:
|
||||
name: golang
|
||||
default_release: buster-backports
|
||||
when: ansible_distribution_release == 'buster'
|
||||
|
||||
- name: Install git and golang
|
||||
apt:
|
||||
name:
|
||||
- git
|
||||
- golang
|
||||
|
||||
- name: Create matrix-synchrotron user
|
||||
user:
|
||||
name: matrix-synchrotron
|
||||
system: yes
|
||||
home: /opt/matrix-synchrotron
|
||||
shell: /bin/false
|
||||
|
||||
- block:
|
||||
- name: Clone matrix-synchrotron git repo
|
||||
git:
|
||||
repo: 'https://github.com/Sorunome/matrix-synchrotron-balancer.git'
|
||||
dest: /opt/matrix-synchrotron/src
|
||||
force: yes
|
||||
register: install
|
||||
|
||||
- name: Build matrix-synchrotron
|
||||
command: go build
|
||||
args:
|
||||
chdir: /opt/matrix-synchrotron/src
|
||||
when: install.changed
|
||||
notify: config synapse service
|
||||
|
||||
- name: Configure matrix-synchrotron(s)
|
||||
include_tasks: matrix-synchrotron.yml
|
||||
loop: "{{ synapse_synchrotrons }}"
|
||||
loop_control:
|
||||
extended: yes
|
||||
|
||||
become_user: matrix-synchrotron
|
||||
|
||||
- name: Put systemd matrix-synchrotron unit in place
|
||||
template:
|
||||
src: 'systemd/matrix-synchrotron@.service.j2'
|
||||
dest: "/etc/systemd/system/matrix-synchrotron@.service"
|
||||
mode: '644'
|
||||
register: systemd_unit
|
||||
|
||||
- name: Enable systemd matrix-synchrotron-{{ item }} unit
|
||||
systemd:
|
||||
daemon_reload: yes
|
||||
name: "matrix-synchrotron@{{ item }}.service"
|
||||
enabled: yes
|
||||
state: restarted
|
||||
when: systemd_unit.changed
|
||||
loop: "{{ synapse_synchrotrons }}"
|
||||
Reference in New Issue
Block a user