24 lines
554 B
YAML
24 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 }}"
|