Simon Pasquier | a4e3825 | 2017-04-28 11:14:29 +0200 | [diff] [blame] | 1 | #!/bin/bash -x |
| 2 | exec > >(tee -i /tmp/"$(basename "$0" .sh)"_"$(date '+%Y-%m-%d_%H-%M-%S')".log) 2>&1 |
| 3 | |
Simon Pasquier | d3a0b91 | 2017-05-02 15:32:20 +0200 | [diff] [blame] | 4 | # Configure base Docker service |
Simon Pasquier | a4e3825 | 2017-04-28 11:14:29 +0200 | [diff] [blame] | 5 | salt -C 'I@docker:swarm' state.sls docker.host |
Simon Pasquier | d3a0b91 | 2017-05-02 15:32:20 +0200 | [diff] [blame] | 6 | # Configure the Swarm master node |
Simon Pasquier | a4e3825 | 2017-04-28 11:14:29 +0200 | [diff] [blame] | 7 | salt -C 'I@docker:swarm:role:master' state.sls docker.swarm |
Simon Pasquier | d3a0b91 | 2017-05-02 15:32:20 +0200 | [diff] [blame] | 8 | # Send grains to mine for the Swarm slave nodes |
Simon Pasquier | a4e3825 | 2017-04-28 11:14:29 +0200 | [diff] [blame] | 9 | salt -C 'I@docker:swarm' state.sls salt.minion.grains |
| 10 | salt -C 'I@docker:swarm' mine.update |
Simon Pasquier | d3a0b91 | 2017-05-02 15:32:20 +0200 | [diff] [blame] | 11 | salt -C 'I@docker:swarm' saltutil.refresh_modules |
| 12 | sleep 5 |
| 13 | # Configure Swarm slave nodes |
Simon Pasquier | a4e3825 | 2017-04-28 11:14:29 +0200 | [diff] [blame] | 14 | salt -C 'I@docker:swarm:role:manager' state.sls docker.swarm -b 1 |
Simon Pasquier | d3a0b91 | 2017-05-02 15:32:20 +0200 | [diff] [blame] | 15 | |
| 16 | # List registered Docker Swarm nodes |
Simon Pasquier | a4e3825 | 2017-04-28 11:14:29 +0200 | [diff] [blame] | 17 | salt -C 'I@docker:swarm:role:master' cmd.run 'docker node ls' |