Open
Description
SUMMARY
Enable easy way to add all hosts as workers to existing Docker Swarm
ISSUE TYPE
- Feature Idea
COMPONENT NAME
docker_swarm
ADDITIONAL INFORMATION
I can initialise a Docker Swarm with filtering all hosts for tag swarm_manager=true
:
# hosts.ini
[all]
srv1 ansible_host=1.2.3.4 ansible_user=root swarm_manager=true
srv2 ansible_host=1.2.3.5 ansible_user=root
srv3 ansible_host=1.2.3.6 ansible_user=root swarm_manager=true
srv4 ansible_host=1.2.3.7 ansible_user=root
srv5 ansible_host=1.2.3.8 ansible_user=root swarm_manager=true
srv6 ansible_host=1.2.3.9 ansible_user=root
- hosts: all
gather_facts: true
tasks:
- name: Init a new Docker Swarm on managers
community.docker.docker_swarm:
state: present
when: hostvars[inventory_hostname]['swarm_manager'] | default(false) == "true"
How can I easily join the other hosts to the existing Docker Swarm as simple workers?
Is this a missing feature or just missing as an example?
state: present
means manager
and state: join
means worker
?
How to retrieve the join data from the manager nodes when iterating over worker nodes?