---
  - name: Initialize Docker Swarm
    shell: "docker swarm init --advertise-addr={{ hostvars[inventory_hostname]['ansible_default_ipv4']['address'] }}:2377"
    tags: swarm

  - name: Get the Manager join-token
    shell: docker swarm join-token --quiet manager
    register: manager_token
    tags: swarm

  - name: Get the worker join-token
    shell: docker swarm join-token --quiet worker
    register: worker_token
    tags: swarm
