Default advertise address

This commit is contained in:
Andrea Dell'Amico 2022-02-21 23:57:43 +01:00
parent eb902af919
commit 95429a099f
Signed by: adellam
GPG Key ID: 147ABE6CEB9E20FF
2 changed files with 4 additions and 1 deletions

View File

@ -4,8 +4,10 @@ docker_install: True
docker_swarm: False docker_swarm: False
docker_swarm_manager: False docker_swarm_manager: False
docker_swarm_manager_availability: 'drain' docker_swarm_manager_availability: 'drain'
docker_swarm_manager_advertise_address: '{{ ansible_default_ipv4.address }}'
docker_swarm_node: False docker_swarm_node: False
docker_swarm_node_availability: 'active' docker_swarm_node_availability: 'active'
docker_swarm_node_advertise_address: '{{ ansible_default_ipv4.address }}'
docker_swarm_worker_hostname: '{{ ansible_fqdn }}' docker_swarm_worker_hostname: '{{ ansible_fqdn }}'
docker_swarm_allowed_hosts: docker_swarm_allowed_hosts:
- '0.0.0.0/0' - '0.0.0.0/0'

View File

@ -10,6 +10,7 @@
- name: Initialize the cluster - name: Initialize the cluster
docker_swarm: docker_swarm:
state: present state: present
advertise_addr: '{{ +docker_swarm_manager_advertise_address }}'
when: when:
- docker_swarm_manager | bool - docker_swarm_manager | bool
- docker_swarm_manager_main_node | bool - docker_swarm_manager_main_node | bool
@ -34,7 +35,7 @@
- name: Add some manager nodes to the docker swarm cluster - name: Add some manager nodes to the docker swarm cluster
docker_swarm: docker_swarm:
state: join state: join
advertise_addr: '{{ ansible_default_ipv4.address }}' advertise_addr: '{{ docker_swarm_node_advertise_address }}'
join_token: '{{ docker_swarm_mgr_token }}' join_token: '{{ docker_swarm_mgr_token }}'
remote_addrs: [ '{{ docker_swarm_manager_main_node_hostname }}:2377' ] remote_addrs: [ '{{ docker_swarm_manager_main_node_hostname }}:2377' ]