Create a overlay network as external, attach to that one
This commit is contained in:
parent
d393ca32f7
commit
2418b25e1e
|
@ -17,6 +17,12 @@
|
||||||
- name: Install the docker compose file
|
- name: Install the docker compose file
|
||||||
template: src=haproxy-docker-stack.yml.j2 dest={{ haproxy_docker_compose_dir }}/docker-haproxy-stack.yml mode='0644'
|
template: src=haproxy-docker-stack.yml.j2 dest={{ haproxy_docker_compose_dir }}/docker-haproxy-stack.yml mode='0644'
|
||||||
|
|
||||||
|
- name: Create the overlay network that will be joined by the proxied services
|
||||||
|
docker_network:
|
||||||
|
name: '{{ haproxy_docker_overlay_network }}'
|
||||||
|
driver: overlay
|
||||||
|
scope: swarm
|
||||||
|
|
||||||
- name: Run the docker compose file to start the service
|
- name: Run the docker compose file to start the service
|
||||||
docker_stack:
|
docker_stack:
|
||||||
name: haproxy
|
name: haproxy
|
||||||
|
|
|
@ -7,6 +7,8 @@ services:
|
||||||
- {{ haproxy_cert_dir }}:{{ haproxy_cert_dir }}:ro
|
- {{ haproxy_cert_dir }}:{{ haproxy_cert_dir }}:ro
|
||||||
- /etc/haproxy:/usr/local/etc/haproxy:ro
|
- /etc/haproxy:/usr/local/etc/haproxy:ro
|
||||||
- /var/run/docker.sock:/var/run/docker.sock
|
- /var/run/docker.sock:/var/run/docker.sock
|
||||||
|
networks:
|
||||||
|
- {{ haproxy_docker_overlay_network }}
|
||||||
ports:
|
ports:
|
||||||
- target: {{ haproxy_default_port }}
|
- target: {{ haproxy_default_port }}
|
||||||
published: {{ haproxy_default_port }}
|
published: {{ haproxy_default_port }}
|
||||||
|
@ -75,3 +77,7 @@ services:
|
||||||
logging:
|
logging:
|
||||||
driver: 'journald'
|
driver: 'journald'
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
|
networks:
|
||||||
|
{{ haproxy_docker_overlay_network }}:
|
||||||
|
esternal: True
|
||||||
|
|
|
@ -1,2 +1,2 @@
|
||||||
---
|
---
|
||||||
# vars file for ansible-role-template
|
haproxy_docker_overlay_network: 'haproxy-public'
|
Loading…
Reference in New Issue