blob: f77f60e982ecf74290e0a91bf7decc13f961f280 [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
Tatyana Leontovichf00b2342017-07-04 18:26:25 +030048 cmd: salt -C 'I@telegraf:agentor or I@telegraf:remote_agent' state.sls telegraf
49 node_name: {{ HOSTNAME_CFG01 }}
50 retry: {count: 1, delay: 10}
51 skip_fail: false
52
53- description: Configure collector
54 cmd: salt -C 'I@heka:log_collector' state.sls heka.log_collector
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
Tatyana Leontovichc8b8ca22017-05-19 13:37:05 +030058
Tatyana Leontovich5acc82a2017-05-23 15:41:35 +030059- description: Install elasticsearch server
60 cmd: salt -C 'I@elasticsearch:server' state.sls elasticsearch.server -b 1
Tatyana Leontovichc8b8ca22017-05-19 13:37:05 +030061 node_name: {{ HOSTNAME_CFG01 }}
62 retry: {count: 1, delay: 10}
Tatyana Leontovich5acc82a2017-05-23 15:41:35 +030063 skip_fail: false
64
65- description: Install kibana server
66 cmd: salt -C 'I@kibana:server' state.sls kibana.server -b 1
67 node_name: {{ HOSTNAME_CFG01 }}
68 retry: {count: 1, delay: 10}
69 skip_fail: false
70
Tatyana Leontovich5acc82a2017-05-23 15:41:35 +030071- description: Install elasticsearch client
72 cmd: salt -C 'I@elasticsearch:client' state.sls elasticsearch.client
73 node_name: {{ HOSTNAME_CFG01 }}
74 retry: {count: 1, delay: 10}
75 skip_fail: false
76
77- description: Install kibana client
78 cmd: salt -C 'I@kibana:client' state.sls kibana.client
79 node_name: {{ HOSTNAME_CFG01 }}
80 retry: {count: 1, delay: 10}
81 skip_fail: false
82
Tatyana Leontovich3645d2b2017-06-13 16:51:23 +030083- description: Check influix db
84 cmd: |
85 INFLUXDB_SERVICE=`salt -C 'I@influxdb:server' test.ping 1>/dev/null 2>&1 && echo true`;
86 echo "Influxdb service presence: ${INFLUXDB_SERVICE}";
87 if [[ "$INFLUXDB_SERVICE" == "true" ]]; then
88 salt -C 'I@influxdb:server' state.sls influxdb
89 fi
90 node_name: {{ HOSTNAME_CFG01 }}
91 retry: {count: 1, delay: 5}
92 skip_fail: true
93
Tatyana Leontovich5acc82a2017-05-23 15:41:35 +030094# Collect grains needed to configure the services
95
96- description: Get grains
97 cmd: salt -C 'I@salt:minion' state.sls salt.minion.grains
98 node_name: {{ HOSTNAME_CFG01 }}
99 retry: {count: 1, delay: 10}
100 skip_fail: false
101
102- description: Sync modules
103 cmd: salt -C 'I@salt:minion' saltutil.refresh_modules
104 node_name: {{ HOSTNAME_CFG01 }}
105 retry: {count: 1, delay: 10}
106 skip_fail: false
107
108- description: Update mine
109 cmd: salt -C 'I@salt:minion' mine.update; sleep 5;
110 node_name: {{ HOSTNAME_CFG01 }}
111 retry: {count: 1, delay: 10}
112 skip_fail: false
113
Tatyana Leontovichf00b2342017-07-04 18:26:25 +0300114# Change environment configuration before deploy
115- description: Set SL docker images deploy parameters
116 cmd: |
117 {% for sl_opt, value in config.sl_deploy.items() %}
118 {% if value|string() %}
119 salt-call reclass.cluster_meta_set {{ sl_opt }} {{ value }};
120 {% endif %}
121 {% endfor %}
122 node_name: {{ HOSTNAME_CFG01 }}
123 retry: {count: 1, delay: 1}
124 skip_fail: false
125
Tatyana Leontovich5acc82a2017-05-23 15:41:35 +0300126# Configure the services running in Docker Swarm
127- description: Install prometheus alertmanager
Tatyana Leontovichf00b2342017-07-04 18:26:25 +0300128 cmd: salt -C 'I@docker:swarm' state.sls prometheus,heka.remote_collector -b 1
Tatyana Leontovich5acc82a2017-05-23 15:41:35 +0300129 node_name: {{ HOSTNAME_CFG01 }}
130 retry: {count: 1, delay: 10}
131 skip_fail: false
132
Tatyana Leontovich5acc82a2017-05-23 15:41:35 +0300133- description: run docker state
134 cmd: salt -C 'I@docker:swarm:role:master' state.sls docker
135 node_name: {{ HOSTNAME_CFG01 }}
136 retry: {count: 1, delay: 10}
137 skip_fail: false
138
139- description: docker ps
140 cmd: salt -C 'I@docker:swarm' dockerng.ps
141 node_name: {{ HOSTNAME_CFG01 }}
142 retry: {count: 1, delay: 10}
143 skip_fail: false
144
145- description: Configure Grafana dashboards and datasources
Tatyana Leontovich572f7492017-07-14 13:36:11 +0300146 cmd: sleep 30; salt -C 'I@grafana:client' state.sls grafana.client
Tatyana Leontovich5acc82a2017-05-23 15:41:35 +0300147 node_name: {{ HOSTNAME_CFG01 }}
Tatyana Leontovich572f7492017-07-14 13:36:11 +0300148 retry: {count: 2, delay: 10}
Tatyana Leontovich5acc82a2017-05-23 15:41:35 +0300149 skip_fail: false
Tatyana Leontovichea450642017-07-11 18:56:11 +0300150
151- description: Run salt minion to create cert files
152 cmd: salt --hard-crash --state-output=mixed --state-verbose=False "*" state.sls salt.minion
153 node_name: {{ HOSTNAME_CFG01 }}
154 retry: {count: 1, delay: 10}
155 skip_fail: false
156