ansible-role-swarm/tasks/cluster.yml

17 lines
530 B
YAML

---
- name: init swarm cluster
community.docker.docker_swarm:
advertise_addr: '{{ swarm_advertise_addr }}'
state: present
when: swarm_manager and swarm_init
register: result
tags: swarm
- name: join swarm cluster
community.docker.docker_swarm: # noqa no-handler
advertise_addr: '{{ swarm_advertise_addr }}'
join_token: '{{ swarm_manager|ternary(swarm_join_token_manager, swarm_join_token_worker) }}'
remote_addrs: '{{ swarm_remote_addrs }}'
state: join
when: not result.changed
tags: swarm