| - name: Ensure Swarm Master Initialization |
| command: "docker swarm init --advertise-addr {{ swarm_master_addr }}" |
| when: target == "swarm-master" |
| - name: Capture Swarm Cluster Manager Token |
| shell: ssh -i /home/voltha/.keys/{{ swarm_master_addr }} voltha@{{ swarm_master_addr }} sudo docker swarm join-token -q manager 2>/dev/null |
| when: target == "swarm-master-backup" |
| msg: "TOKEN: {{ manager_token.stdout }}" |
| when: target == "swarm-master-backup" |
| - name: Join Swarm Cluster |
| command: "docker swarm join --token {{ manager_token.stdout }} {{ swarm_master_addr }}:2377" |
| when: target == "swarm-master-backup" |