Attach portainer to the haproxy-public network

This commit is contained in:
Andrea Dell'Amico 2020-10-12 18:47:23 +02:00
parent 852b16aee2
commit 4fbfba3cc9
2 changed files with 2 additions and 17 deletions

View File

@ -15,19 +15,8 @@
- /srv/portainer/portainer-agent-stack.yml
run_once: True
- name: Create the overlay network that will be used by portainer
docker_network:
name: '{{ docker_swarm_portainer_network }}'
driver: overlay
scope: swarm
- name: Connect the portainer service to its network
shell: docker service update --network-add {{ docker_swarm_portainer_network }} {{ item }} --update-delay 30s --update-parallelism 1 && touch /srv/portainer/.network_{{ item }}
with_items:
- 'portainer_portainer'
- 'portainer_agent'
args:
creates: '/srv/portainer/.network_{{ item }}'
- name: Connect the portainer service to the docker network
shell: docker service update --network-add haproxy-public portainer_portainer --update-delay 30s --update-parallelism 1
ignore_errors: True
when: docker_swarm_manager_main_node | bool

View File

@ -27,7 +27,6 @@ services:
- portainer_data:/data
networks:
- {{ docker_swarm_portainer_network }}
- haproxy-public
deploy:
mode: replicated
replicas: 1
@ -53,6 +52,3 @@ volumes:
networks:
{{ docker_swarm_portainer_network }}:
haproxy-public:
external:
name: haproxy-public