The overlay networks can be more than one.
This commit is contained in:
parent
e0f360794e
commit
01e57d485d
|
|
@ -0,0 +1,3 @@
|
|||
{
|
||||
"ansible.python.interpreterPath": "/opt/local/bin/python"
|
||||
}
|
||||
|
|
@ -1,38 +1,37 @@
|
|||
---
|
||||
- name: Manage the composition of haproxy as a docker swarm service
|
||||
- name: haproxy-docker-service | Manage the composition of haproxy as a docker swarm service
|
||||
tags: ['haproxy', 'docker_haproxy', 'docker_swarm', 'docker']
|
||||
block:
|
||||
- name: Create the local haproxy configuration directory
|
||||
- name: haproxy-docker-service | Create the local haproxy configuration directory
|
||||
ansible.builtin.file: dest=/etc/haproxy state=directory mode='0755'
|
||||
|
||||
- name: Create the local directory for the socket volume
|
||||
- name: haproxy-docker-service | Create the local directory for the socket volume
|
||||
ansible.builtin.file: dest={{ haproxy_docker_socket_dir }} state=directory mode='0755'
|
||||
|
||||
- name: Install a bare haproxy configuration if there's none
|
||||
- name: haproxy-docker-service | Install a bare haproxy configuration if there's none
|
||||
ansible.builtin.copy: src=haproxy-sample.cfg dest=/etc/haproxy/haproxy.cfg mode='0644' force=no
|
||||
|
||||
tags: [ 'haproxy', 'docker_haproxy', 'docker_swarm', 'docker' ]
|
||||
|
||||
- name: Manage the composition of haproxy as a docker swarm service
|
||||
- name: haproxy-docker-service | Manage the composition of haproxy as a docker swarm service
|
||||
when: docker_swarm_manager_main_node is defined and docker_swarm_manager_main_node | bool
|
||||
tags: ['haproxy', 'docker_haproxy', 'docker_swarm', 'docker']
|
||||
block:
|
||||
- name: Create the destination directory of the haproxy docker compose file
|
||||
- name: haproxy-docker-service | Create the destination directory of the haproxy docker compose file
|
||||
ansible.builtin.file: dest={{ haproxy_docker_compose_dir }} state=directory mode='0755'
|
||||
|
||||
- name: Install the docker compose file
|
||||
- name: haproxy-docker-service | Install the docker compose file
|
||||
ansible.builtin.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
|
||||
- name: haproxy-docker-service | Create the overlay network that will be joined by the proxied services
|
||||
community.docker.docker_network:
|
||||
name: '{{ haproxy_docker_overlay_network }}'
|
||||
name: '{{ item }}'
|
||||
driver: overlay
|
||||
scope: swarm
|
||||
loop: '{{ haproxy_docker_overlay_default_network + haproxy_docker_swarm_overlay_additional_networks }}'
|
||||
|
||||
- name: Run the docker compose file to start the service
|
||||
- name: haproxy-docker-service | Run the docker compose file to start the service
|
||||
community.docker.docker_stack:
|
||||
name: haproxy
|
||||
state: present
|
||||
compose:
|
||||
- '{{ haproxy_docker_compose_dir }}/docker-haproxy-stack.yml'
|
||||
run_once: True
|
||||
|
||||
when: docker_swarm_manager_main_node is defined and docker_swarm_manager_main_node | bool
|
||||
tags: [ 'haproxy', 'docker_haproxy', 'docker_swarm', 'docker' ]
|
||||
run_once: true
|
||||
|
|
|
|||
|
|
@ -1,2 +1,3 @@
|
|||
---
|
||||
haproxy_docker_overlay_network: 'haproxy-public'
|
||||
haproxy_docker_overlay_default_network:
|
||||
- 'haproxy-public'
|
||||
Loading…
Reference in New Issue