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