23 lines
558 B
YAML
23 lines
558 B
YAML
---
|
|
|
|
- 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 }}"
|