54 lines
1.4 KiB
YAML
54 lines
1.4 KiB
YAML
---
|
|
|
|
- name: Install git and golang
|
|
ansible.builtin.apt:
|
|
name:
|
|
- git
|
|
- golang
|
|
|
|
- name: Create matrix-synchrotron user
|
|
ansible.builtin.user:
|
|
name: matrix-synchrotron
|
|
system: true
|
|
home: /opt/matrix-synchrotron
|
|
shell: /bin/false
|
|
|
|
- name: Install matrix-synchrotron
|
|
become_user: matrix-synchrotron
|
|
block:
|
|
- name: Clone matrix-synchrotron git repo
|
|
ansible.builtin.git:
|
|
repo: https://github.com/Sorunome/matrix-synchrotron-balancer.git
|
|
dest: /opt/matrix-synchrotron/src
|
|
force: true
|
|
register: install
|
|
|
|
- name: Build matrix-synchrotron
|
|
ansible.builtin.command: go build
|
|
args:
|
|
chdir: /opt/matrix-synchrotron/src
|
|
when: install.changed
|
|
notify: Config synapse service
|
|
|
|
- name: Configure matrix-synchrotron(s)
|
|
ansible.builtin.include_tasks: matrix-synchrotron.yml
|
|
loop: "{{ synapse_synchrotrons }}"
|
|
loop_control:
|
|
extended: true
|
|
|
|
- name: Put systemd matrix-synchrotron unit in place
|
|
ansible.builtin.template:
|
|
src: systemd/matrix-synchrotron@.service.j2
|
|
dest: /etc/systemd/system/matrix-synchrotron@.service
|
|
mode: "644"
|
|
register: systemd_unit
|
|
|
|
- name: Enable systemd unit matrix-synchrotron-{{ item }}
|
|
ansible.builtin.systemd:
|
|
daemon_reload: true
|
|
name: matrix-synchrotron@{{ item }}.service
|
|
enabled: true
|
|
state: restarted
|
|
when: systemd_unit.changed
|
|
loop: "{{ synapse_synchrotrons }}"
|