blob: 19a434144d2314d411997906db97b50b32739f9b [file] [log] [blame]
Simon Pasquiera4e38252017-04-28 11:14:29 +02001#!/bin/bash -x
2exec > >(tee -i /tmp/"$(basename "$0" .sh)"_"$(date '+%Y-%m-%d_%H-%M-%S')".log) 2>&1
3
Simon Pasquierd3a0b912017-05-02 15:32:20 +02004# Configure base Docker service
Simon Pasquiera4e38252017-04-28 11:14:29 +02005salt -C 'I@docker:swarm' state.sls docker.host
Simon Pasquierd3a0b912017-05-02 15:32:20 +02006# Configure the Swarm master node
Simon Pasquiera4e38252017-04-28 11:14:29 +02007salt -C 'I@docker:swarm:role:master' state.sls docker.swarm
Simon Pasquierd3a0b912017-05-02 15:32:20 +02008# Send grains to mine for the Swarm slave nodes
Simon Pasquiera4e38252017-04-28 11:14:29 +02009salt -C 'I@docker:swarm' state.sls salt.minion.grains
10salt -C 'I@docker:swarm' mine.update
Simon Pasquierd3a0b912017-05-02 15:32:20 +020011salt -C 'I@docker:swarm' saltutil.refresh_modules
12sleep 5
13# Configure Swarm slave nodes
Simon Pasquiera4e38252017-04-28 11:14:29 +020014salt -C 'I@docker:swarm:role:manager' state.sls docker.swarm -b 1
Simon Pasquierd3a0b912017-05-02 15:32:20 +020015
16# List registered Docker Swarm nodes
Simon Pasquiera4e38252017-04-28 11:14:29 +020017salt -C 'I@docker:swarm:role:master' cmd.run 'docker node ls'