blob: d900c42fb68fef632b2ca0391310c39858509015 [file] [log] [blame]
Tatyana Leontovichc8b8ca22017-05-19 13:37:05 +03001{% from 'virtual-mcp11-k8s-calico/underlay.yaml' import HOSTNAME_CFG01 with context %}
2
3# Install docker swarm
Tatyana Leontovich5acc82a2017-05-23 15:41:35 +03004- description: Configure docker service
5 cmd: salt -C 'I@docker:swarm' state.sls docker.host
Tatyana Leontovichc8b8ca22017-05-19 13:37:05 +03006 node_name: {{ HOSTNAME_CFG01 }}
7 retry: {count: 1, delay: 10}
Tatyana Leontovich5acc82a2017-05-23 15:41:35 +03008 skip_fail: false
9
10- description: Install docker swarm on master node
11 cmd: salt -C 'I@docker:swarm:role:master' state.sls docker.swarm
12 node_name: {{ HOSTNAME_CFG01 }}
13 retry: {count: 1, delay: 10}
14 skip_fail: false
15
16- description: Send grains to the swarm slave nodes
17 cmd: salt -C 'I@docker:swarm' state.sls salt.minion.grains
18 node_name: {{ HOSTNAME_CFG01 }}
19 retry: {count: 1, delay: 10}
20 skip_fail: false
21
22- description: Update mine
23 cmd: salt -C 'I@docker:swarm' mine.update
24 node_name: {{ HOSTNAME_CFG01 }}
25 retry: {count: 1, delay: 10}
26 skip_fail: false
27
28- description: Refresh modules
29 cmd: salt -C 'I@docker:swarm' saltutil.refresh_modules; sleep 5;
30 node_name: {{ HOSTNAME_CFG01 }}
31 retry: {count: 1, delay: 10}
32 skip_fail: false
33
34- description: Configure slave nodes
35 cmd: salt -C 'I@docker:swarm:role:manager' state.sls docker.swarm -b 1
36 node_name: {{ HOSTNAME_CFG01 }}
37 retry: {count: 1, delay: 10}
38 skip_fail: false
39
40- description: List registered Docker swarm nodes
41 cmd: salt -C 'I@docker:swarm:role:master' cmd.run 'docker node ls'
42 node_name: {{ HOSTNAME_CFG01 }}
43 retry: {count: 1, delay: 10}
44 skip_fail: false
Tatyana Leontovichc8b8ca22017-05-19 13:37:05 +030045
46# Install slv2 infra
Tatyana Leontovich5acc82a2017-05-23 15:41:35 +030047- description: Install telegraf
48 cmd: salt -C 'I@telegraf:agent' state.sls telegraf
Tatyana Leontovichc8b8ca22017-05-19 13:37:05 +030049 node_name: {{ HOSTNAME_CFG01 }}
50 retry: {count: 1, delay: 10}
Tatyana Leontovich5acc82a2017-05-23 15:41:35 +030051 skip_fail: false
Tatyana Leontovichc8b8ca22017-05-19 13:37:05 +030052
Tatyana Leontovich5acc82a2017-05-23 15:41:35 +030053- description: Install elasticsearch server
54 cmd: salt -C 'I@elasticsearch:server' state.sls elasticsearch.server -b 1
Tatyana Leontovichc8b8ca22017-05-19 13:37:05 +030055 node_name: {{ HOSTNAME_CFG01 }}
56 retry: {count: 1, delay: 10}
Tatyana Leontovich5acc82a2017-05-23 15:41:35 +030057 skip_fail: false
58
59- description: Install kibana server
60 cmd: salt -C 'I@kibana:server' state.sls kibana.server -b 1
61 node_name: {{ HOSTNAME_CFG01 }}
62 retry: {count: 1, delay: 10}
63 skip_fail: false
64
65- description: Install elasticsearch service
66 cmd: salt -C 'I@elasticsearch:client' state.sls elasticsearch.client.service
67 node_name: {{ HOSTNAME_CFG01 }}
68 retry: {count: 1, delay: 10}
69 skip_fail: false
70
71- description: Restart minions
72 cmd: salt -C 'I@elasticsearch:client' --async service.restart salt-minion; sleep 10;
73 node_name: {{ HOSTNAME_CFG01 }}
74 retry: {count: 1, delay: 10}
75 skip_fail: false
76
77- description: Install elasticsearch client
78 cmd: salt -C 'I@elasticsearch:client' state.sls elasticsearch.client
79 node_name: {{ HOSTNAME_CFG01 }}
80 retry: {count: 1, delay: 10}
81 skip_fail: false
82
83- description: Install kibana client
84 cmd: salt -C 'I@kibana:client' state.sls kibana.client
85 node_name: {{ HOSTNAME_CFG01 }}
86 retry: {count: 1, delay: 10}
87 skip_fail: false
88
Tatyana Leontovich3645d2b2017-06-13 16:51:23 +030089- description: Check influix db
90 cmd: |
91 INFLUXDB_SERVICE=`salt -C 'I@influxdb:server' test.ping 1>/dev/null 2>&1 && echo true`;
92 echo "Influxdb service presence: ${INFLUXDB_SERVICE}";
93 if [[ "$INFLUXDB_SERVICE" == "true" ]]; then
94 salt -C 'I@influxdb:server' state.sls influxdb
95 fi
96 node_name: {{ HOSTNAME_CFG01 }}
97 retry: {count: 1, delay: 5}
98 skip_fail: true
99
Tatyana Leontovich5acc82a2017-05-23 15:41:35 +0300100# Collect grains needed to configure the services
101
102- description: Get grains
103 cmd: salt -C 'I@salt:minion' state.sls salt.minion.grains
104 node_name: {{ HOSTNAME_CFG01 }}
105 retry: {count: 1, delay: 10}
106 skip_fail: false
107
108- description: Sync modules
109 cmd: salt -C 'I@salt:minion' saltutil.refresh_modules
110 node_name: {{ HOSTNAME_CFG01 }}
111 retry: {count: 1, delay: 10}
112 skip_fail: false
113
114- description: Update mine
115 cmd: salt -C 'I@salt:minion' mine.update; sleep 5;
116 node_name: {{ HOSTNAME_CFG01 }}
117 retry: {count: 1, delay: 10}
118 skip_fail: false
119
120# Configure the services running in Docker Swarm
121- description: Install prometheus alertmanager
122 cmd: salt -C 'I@docker:swarm' state.sls prometheus.server,prometheus.alertmanager -b 1
123 node_name: {{ HOSTNAME_CFG01 }}
124 retry: {count: 1, delay: 10}
125 skip_fail: false
126
Tatyana Leontovich5acc82a2017-05-23 15:41:35 +0300127
128- description: Pull images
129 cmd: salt -C 'I@docker:swarm:role:master' cmd.run 'docker node ls';
Tatyana Leontovich3645d2b2017-06-13 16:51:23 +0300130 for img in pushgateway alertmanager prometheus telegraf remote_storage_adapter; do
Tatyana Leontovich5acc82a2017-05-23 15:41:35 +0300131 salt -C 'I@docker:swarm' dockerng.pull "docker-sandbox.sandbox.mirantis.net/bkupidura/$img";
132 salt -C 'I@docker:swarm' dockerng.tag "docker-sandbox.sandbox.mirantis.net/bkupidura/$img:latest" "$img:latest";
133 done;
134 node_name: {{ HOSTNAME_CFG01 }}
135 retry: {count: 1, delay: 1}
136 skip_fail: false
137
138- description: run docker state
139 cmd: salt -C 'I@docker:swarm:role:master' state.sls docker
140 node_name: {{ HOSTNAME_CFG01 }}
141 retry: {count: 1, delay: 10}
142 skip_fail: false
143
144- description: docker ps
145 cmd: salt -C 'I@docker:swarm' dockerng.ps
146 node_name: {{ HOSTNAME_CFG01 }}
147 retry: {count: 1, delay: 10}
148 skip_fail: false
149
150- description: Configure Grafana dashboards and datasources
151 cmd: salt -C 'I@grafana:client' state.sls grafana.client
152 node_name: {{ HOSTNAME_CFG01 }}
Dennis Dmitriev0c5f2cd2017-05-25 10:59:58 -0400153 retry: {count: 1, delay: 10}
Tatyana Leontovich5acc82a2017-05-23 15:41:35 +0300154 skip_fail: false