diff --git a/tasks/haproxy_networks.yml b/tasks/haproxy_networks.yml index 6486bb8..60c1679 100644 --- a/tasks/haproxy_networks.yml +++ b/tasks/haproxy_networks.yml @@ -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