Use a shell command to update the haproxy networks.

This commit is contained in:
Andrea Dell'Amico 2020-10-05 18:54:59 +02:00
parent 93199b0d3a
commit c3b0000a61
1 changed files with 9 additions and 15 deletions

View File

@ -9,23 +9,17 @@
with_items: '{{ docker_swarm_haproxy_additional_networks }}' with_items: '{{ docker_swarm_haproxy_additional_networks }}'
- name: Connect haproxy to the overlay networks - name: Connect haproxy to the overlay networks
docker_compose: shell: docker service update --network-add {{ item }} {{ docker_haproxy_service_name }} --update-delay 30s --update-parallelism 1 && touch {{ haproxy_docker_compose_dir }}/.network_{{ item }}
project_name: haproxy_haproxy with_items: '{{ docker_swarm_haproxy_networks }}'
definition: args:
version: '3' creates: '{{ haproxy_docker_compose_dir }}/.network_{{ item }}'
services:
haproxy_haproxy:
networks: '{{ docker_swarm_haproxy_networks }}'
ignore_errors: True ignore_errors: True
- name: Connect haproxy to the overlay networks - name: Connect haproxy to some additional overlay networks
docker_compose: shell: docker service update --network-add {{ item }} {{ docker_haproxy_service_name }} --update-delay 30s --update-parallelism 1 && touch {{ haproxy_docker_compose_dir }}/.additional_network_{{ item }}
project_name: haproxy_haproxy with_items: '{{ docker_swarm_haproxy_additional_networks }}'
definition: args:
version: '3' creates: '{{ haproxy_docker_compose_dir }}/.additional_network_{{ item }}'
services:
haproxy_haproxy:
networks: '{{ docker_swarm_haproxy_additional_networks }}'
ignore_errors: True ignore_errors: True
when: docker_swarm_manager_main_node | bool when: docker_swarm_manager_main_node | bool