Implement synchrotron balancing in nginx, replaces need for matrix-synchrotron-balancer
This commit is contained in:
@@ -1,53 +1,13 @@
|
||||
---
|
||||
|
||||
- name: Install git and golang
|
||||
ansible.builtin.apt:
|
||||
name:
|
||||
- git
|
||||
- golang
|
||||
|
||||
- name: Create matrix-synchrotron user
|
||||
- name: Ensure matrix-synchrotron user not present
|
||||
ansible.builtin.user:
|
||||
name: matrix-synchrotron
|
||||
system: true
|
||||
home: /opt/matrix-synchrotron
|
||||
shell: /bin/false
|
||||
state: absent
|
||||
remove: true
|
||||
|
||||
- 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 }}"
|
||||
- name: Ensure matrix-synchrotron unit not present
|
||||
ansible.builtin.file:
|
||||
path: /etc/systemd/system/matrix-synchrotron@.service
|
||||
state: absent
|
||||
notify: Disable matrix-synchrotrons
|
||||
|
||||
Reference in New Issue
Block a user