Fix docker-swarm for multi-ip machines
Added variable docker_swarm_advertise_addr which can be set to the advertise address swarm should use. Mostly introduced for vagrant-based test setups for now, which contain multiple IP addresses and fail otherwise.
This commit is contained in:
parent
7e99f97958
commit
b16ab5205c
3 changed files with 14 additions and 4 deletions
|
|
@ -3,11 +3,19 @@
|
|||
# needs community docker module installed:
|
||||
# run $`ansible-galaxy collection install community.docker`
|
||||
|
||||
- name: Ensure swarm is initialized
|
||||
- name: Ensure swarm is initialized with default advertise address
|
||||
community.docker.docker_swarm:
|
||||
state: present
|
||||
# advertise_addr: eth1 # necessary for testing setup on vagrant
|
||||
become: true
|
||||
when: docker_swarm_advertise_addr is undefined
|
||||
|
||||
# ensure setups with multiple ip addresses can be initialized
|
||||
- name: Ensure swarm is initialized with specified advertise address
|
||||
community.docker.docker_swarm:
|
||||
state: present
|
||||
advertise_addr: "{{ docker_swarm_advertise_addr }}"
|
||||
become: true
|
||||
when: docker_swarm_advertise_addr is defined
|
||||
|
||||
- name: Ensure public network exists
|
||||
community.docker.docker_network:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue