--- - name: init swarm cluster docker_swarm: advertise_addr: '{{ docker_advertise_addr }}' state: present when: docker_swarm_manager tags: docker - name: join swarm cluster docker_swarm: advertise_addr: '{{ docker_advertise_addr }}' join_token: '{{ docker_join_token }}' remote_addrs: '{{ docker_remote_addrs }}' state: join when: not docker_swarm_manager tags: docker