Script to crate pipes and containers for existing rooms
This commit is contained in:
parent
9402049a0c
commit
ebfa2ac39b
53
matrix.yml
53
matrix.yml
@ -192,11 +192,6 @@
|
|||||||
cp_max: 10
|
cp_max: 10
|
||||||
" >>data/homeserver.yaml
|
" >>data/homeserver.yaml
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# fifo pipe for messages to default room
|
|
||||||
[ -p /usr/local/share/$(hostname).fifo ] || mkfifo /usr/local/share/$(hostname).fifo
|
|
||||||
chgrp matrix /usr/local/share/$(hostname).fifo
|
|
||||||
chmod 660 /usr/local/share/$(hostname).fifo
|
|
||||||
backup: yes
|
backup: yes
|
||||||
validate: /bin/bash -n %s
|
validate: /bin/bash -n %s
|
||||||
notify: run genpw.sh
|
notify: run genpw.sh
|
||||||
@ -485,15 +480,6 @@
|
|||||||
- ./matrix-commander-data:/data:rw
|
- ./matrix-commander-data:/data:rw
|
||||||
restart: no
|
restart: no
|
||||||
|
|
||||||
matrix.{{inventory_hostname}}--commander-pipe:
|
|
||||||
image: matrixcommander/matrix-commander
|
|
||||||
volumes:
|
|
||||||
- /etc/localtime:/etc/localtime:ro
|
|
||||||
- ./matrix-commander-data:/data:rw
|
|
||||||
- /usr/local/share/{{inventory_hostname}}.fifo:/{{inventory_hostname}}.fifo
|
|
||||||
entrypoint: /bin/bash -c 'cd /data && tail -F /{{inventory_hostname}}.fifo | /app/matrix_commander/matrix-commander -m _ --html --room {{inventory_hostname}} --log-level INFO INFO'
|
|
||||||
restart: unless-stopped
|
|
||||||
|
|
||||||
networks:
|
networks:
|
||||||
matrix.{{inventory_hostname}}--network:
|
matrix.{{inventory_hostname}}--network:
|
||||||
driver: bridge
|
driver: bridge
|
||||||
@ -543,6 +529,45 @@
|
|||||||
validate: /bin/bash -n %s
|
validate: /bin/bash -n %s
|
||||||
# notify: run matrix.init
|
# notify: run matrix.init
|
||||||
|
|
||||||
|
- name: Script to crate pipes and containers for existing rooms
|
||||||
|
blockinfile:
|
||||||
|
path: /home/docker/matrix.{{inventory_hostname}}/pipe-rooms.sh
|
||||||
|
mode: "0500"
|
||||||
|
owner: root
|
||||||
|
group: root
|
||||||
|
create: yes
|
||||||
|
marker: "# {mark} ANSIBLE MANAGED BLOCK"
|
||||||
|
block: |
|
||||||
|
cd /home/docker/matrix.$(hostname)
|
||||||
|
echo "services:" >docker-compose.override.yml.new
|
||||||
|
for room in $(docker compose run -T matrix.$(hostname)--commander --joined-rooms --output text)
|
||||||
|
do
|
||||||
|
room=$(docker compose run -T matrix.$(hostname)--commander --get-room-info "\\$room" --log-level ERROR ERROR | cut -d\# -f2 | cut -d: -f1)
|
||||||
|
echo "Room: $room"
|
||||||
|
pipe="/usr/local/share/matrix-room-${room}.fifo"
|
||||||
|
pipebasename="matrix-room-${room}.fifo"
|
||||||
|
[ -e "$pipe" ] || mkfifo "$pipe"
|
||||||
|
chown root:matrix "$pipe"
|
||||||
|
chmod 660 "$pipe"
|
||||||
|
roomnospace=${room// /_}
|
||||||
|
echo " matrix.room-pipe-${roomnospace}:
|
||||||
|
image: matrixcommander/matrix-commander
|
||||||
|
volumes:
|
||||||
|
- /etc/localtime:/etc/localtime:ro
|
||||||
|
- ./matrix-commander-data:/data:rw
|
||||||
|
- ${pipe}:/${pipebasename}
|
||||||
|
entrypoint: /bin/bash -c 'cd /data && tail -F \"/${pipebasename}\" | /app/matrix_commander/matrix-commander -m _ --html --room \"$room\" --log-level INFO INFO'
|
||||||
|
restart: unless-stopped
|
||||||
|
" >> docker-compose.override.yml.new
|
||||||
|
done
|
||||||
|
|
||||||
|
mv docker-compose.override.yml.new docker-compose.override.yml
|
||||||
|
docker compose up -d
|
||||||
|
backup: yes
|
||||||
|
validate: /bin/bash -n %s
|
||||||
|
# notify: run matrix.init
|
||||||
|
|
||||||
|
|
||||||
- name: Run matrix.init after install
|
- name: Run matrix.init after install
|
||||||
ansible.builtin.shell: bash /home/docker/matrix.{{inventory_hostname}}/matrix.init.sh
|
ansible.builtin.shell: bash /home/docker/matrix.{{inventory_hostname}}/matrix.init.sh
|
||||||
args:
|
args:
|
||||||
|
Loading…
Reference in New Issue
Block a user