'delegate_to' the IP address. Works when using private IPs.

This commit is contained in:
Andrea Dell'Amico 2021-05-25 18:24:09 +02:00
parent 76e076c03c
commit a55f12a350
Signed by: adellam
GPG Key ID: 147ABE6CEB9E20FF
3 changed files with 5 additions and 4 deletions

View File

@ -12,6 +12,7 @@ docker_swarm_allowed_hosts:
# Set this to one of the manager hostnames to be able to initialize the cluster
docker_swarm_manager_main_node_hostname: localhost
docker_swarm_manager_main_node_address: 127.0.0.1
# Set this on one of the masters
docker_swarm_manager_main_node: False

View File

@ -27,7 +27,7 @@
cacheable: True
when: docker_swarm_manager
delegate_to: '{{ docker_swarm_manager_main_node_hostname }}'
delegate_to: '{{ docker_swarm_manager_main_node_address }}'
tags: [ 'docker', 'docker_swarm' ]
- block:
@ -46,7 +46,7 @@
- block:
- name: Set the swarm manager nodes availability. Default 'drain'
docker_node:
hostname: '{{ ansible_hostname }}'
hostname: '{{ ansible_fqdn }}'
availability: '{{ docker_swarm_manager_availability }}'
when: docker_swarm_manager | bool

View File

@ -39,7 +39,7 @@
availability: '{{ docker_swarm_node_availability }}'
when: docker_swarm_node | bool
delegate_to: '{{ docker_swarm_manager_main_node_hostname }}'
delegate_to: '{{ docker_swarm_manager_main_node_address }}'
tags: [ 'docker', 'docker_swarm', 'docker_swarm_worker_nodes', 'docker_swarm_worker_nodes_availability' ]
- name: Manage labels
@ -54,5 +54,5 @@
with_items: '{{ docker_node_labels }}'
when: docker_swarm_node | bool
delegate_to: '{{ docker_swarm_manager_main_node_hostname }}'
delegate_to: '{{ docker_swarm_manager_main_node_address }}'
tags: [ 'docker', 'docker_swarm', 'docker_swarm_worker_nodes', 'docker_nodes_labels' ]