nixos-servers/legacy/projects/docker_swarm/ansible/playbooks/setup.yml

24 lines
558 B
YAML
Raw Normal View History

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