ansible-role-swarm/tasks/cluster.yml

18 lines
532 B
YAML
Raw Normal View History

2019-08-24 10:55:56 +00:00
---
2023-11-23 10:12:18 +00:00
- name: Init swarm cluster
2021-11-22 10:28:13 +00:00
community.docker.docker_swarm:
2021-11-22 10:43:06 +00:00
advertise_addr: '{{ swarm_advertise_addr }}'
2019-08-24 10:55:56 +00:00
state: present
2021-11-22 13:38:49 +00:00
when: swarm_manager and swarm_init
register: result
2021-11-22 10:43:06 +00:00
tags: swarm
2019-08-24 10:55:56 +00:00
2023-11-23 10:12:18 +00:00
- name: Join swarm cluster
2022-04-07 07:54:39 +00:00
community.docker.docker_swarm: # noqa no-handler
2021-11-22 10:43:06 +00:00
advertise_addr: '{{ swarm_advertise_addr }}'
2022-07-20 09:53:28 +00:00
join_token: '{{ swarm_manager | ternary(swarm_join_token_manager, swarm_join_token_worker) }}'
2021-11-22 10:43:06 +00:00
remote_addrs: '{{ swarm_remote_addrs }}'
2019-08-24 10:55:56 +00:00
state: join
2021-11-22 13:38:49 +00:00
when: not result.changed
2021-11-22 10:43:06 +00:00
tags: swarm