blob: 3369f635139ccd3d26481ab5ad027fd5f7574a32 [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
Dennis Dmitrievcc6e9b52017-09-01 11:27:58 +030059- description: Configure Prometheus exporters, if pillar 'prometheus:exporters' exists on any server
60 cmd: |
61 if salt -C 'I@prometheus:exporters' match.pillar 'prometheus:exporters' ; then
62 salt -C 'I@prometheus:exporters' state.sls prometheus
63 fi
Tatyana Leontovich2fec09a2017-08-22 13:52:11 +030064 node_name: {{ HOSTNAME_CFG01 }}
Tatyana Leontovichf00b2342017-07-04 18:26:25 +030065 retry: {count: 1, delay: 10}
66 skip_fail: false
67
68- description: Configure collector
69 cmd: salt -C 'I@heka:log_collector' state.sls heka.log_collector
Tatyana Leontovichc8b8ca22017-05-19 13:37:05 +030070 node_name: {{ HOSTNAME_CFG01 }}
71 retry: {count: 1, delay: 10}
Tatyana Leontovich5acc82a2017-05-23 15:41:35 +030072 skip_fail: false
Tatyana Leontovichc8b8ca22017-05-19 13:37:05 +030073
Tatyana Leontovich5acc82a2017-05-23 15:41:35 +030074- description: Install elasticsearch server
75 cmd: salt -C 'I@elasticsearch:server' state.sls elasticsearch.server -b 1
Tatyana Leontovichc8b8ca22017-05-19 13:37:05 +030076 node_name: {{ HOSTNAME_CFG01 }}
77 retry: {count: 1, delay: 10}
Tatyana Leontovich5acc82a2017-05-23 15:41:35 +030078 skip_fail: false
79
80- description: Install kibana server
81 cmd: salt -C 'I@kibana:server' state.sls kibana.server -b 1
82 node_name: {{ HOSTNAME_CFG01 }}
83 retry: {count: 1, delay: 10}
84 skip_fail: false
85
Tatyana Leontovich5acc82a2017-05-23 15:41:35 +030086- description: Install elasticsearch client
87 cmd: salt -C 'I@elasticsearch:client' state.sls elasticsearch.client
88 node_name: {{ HOSTNAME_CFG01 }}
89 retry: {count: 1, delay: 10}
90 skip_fail: false
91
92- description: Install kibana client
93 cmd: salt -C 'I@kibana:client' state.sls kibana.client
94 node_name: {{ HOSTNAME_CFG01 }}
95 retry: {count: 1, delay: 10}
96 skip_fail: false
97
Tatyana Leontovich3645d2b2017-06-13 16:51:23 +030098- description: Check influix db
99 cmd: |
100 INFLUXDB_SERVICE=`salt -C 'I@influxdb:server' test.ping 1>/dev/null 2>&1 && echo true`;
101 echo "Influxdb service presence: ${INFLUXDB_SERVICE}";
102 if [[ "$INFLUXDB_SERVICE" == "true" ]]; then
103 salt -C 'I@influxdb:server' state.sls influxdb
104 fi
105 node_name: {{ HOSTNAME_CFG01 }}
106 retry: {count: 1, delay: 5}
107 skip_fail: true
108
Tatyana Leontovich5acc82a2017-05-23 15:41:35 +0300109# Collect grains needed to configure the services
110
111- description: Get grains
112 cmd: salt -C 'I@salt:minion' state.sls salt.minion.grains
113 node_name: {{ HOSTNAME_CFG01 }}
114 retry: {count: 1, delay: 10}
115 skip_fail: false
116
117- description: Sync modules
118 cmd: salt -C 'I@salt:minion' saltutil.refresh_modules
119 node_name: {{ HOSTNAME_CFG01 }}
120 retry: {count: 1, delay: 10}
121 skip_fail: false
122
123- description: Update mine
124 cmd: salt -C 'I@salt:minion' mine.update; sleep 5;
125 node_name: {{ HOSTNAME_CFG01 }}
126 retry: {count: 1, delay: 10}
127 skip_fail: false
128
Tatyana Leontovichf00b2342017-07-04 18:26:25 +0300129# Change environment configuration before deploy
130- description: Set SL docker images deploy parameters
131 cmd: |
132 {% for sl_opt, value in config.sl_deploy.items() %}
133 {% if value|string() %}
134 salt-call reclass.cluster_meta_set {{ sl_opt }} {{ value }};
135 {% endif %}
136 {% endfor %}
137 node_name: {{ HOSTNAME_CFG01 }}
138 retry: {count: 1, delay: 1}
139 skip_fail: false
140
Tatyana Leontovich5acc82a2017-05-23 15:41:35 +0300141# Configure the services running in Docker Swarm
142- description: Install prometheus alertmanager
Tatyana Leontovichf00b2342017-07-04 18:26:25 +0300143 cmd: salt -C 'I@docker:swarm' state.sls prometheus,heka.remote_collector -b 1
Tatyana Leontovich5acc82a2017-05-23 15:41:35 +0300144 node_name: {{ HOSTNAME_CFG01 }}
145 retry: {count: 1, delay: 10}
146 skip_fail: false
147
Tatyana Leontovich5acc82a2017-05-23 15:41:35 +0300148- description: run docker state
149 cmd: salt -C 'I@docker:swarm:role:master' state.sls docker
150 node_name: {{ HOSTNAME_CFG01 }}
151 retry: {count: 1, delay: 10}
152 skip_fail: false
153
154- description: docker ps
155 cmd: salt -C 'I@docker:swarm' dockerng.ps
156 node_name: {{ HOSTNAME_CFG01 }}
157 retry: {count: 1, delay: 10}
158 skip_fail: false
159
160- description: Configure Grafana dashboards and datasources
Tatyana Leontovich572f7492017-07-14 13:36:11 +0300161 cmd: sleep 30; salt -C 'I@grafana:client' state.sls grafana.client
Tatyana Leontovich5acc82a2017-05-23 15:41:35 +0300162 node_name: {{ HOSTNAME_CFG01 }}
Tatyana Leontovich572f7492017-07-14 13:36:11 +0300163 retry: {count: 2, delay: 10}
Tatyana Leontovich5acc82a2017-05-23 15:41:35 +0300164 skip_fail: false
Tatyana Leontovichea450642017-07-11 18:56:11 +0300165
166- description: Run salt minion to create cert files
167 cmd: salt --hard-crash --state-output=mixed --state-verbose=False "*" state.sls salt.minion
168 node_name: {{ HOSTNAME_CFG01 }}
169 retry: {count: 1, delay: 10}
170 skip_fail: false
171