blob: 830936473a7f55bb4917e75900215b71a06fde78 [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
Tatyana Leontovich2fec09a2017-08-22 13:52:11 +030034- description: Rerun swarm on slaves to proper token population
35 cmd: salt -C 'I@docker:swarm:role:master' state.sls docker.swarm
36 node_name: {{ HOSTNAME_CFG01 }}
37 retry: {count: 1, delay: 10}
38 skip_fail: false
39
Tatyana Leontovich5acc82a2017-05-23 15:41:35 +030040- description: Configure slave nodes
41 cmd: salt -C 'I@docker:swarm:role:manager' state.sls docker.swarm -b 1
42 node_name: {{ HOSTNAME_CFG01 }}
43 retry: {count: 1, delay: 10}
44 skip_fail: false
45
46- description: List registered Docker swarm nodes
47 cmd: salt -C 'I@docker:swarm:role:master' cmd.run 'docker node ls'
48 node_name: {{ HOSTNAME_CFG01 }}
49 retry: {count: 1, delay: 10}
50 skip_fail: false
Tatyana Leontovichc8b8ca22017-05-19 13:37:05 +030051
52# Install slv2 infra
Tatyana Leontovich5acc82a2017-05-23 15:41:35 +030053- description: Install telegraf
Tatyana Leontovichf8ec90d2017-07-18 16:36:16 +030054 cmd: salt -C 'I@telegraf:agent or I@telegraf:remote_agent' state.sls telegraf
Tatyana Leontovichf00b2342017-07-04 18:26:25 +030055 node_name: {{ HOSTNAME_CFG01 }}
Tatyana Leontovich2fec09a2017-08-22 13:52:11 +030056 retry: {count: 2, delay: 10}
57 skip_fail: false
58
59- description: Configure Prometheus exporters
60 cmd: salt -C 'I@prometheus:exporters' state.sls prometheus
61 node_name: {{ HOSTNAME_CFG01 }}
Tatyana Leontovichf00b2342017-07-04 18:26:25 +030062 retry: {count: 1, delay: 10}
63 skip_fail: false
64
65- description: Configure collector
66 cmd: salt -C 'I@heka:log_collector' state.sls heka.log_collector
Tatyana Leontovichc8b8ca22017-05-19 13:37:05 +030067 node_name: {{ HOSTNAME_CFG01 }}
68 retry: {count: 1, delay: 10}
Tatyana Leontovich5acc82a2017-05-23 15:41:35 +030069 skip_fail: false
Tatyana Leontovichc8b8ca22017-05-19 13:37:05 +030070
Tatyana Leontovich5acc82a2017-05-23 15:41:35 +030071- description: Install elasticsearch server
72 cmd: salt -C 'I@elasticsearch:server' state.sls elasticsearch.server -b 1
Tatyana Leontovichc8b8ca22017-05-19 13:37:05 +030073 node_name: {{ HOSTNAME_CFG01 }}
74 retry: {count: 1, delay: 10}
Tatyana Leontovich5acc82a2017-05-23 15:41:35 +030075 skip_fail: false
76
77- description: Install kibana server
78 cmd: salt -C 'I@kibana:server' state.sls kibana.server -b 1
79 node_name: {{ HOSTNAME_CFG01 }}
80 retry: {count: 1, delay: 10}
81 skip_fail: false
82
Tatyana Leontovich5acc82a2017-05-23 15:41:35 +030083- description: Install elasticsearch client
84 cmd: salt -C 'I@elasticsearch:client' state.sls elasticsearch.client
85 node_name: {{ HOSTNAME_CFG01 }}
86 retry: {count: 1, delay: 10}
87 skip_fail: false
88
89- description: Install kibana client
90 cmd: salt -C 'I@kibana:client' state.sls kibana.client
91 node_name: {{ HOSTNAME_CFG01 }}
92 retry: {count: 1, delay: 10}
93 skip_fail: false
94
Tatyana Leontovich3645d2b2017-06-13 16:51:23 +030095- description: Check influix db
96 cmd: |
97 INFLUXDB_SERVICE=`salt -C 'I@influxdb:server' test.ping 1>/dev/null 2>&1 && echo true`;
98 echo "Influxdb service presence: ${INFLUXDB_SERVICE}";
99 if [[ "$INFLUXDB_SERVICE" == "true" ]]; then
100 salt -C 'I@influxdb:server' state.sls influxdb
101 fi
102 node_name: {{ HOSTNAME_CFG01 }}
103 retry: {count: 1, delay: 5}
104 skip_fail: true
105
Tatyana Leontovich5acc82a2017-05-23 15:41:35 +0300106# Collect grains needed to configure the services
107
108- description: Get grains
109 cmd: salt -C 'I@salt:minion' state.sls salt.minion.grains
110 node_name: {{ HOSTNAME_CFG01 }}
111 retry: {count: 1, delay: 10}
112 skip_fail: false
113
114- description: Sync modules
115 cmd: salt -C 'I@salt:minion' saltutil.refresh_modules
116 node_name: {{ HOSTNAME_CFG01 }}
117 retry: {count: 1, delay: 10}
118 skip_fail: false
119
120- description: Update mine
121 cmd: salt -C 'I@salt:minion' mine.update; sleep 5;
122 node_name: {{ HOSTNAME_CFG01 }}
123 retry: {count: 1, delay: 10}
124 skip_fail: false
125
Tatyana Leontovichf00b2342017-07-04 18:26:25 +0300126# Change environment configuration before deploy
127- description: Set SL docker images deploy parameters
128 cmd: |
129 {% for sl_opt, value in config.sl_deploy.items() %}
130 {% if value|string() %}
131 salt-call reclass.cluster_meta_set {{ sl_opt }} {{ value }};
132 {% endif %}
133 {% endfor %}
134 node_name: {{ HOSTNAME_CFG01 }}
135 retry: {count: 1, delay: 1}
136 skip_fail: false
137
Tatyana Leontovich5acc82a2017-05-23 15:41:35 +0300138# Configure the services running in Docker Swarm
139- description: Install prometheus alertmanager
Tatyana Leontovichf00b2342017-07-04 18:26:25 +0300140 cmd: salt -C 'I@docker:swarm' state.sls prometheus,heka.remote_collector -b 1
Tatyana Leontovich5acc82a2017-05-23 15:41:35 +0300141 node_name: {{ HOSTNAME_CFG01 }}
142 retry: {count: 1, delay: 10}
143 skip_fail: false
144
Tatyana Leontovich5acc82a2017-05-23 15:41:35 +0300145- description: run docker state
146 cmd: salt -C 'I@docker:swarm:role:master' state.sls docker
147 node_name: {{ HOSTNAME_CFG01 }}
148 retry: {count: 1, delay: 10}
149 skip_fail: false
150
151- description: docker ps
152 cmd: salt -C 'I@docker:swarm' dockerng.ps
153 node_name: {{ HOSTNAME_CFG01 }}
154 retry: {count: 1, delay: 10}
155 skip_fail: false
156
157- description: Configure Grafana dashboards and datasources
Tatyana Leontovich572f7492017-07-14 13:36:11 +0300158 cmd: sleep 30; salt -C 'I@grafana:client' state.sls grafana.client
Tatyana Leontovich5acc82a2017-05-23 15:41:35 +0300159 node_name: {{ HOSTNAME_CFG01 }}
Tatyana Leontovich572f7492017-07-14 13:36:11 +0300160 retry: {count: 2, delay: 10}
Tatyana Leontovich5acc82a2017-05-23 15:41:35 +0300161 skip_fail: false
Tatyana Leontovichea450642017-07-11 18:56:11 +0300162
163- description: Run salt minion to create cert files
164 cmd: salt --hard-crash --state-output=mixed --state-verbose=False "*" state.sls salt.minion
165 node_name: {{ HOSTNAME_CFG01 }}
166 retry: {count: 1, delay: 10}
167 skip_fail: false
168