Simon Pasquier | d3a0b91 | 2017-05-02 15:32:20 +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 | |
| 4 | # Configure Telegraf |
| 5 | salt -C 'I@telegraf:agent' state.sls telegraf |
| 6 | |
| 7 | # Configure Elasticsearch/Kibana services |
| 8 | salt -C 'I@elasticsearch:server' state.sls elasticsearch.server -b 1 |
| 9 | salt -C 'I@kibana:server' state.sls kibana.server -b 1 |
| 10 | salt -C 'I@elasticsearch:client' state.sls elasticsearch.client.service |
| 11 | salt -C 'I@kibana:client' state.sls kibana.client.service |
| 12 | salt -C 'I@kibana:client or I@elasticsearch:client' --async service.restart salt-minion |
| 13 | sleep 10 |
| 14 | salt -C 'I@elasticsearch:client' state.sls elasticsearch.client |
| 15 | salt -C 'I@kibana:client' state.sls kibana.client |
| 16 | |
| 17 | # Collect grains needed to configure the services |
| 18 | salt -C 'I@salt:minion' state.sls salt.minion.grains |
| 19 | salt -C 'I@salt:minion' saltutil.refresh_modules |
| 20 | salt -C 'I@salt:minion' mine.update |
| 21 | sleep 5 |
| 22 | |
| 23 | # Configure the services running in Docker Swarm |
Simon Pasquier | 59a698d | 2017-05-04 14:20:15 +0200 | [diff] [blame] | 24 | salt -C 'I@docker:swarm:role:master' state.sls prometheus.server,prometheus.alertmanager |
Simon Pasquier | d3a0b91 | 2017-05-02 15:32:20 +0200 | [diff] [blame] | 25 | for img in pushgateway alertmanager prometheus; do |
| 26 | salt -C 'I@docker:swarm' dockerng.pull "docker-sandbox.sandbox.mirantis.net/bkupidura/$img" |
| 27 | salt -C 'I@docker:swarm' dockerng.tag "docker-sandbox.sandbox.mirantis.net/bkupidura/$img:latest" "$img:latest" |
| 28 | done |
| 29 | salt -C 'I@docker:swarm:role:master' state.sls docker |
| 30 | salt -C 'I@docker:swarm' dockerng.ps |
Simon Pasquier | f853206 | 2017-05-04 11:58:41 +0200 | [diff] [blame] | 31 | |
| 32 | # Configure Grafana dashboards and datasources |
| 33 | salt -C 'I@grafana:client' state.sls grafana.client.service |
| 34 | salt -C 'I@grafana:client' --async service.restart salt-minion; sleep 10 |
| 35 | salt -C 'I@grafana:client' state.sls grafana.client |