27 lines
1.3 KiB
YAML
27 lines
1.3 KiB
YAML
---
|
|
- name: Create the networks that haproxy will attach to and that are not created by the services
|
|
block:
|
|
- name: Create the overlay networks that are not created by the services
|
|
docker_network:
|
|
name: '{{ item }}'
|
|
driver: overlay
|
|
scope: swarm
|
|
with_items: '{{ docker_swarm_haproxy_additional_networks }}'
|
|
|
|
- name: Connect haproxy to the overlay 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 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
|
|
tags: [ 'haproxy', 'docker_haproxy', 'docker_swarm', 'docker', 'haproxy_network', 'docker_network' ]
|