Sergio Slobodrian | ba9cbd8 | 2017-06-22 11:45:49 -0400 | [diff] [blame] | 1 | --- |
| 2 | - name: Ensure Swarm Master Initialization |
| 3 | command: "docker swarm init --advertise-addr {{ swarm_master_addr }}" |
| 4 | when: target == "swarm-master" |
| 5 | tags: [swarm] |
| 6 | |
| 7 | - name: Capture Swarm Cluster Manager Token |
| 8 | become: voltha |
| 9 | shell: ssh -i /home/voltha/.keys/{{ swarm_master_addr }} voltha@{{ swarm_master_addr }} sudo docker swarm join-token -q manager 2>/dev/null |
| 10 | register: manager_token |
| 11 | changed_when: false |
| 12 | when: target == "swarm-master-backup" |
| 13 | tags: [swarm] |
| 14 | |
| 15 | - name: Debug |
| 16 | debug: |
| 17 | msg: "TOKEN: {{ manager_token.stdout }}" |
| 18 | when: target == "swarm-master-backup" |
| 19 | tags: [swarm] |
| 20 | |
| 21 | - name: Join Swarm Cluster |
| 22 | command: "docker swarm join --token {{ manager_token.stdout }} {{ swarm_master_addr }}:2377" |
| 23 | when: target == "swarm-master-backup" |
| 24 | tags: [swarm] |