blob: cddc3a6d481cdf6f161c8c9f1070cd1bfc59ba28 [file] [log] [blame]
Tatyana Leontovich09b7b012017-07-10 12:53:45 +03001{% from 'virtual-mcp11-k8s-contrail/underlay.yaml' import HOSTNAME_CFG01 with context %}
Sergii Golovatiuk17ef1492017-05-29 19:54:03 +02002
3# Install docker swarm
Tatyana Leontovichde25aa42017-09-27 14:28:57 +03004- description: sync time
5 cmd: salt --hard-crash --state-output=mixed --state-verbose=False '*' cmd.run
6 'service ntp stop; ntpd -gq; service ntp start'
7 node_name: {{ HOSTNAME_CFG01 }}
8 retry: {count: 1, delay: 30}
9 skip_fail: false
10
11- description: Restart keepalived service
12 cmd: salt -C 'mon*' cmd.run "systemctl restart keepalived"
13 node_name: {{ HOSTNAME_CFG01 }}
14 retry: {count: 1, delay: 10}
15 skip_fail: false
16
17- description: Check the VIP
18 cmd: |
19 SL_MONITOR_ADDRESS=`salt-call --out=newline_values_only pillar.get _param:stacklight_monitor_address`;
20 echo "_param:stacklight_monitor_address (vip): ${SL_MONITOR_ADDRESS}";
21 salt --hard-crash --state-output=mixed --state-verbose=False -C 'mon*' cmd.run "ip a | grep ${SL_MONITOR_ADDRESS}" | grep -B1 ${SL_MONITOR_ADDRESS}
22 node_name: {{ HOSTNAME_CFG01 }}
23 retry: {count: 1, delay: 5}
24 skip_fail: false
25
Sergii Golovatiuk17ef1492017-05-29 19:54:03 +020026- description: Configure docker service
27 cmd: salt -C 'I@docker:swarm' state.sls docker.host
28 node_name: {{ HOSTNAME_CFG01 }}
29 retry: {count: 1, delay: 10}
30 skip_fail: false
31
32- description: Install docker swarm on master node
33 cmd: salt -C 'I@docker:swarm:role:master' state.sls docker.swarm
34 node_name: {{ HOSTNAME_CFG01 }}
35 retry: {count: 1, delay: 10}
36 skip_fail: false
37
38- description: Send grains to the swarm slave nodes
39 cmd: salt -C 'I@docker:swarm' state.sls salt.minion.grains
40 node_name: {{ HOSTNAME_CFG01 }}
41 retry: {count: 1, delay: 10}
42 skip_fail: false
43
44- description: Update mine
45 cmd: salt -C 'I@docker:swarm' mine.update
46 node_name: {{ HOSTNAME_CFG01 }}
47 retry: {count: 1, delay: 10}
48 skip_fail: false
49
50- description: Refresh modules
51 cmd: salt -C 'I@docker:swarm' saltutil.refresh_modules; sleep 5;
52 node_name: {{ HOSTNAME_CFG01 }}
53 retry: {count: 1, delay: 10}
54 skip_fail: false
55
Tatyana Leontovich2fec09a2017-08-22 13:52:11 +030056- description: Rerun swarm on slaves to proper token population
57 cmd: salt -C 'I@docker:swarm:role:master' state.sls docker.swarm
58 node_name: {{ HOSTNAME_CFG01 }}
59 retry: {count: 1, delay: 10}
60 skip_fail: false
61
Sergii Golovatiuk17ef1492017-05-29 19:54:03 +020062- description: Configure slave nodes
63 cmd: salt -C 'I@docker:swarm:role:manager' state.sls docker.swarm -b 1
64 node_name: {{ HOSTNAME_CFG01 }}
65 retry: {count: 1, delay: 10}
66 skip_fail: false
67
68- description: List registered Docker swarm nodes
69 cmd: salt -C 'I@docker:swarm:role:master' cmd.run 'docker node ls'
70 node_name: {{ HOSTNAME_CFG01 }}
71 retry: {count: 1, delay: 10}
72 skip_fail: false
73
74# Install slv2 infra
75- description: Install telegraf
Tatyana Leontovich09b7b012017-07-10 12:53:45 +030076 cmd: salt -C 'I@telegraf:agentor or I@telegraf:remote_agent' state.sls telegraf
77 node_name: {{ HOSTNAME_CFG01 }}
Tatyana Leontovich2fec09a2017-08-22 13:52:11 +030078 retry: {count: 2, delay: 10}
79 skip_fail: false
80
Dennis Dmitrievcc6e9b52017-09-01 11:27:58 +030081- description: Configure Prometheus exporters, if pillar 'prometheus:exporters' exists on any server
82 cmd: |
83 if salt -C 'I@prometheus:exporters' match.pillar 'prometheus:exporters' ; then
84 salt -C 'I@prometheus:exporters' state.sls prometheus
85 fi
Tatyana Leontovich2fec09a2017-08-22 13:52:11 +030086 node_name: {{ HOSTNAME_CFG01 }}
Tatyana Leontovich09b7b012017-07-10 12:53:45 +030087 retry: {count: 1, delay: 10}
88 skip_fail: false
89
90- description: Configure collector
91 cmd: salt -C 'I@heka:log_collector' state.sls heka.log_collector
Sergii Golovatiuk17ef1492017-05-29 19:54:03 +020092 node_name: {{ HOSTNAME_CFG01 }}
93 retry: {count: 1, delay: 10}
94 skip_fail: false
95
96- description: Install elasticsearch server
97 cmd: salt -C 'I@elasticsearch:server' state.sls elasticsearch.server -b 1
98 node_name: {{ HOSTNAME_CFG01 }}
99 retry: {count: 1, delay: 10}
100 skip_fail: false
101
102- description: Install kibana server
103 cmd: salt -C 'I@kibana:server' state.sls kibana.server -b 1
104 node_name: {{ HOSTNAME_CFG01 }}
105 retry: {count: 1, delay: 10}
106 skip_fail: false
107
Sergii Golovatiuk17ef1492017-05-29 19:54:03 +0200108- description: Install elasticsearch client
109 cmd: salt -C 'I@elasticsearch:client' state.sls elasticsearch.client
110 node_name: {{ HOSTNAME_CFG01 }}
111 retry: {count: 1, delay: 10}
112 skip_fail: false
113
114- description: Install kibana client
115 cmd: salt -C 'I@kibana:client' state.sls kibana.client
116 node_name: {{ HOSTNAME_CFG01 }}
117 retry: {count: 1, delay: 10}
118 skip_fail: false
119
Tatyana Leontovich09b7b012017-07-10 12:53:45 +0300120- description: Check influix db
121 cmd: |
122 INFLUXDB_SERVICE=`salt -C 'I@influxdb:server' test.ping 1>/dev/null 2>&1 && echo true`;
123 echo "Influxdb service presence: ${INFLUXDB_SERVICE}";
124 if [[ "$INFLUXDB_SERVICE" == "true" ]]; then
125 salt -C 'I@influxdb:server' state.sls influxdb
126 fi
127 node_name: {{ HOSTNAME_CFG01 }}
128 retry: {count: 1, delay: 5}
129 skip_fail: true
130
Sergii Golovatiuk17ef1492017-05-29 19:54:03 +0200131# Collect grains needed to configure the services
132
133- description: Get grains
134 cmd: salt -C 'I@salt:minion' state.sls salt.minion.grains
135 node_name: {{ HOSTNAME_CFG01 }}
136 retry: {count: 1, delay: 10}
137 skip_fail: false
138
139- description: Sync modules
140 cmd: salt -C 'I@salt:minion' saltutil.refresh_modules
141 node_name: {{ HOSTNAME_CFG01 }}
142 retry: {count: 1, delay: 10}
143 skip_fail: false
144
145- description: Update mine
146 cmd: salt -C 'I@salt:minion' mine.update; sleep 5;
147 node_name: {{ HOSTNAME_CFG01 }}
Tatyana Leontovich063d0ff2017-09-05 18:11:55 +0300148 retry: {count: 3, delay: 10}
Sergii Golovatiuk17ef1492017-05-29 19:54:03 +0200149 skip_fail: false
150
Tatyana Leontovich09b7b012017-07-10 12:53:45 +0300151# Configure the services running in Docker Swarm
152- description: Install prometheus alertmanager
153 cmd: salt -C 'I@docker:swarm' state.sls prometheus,heka.remote_collector -b 1
154 node_name: {{ HOSTNAME_CFG01 }}
155 retry: {count: 1, delay: 10}
156 skip_fail: false
157
Sergii Golovatiuk17ef1492017-05-29 19:54:03 +0200158- description: run docker state
159 cmd: salt -C 'I@docker:swarm:role:master' state.sls docker
160 node_name: {{ HOSTNAME_CFG01 }}
161 retry: {count: 1, delay: 10}
162 skip_fail: false
163
164- description: docker ps
165 cmd: salt -C 'I@docker:swarm' dockerng.ps
166 node_name: {{ HOSTNAME_CFG01 }}
167 retry: {count: 1, delay: 10}
168 skip_fail: false
169
170- description: Configure Grafana dashboards and datasources
Tatyana Leontovichde25aa42017-09-27 14:28:57 +0300171 cmd: sleep 60; salt -C 'I@grafana:client' state.sls grafana.client
Sergii Golovatiuk17ef1492017-05-29 19:54:03 +0200172 node_name: {{ HOSTNAME_CFG01 }}
Tatyana Leontovich572f7492017-07-14 13:36:11 +0300173 retry: {count: 2, delay: 10}
Sergii Golovatiuk17ef1492017-05-29 19:54:03 +0200174 skip_fail: false
Tatyana Leontovichea450642017-07-11 18:56:11 +0300175
176- description: Run salt minion to create cert files
177 cmd: salt --hard-crash --state-output=mixed --state-verbose=False "*" state.sls salt.minion
178 node_name: {{ HOSTNAME_CFG01 }}
179 retry: {count: 1, delay: 10}
180 skip_fail: false