blob: d7a05254407046fb93444e9001edf5820df21484 [file] [log] [blame]
Zack Williams41513bf2018-07-07 20:08:35 -07001# Copyright 2017-present Open Networking Foundation
2#
3# Licensed under the Apache License, Version 2.0 (the "License");
4# you may not use this file except in compliance with the License.
5# You may obtain a copy of the License at
6#
7# http://www.apache.org/licenses/LICENSE-2.0
8#
9# Unless required by applicable law or agreed to in writing, software
10# distributed under the License is distributed on an "AS IS" BASIS,
11# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12# See the License for the specific language governing permissions and
13# limitations under the License.
Sergio Slobodrianba9cbd82017-06-22 11:45:49 -040014---
15- name: Ensure Swarm Master Initialization
16 command: "docker swarm init --advertise-addr {{ swarm_master_addr }}"
17 when: target == "swarm-master"
18 tags: [swarm]
19
20- name: Capture Swarm Cluster Manager Token
21 become: voltha
22 shell: ssh -i /home/voltha/.keys/{{ swarm_master_addr }} voltha@{{ swarm_master_addr }} sudo docker swarm join-token -q manager 2>/dev/null
23 register: manager_token
24 changed_when: false
25 when: target == "swarm-master-backup"
26 tags: [swarm]
27
28- name: Debug
29 debug:
30 msg: "TOKEN: {{ manager_token.stdout }}"
31 when: target == "swarm-master-backup"
32 tags: [swarm]
33
34- name: Join Swarm Cluster
35 command: "docker swarm join --token {{ manager_token.stdout }} {{ swarm_master_addr }}:2377"
36 when: target == "swarm-master-backup"
37 tags: [swarm]