From a1f6b035c78be56eebb6f2530993da0373c0c31c Mon Sep 17 00:00:00 2001 From: Sam Al-Sapti Date: Fri, 6 Jan 2023 14:37:50 +0100 Subject: [PATCH] Don't attach containers to default network --- roles/docker_services/tasks/services/watchtower.yml | 7 +++++++ roles/docker_services/tasks/services/wireguard.yml | 7 +++++++ 2 files changed, 14 insertions(+) diff --git a/roles/docker_services/tasks/services/watchtower.yml b/roles/docker_services/tasks/services/watchtower.yml index c03b3c1..fc194e5 100644 --- a/roles/docker_services/tasks/services/watchtower.yml +++ b/roles/docker_services/tasks/services/watchtower.yml @@ -1,10 +1,17 @@ # vim: ft=yaml.ansible --- +- name: Create Docker network for Watchtower + docker_network: + name: watchtower + state: present + - name: Deploy Watchtower Docker container docker_container: name: watchtower image: containrrr/watchtower:{{ services.watchtower.version }} restart_policy: unless-stopped + networks: + - name: watchtower env: WATCHTOWER_POLL_INTERVAL: '3600' volumes: diff --git a/roles/docker_services/tasks/services/wireguard.yml b/roles/docker_services/tasks/services/wireguard.yml index 05298b6..9b4358b 100644 --- a/roles/docker_services/tasks/services/wireguard.yml +++ b/roles/docker_services/tasks/services/wireguard.yml @@ -7,11 +7,18 @@ mode: u=rwx,g=rx,o=rx state: directory +- name: Create Docker network for Wireguard + docker_network: + name: wireguard + state: present + - name: Deploy Wireguard Docker container docker_container: name: wireguard image: linuxserver/wireguard:{{ services.wireguard.version }} restart_policy: unless-stopped + networks: + - name: wireguard env: SERVERURL: "{{ services.wireguard.domain }}" SERVERPORT: '51820'