cloudserve-infrastructure/roles/docker-swarm/tasks/main.yml
Marty Oehme b16ab5205c
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.
2021-07-27 13:46:24 +02:00

25 lines
763 B
YAML

---
# Bring up a docker swarm
# needs community docker module installed:
# run $`ansible-galaxy collection install community.docker`
- name: Ensure swarm is initialized with default advertise address
community.docker.docker_swarm:
state: present
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:
name: public
driver: overlay
state: present
become: true