From ade312e6f621661e1a6a6ca09ee9c3e1114ee084 Mon Sep 17 00:00:00 2001 From: Slavi Pantaleev Date: Mon, 20 Mar 2023 17:03:19 +0200 Subject: [PATCH] Add matrix_hookshot_container_network --- roles/custom/matrix-bridge-hookshot/defaults/main.yml | 2 ++ roles/custom/matrix-bridge-hookshot/tasks/setup_install.yml | 5 +++++ .../templates/systemd/matrix-hookshot.service.j2 | 4 ++-- 3 files changed, 9 insertions(+), 2 deletions(-) diff --git a/roles/custom/matrix-bridge-hookshot/defaults/main.yml b/roles/custom/matrix-bridge-hookshot/defaults/main.yml index db71da79..2113f53a 100644 --- a/roles/custom/matrix-bridge-hookshot/defaults/main.yml +++ b/roles/custom/matrix-bridge-hookshot/defaults/main.yml @@ -200,6 +200,8 @@ matrix_hookshot_permissions: [] matrix_hookshot_bot_displayname: Hookshot Bot matrix_hookshot_bot_avatar: 'mxc://half-shot.uk/2876e89ccade4cb615e210c458e2a7a6883fe17d' +matrix_hookshot_container_network: "{{ matrix_docker_network }}" + # A list of extra arguments to pass to the container matrix_hookshot_container_extra_arguments: [] diff --git a/roles/custom/matrix-bridge-hookshot/tasks/setup_install.yml b/roles/custom/matrix-bridge-hookshot/tasks/setup_install.yml index f0e8c1c6..576eb007 100644 --- a/roles/custom/matrix-bridge-hookshot/tasks/setup_install.yml +++ b/roles/custom/matrix-bridge-hookshot/tasks/setup_install.yml @@ -107,6 +107,11 @@ group: "{{ matrix_user_groupname }}" when: matrix_hookshot_github_enabled | bool and matrix_hookshot_github_private_key|length > 0 +- name: Ensure matrix-hookshot container network is created + community.general.docker_network: + name: "{{ matrix_hookshot_container_network }}" + driver: bridge + - name: Ensure matrix-hookshot.service installed ansible.builtin.template: src: "{{ role_path }}/templates/systemd/matrix-hookshot.service.j2" diff --git a/roles/custom/matrix-bridge-hookshot/templates/systemd/matrix-hookshot.service.j2 b/roles/custom/matrix-bridge-hookshot/templates/systemd/matrix-hookshot.service.j2 index 7ebd08b6..713c7a9f 100644 --- a/roles/custom/matrix-bridge-hookshot/templates/systemd/matrix-hookshot.service.j2 +++ b/roles/custom/matrix-bridge-hookshot/templates/systemd/matrix-hookshot.service.j2 @@ -20,8 +20,8 @@ ExecStart={{ devture_systemd_docker_base_host_command_docker }} run --rm --name --log-driver=none \ --user={{ matrix_user_uid }}:{{ matrix_user_gid }} \ --cap-drop=ALL \ - --network={{ matrix_docker_network }} \ - -v {{ matrix_hookshot_base_path }}:/data:z \ + --network={{ matrix_hookshot_container_network }} \ + --mount type=bind,src={{ matrix_hookshot_base_path }},dst=/data \ {% for port in matrix_hookshot_container_http_host_bind_ports %} -p {{ port }} \ {% endfor %}