nixos-servers/docker_swarm/playbooks/setup.yml
2024-02-08 23:53:02 +01:00

23 lines
554 B
YAML

---
- name: Setup Docker Swarm manager
hosts: manager
tasks:
- name: Create Docker Swarm
docker_swarm:
- name: Get Docker Swarm manager info
docker_swarm_info:
nodes: yes
nodes_filters:
name: manager
register: swarm_info
- hosts: workers
tasks:
- name: Join Docker Swarm
docker_swarm:
state: join
join_token: "{{ hostvars.manager.swarm_info.swarm_facts.JoinTokens.Worker }}"
remote_addrs:
- "{{ hostvars.manager.ansible_default_ipv4.address }}"