blob: 962035ca0e29f0d936ff3c92d1cc6d8a13bdc818 [file] [log] [blame]
Dennis Dmitriev411dd102017-09-15 16:04:47 +03001{% from 'cookied-mcp-ocata-dop-sl2/underlay.yaml' import HOSTNAME_CFG01 with context %}
Dennis Dmitriev386845b2017-11-21 13:11:12 +02002{% from 'cookied-mcp-ocata-dop-sl2/salt.yaml' import ENVIRONMENT_MODEL_INVENTORY_NAME with context %}
Dennis Dmitriev411dd102017-09-15 16:04:47 +03003
4# Install docker swarm
5- description: Install keepalived on mon nodes
6 cmd: salt --hard-crash --state-output=mixed --state-verbose=False
7 -C 'mon*' state.sls keepalived
8 node_name: {{ HOSTNAME_CFG01 }}
9 retry: {count: 1, delay: 10}
10 skip_fail: false
11
12- description: Check the VIP on StackLight mon nodes
13 cmd: |
14 SL_VIP=$(salt --out=newline_values_only "mon01*" pillar.get _param:cluster_vip_address);
15 echo "_param:cluster_vip_address (vip): ${SL_VIP}";
16 salt --hard-crash --state-output=mixed --state-verbose=False -C 'mon*' cmd.run "ip a | grep ${SL_VIP}" | grep -B1 ${SL_VIP}
17 node_name: {{ HOSTNAME_CFG01 }}
18 retry: {count: 1, delay: 5}
19 skip_fail: false
20
21- description: Configure docker service
Dennis Dmitriev281221b2018-02-13 16:40:48 +020022 cmd: salt --hard-crash --state-output=mixed --state-verbose=False -C 'I@docker:swarm' state.sls docker.host
Dennis Dmitriev411dd102017-09-15 16:04:47 +030023 node_name: {{ HOSTNAME_CFG01 }}
24 retry: {count: 1, delay: 10}
25 skip_fail: false
26
27- description: Install docker swarm on master node
Dennis Dmitriev281221b2018-02-13 16:40:48 +020028 cmd: salt --hard-crash --state-output=mixed --state-verbose=False -C 'I@docker:swarm:role:master' state.sls docker.swarm
Dennis Dmitriev411dd102017-09-15 16:04:47 +030029 node_name: {{ HOSTNAME_CFG01 }}
30 retry: {count: 1, delay: 10}
31 skip_fail: false
32
33- description: Send grains to the swarm slave nodes
Dennis Dmitriev281221b2018-02-13 16:40:48 +020034 cmd: salt --hard-crash --state-output=mixed --state-verbose=False -C 'I@docker:swarm' state.sls salt.minion.grains
Dennis Dmitriev411dd102017-09-15 16:04:47 +030035 node_name: {{ HOSTNAME_CFG01 }}
36 retry: {count: 1, delay: 10}
37 skip_fail: false
38
39- description: Update mine
Dennis Dmitriev281221b2018-02-13 16:40:48 +020040 cmd: salt --hard-crash --state-output=mixed --state-verbose=False -C 'I@docker:swarm' mine.update
Dennis Dmitriev411dd102017-09-15 16:04:47 +030041 node_name: {{ HOSTNAME_CFG01 }}
42 retry: {count: 1, delay: 10}
43 skip_fail: false
44
45- description: Refresh modules
Dennis Dmitriev281221b2018-02-13 16:40:48 +020046 cmd: salt --hard-crash --state-output=mixed --state-verbose=False -C 'I@docker:swarm' saltutil.refresh_modules; sleep 5;
Dennis Dmitriev411dd102017-09-15 16:04:47 +030047 node_name: {{ HOSTNAME_CFG01 }}
48 retry: {count: 1, delay: 10}
49 skip_fail: false
50
51- description: Rerun swarm on slaves to proper token population
Dennis Dmitriev281221b2018-02-13 16:40:48 +020052 cmd: salt --hard-crash --state-output=mixed --state-verbose=False -C 'I@docker:swarm:role:master' state.sls docker.swarm
Dennis Dmitriev411dd102017-09-15 16:04:47 +030053 node_name: {{ HOSTNAME_CFG01 }}
54 retry: {count: 1, delay: 10}
55 skip_fail: false
56
57- description: Configure slave nodes
Dennis Dmitriev281221b2018-02-13 16:40:48 +020058 cmd: salt --hard-crash --state-output=mixed --state-verbose=False -C 'I@docker:swarm:role:manager' state.sls docker.swarm -b 1
Dennis Dmitriev411dd102017-09-15 16:04:47 +030059 node_name: {{ HOSTNAME_CFG01 }}
60 retry: {count: 1, delay: 10}
61 skip_fail: false
62
63- description: List registered Docker swarm nodes
Dennis Dmitriev281221b2018-02-13 16:40:48 +020064 cmd: salt --hard-crash --state-output=mixed --state-verbose=False -C 'I@docker:swarm:role:master' cmd.run 'docker node ls'
Dennis Dmitriev411dd102017-09-15 16:04:47 +030065 node_name: {{ HOSTNAME_CFG01 }}
66 retry: {count: 1, delay: 10}
67 skip_fail: false
68
69# Install slv2 infra
70- description: Install telegraf
Dennis Dmitriev281221b2018-02-13 16:40:48 +020071 cmd: salt --hard-crash --state-output=mixed --state-verbose=False -C 'I@telegraf:agent or I@telegraf:remote_agent' state.sls telegraf
Dennis Dmitriev411dd102017-09-15 16:04:47 +030072 node_name: {{ HOSTNAME_CFG01 }}
73 retry: {count: 2, delay: 10}
74 skip_fail: false
75
76- description: Configure Prometheus exporters, if pillar 'prometheus:exporters' exists on any server
77 cmd: |
Dennis Dmitriev281221b2018-02-13 16:40:48 +020078 if salt --hard-crash --state-output=mixed --state-verbose=False -C 'I@prometheus:exporters' match.pillar 'prometheus:exporters' ; then
79 salt --hard-crash --state-output=mixed --state-verbose=False -C 'I@prometheus:exporters' state.sls prometheus
Dennis Dmitriev411dd102017-09-15 16:04:47 +030080 fi
81 node_name: {{ HOSTNAME_CFG01 }}
82 retry: {count: 1, delay: 10}
83 skip_fail: false
84
Dmitry Kalashnik78d99632018-02-05 17:10:13 +040085- description: Configure fluentd
Dennis Dmitriev281221b2018-02-13 16:40:48 +020086 cmd: salt --hard-crash --state-output=mixed --state-verbose=False -C 'I@fluentd:agent' state.sls fluentd
Dennis Dmitriev411dd102017-09-15 16:04:47 +030087 node_name: {{ HOSTNAME_CFG01 }}
88 retry: {count: 1, delay: 10}
89 skip_fail: false
90
91- description: Install elasticsearch server
Dennis Dmitriev281221b2018-02-13 16:40:48 +020092 cmd: salt --hard-crash --state-output=mixed --state-verbose=False -C 'I@elasticsearch:server' state.sls elasticsearch.server -b 1
Dennis Dmitriev411dd102017-09-15 16:04:47 +030093 node_name: {{ HOSTNAME_CFG01 }}
94 retry: {count: 1, delay: 10}
95 skip_fail: false
96
97- description: Install kibana server
Dennis Dmitriev281221b2018-02-13 16:40:48 +020098 cmd: salt --hard-crash --state-output=mixed --state-verbose=False -C 'I@kibana:server' state.sls kibana.server -b 1
Dennis Dmitriev411dd102017-09-15 16:04:47 +030099 node_name: {{ HOSTNAME_CFG01 }}
100 retry: {count: 1, delay: 10}
101 skip_fail: false
102
103- description: Install elasticsearch client
Dennis Dmitriev281221b2018-02-13 16:40:48 +0200104 cmd: salt --hard-crash --state-output=mixed --state-verbose=False -C 'I@elasticsearch:client' state.sls elasticsearch.client
Dennis Dmitriev411dd102017-09-15 16:04:47 +0300105 node_name: {{ HOSTNAME_CFG01 }}
106 retry: {count: 1, delay: 10}
107 skip_fail: false
108
109- description: Install kibana client
Dennis Dmitriev281221b2018-02-13 16:40:48 +0200110 cmd: salt --hard-crash --state-output=mixed --state-verbose=False -C 'I@kibana:client' state.sls kibana.client
Dennis Dmitriev411dd102017-09-15 16:04:47 +0300111 node_name: {{ HOSTNAME_CFG01 }}
112 retry: {count: 1, delay: 10}
113 skip_fail: false
114
115- description: Check influix db
116 cmd: |
Dennis Dmitriev281221b2018-02-13 16:40:48 +0200117 INFLUXDB_SERVICE=`salt --hard-crash --state-output=mixed --state-verbose=False -C 'I@influxdb:server' test.ping 1>/dev/null 2>&1 && echo true`;
Dennis Dmitriev411dd102017-09-15 16:04:47 +0300118 echo "Influxdb service presence: ${INFLUXDB_SERVICE}";
119 if [[ "$INFLUXDB_SERVICE" == "true" ]]; then
Dennis Dmitriev281221b2018-02-13 16:40:48 +0200120 salt --hard-crash --state-output=mixed --state-verbose=False -C 'I@influxdb:server' state.sls influxdb
Dennis Dmitriev411dd102017-09-15 16:04:47 +0300121 fi
122 node_name: {{ HOSTNAME_CFG01 }}
123 retry: {count: 1, delay: 5}
124 skip_fail: true
125
126# Collect grains needed to configure the services
127
128- description: Get grains
Dennis Dmitriev281221b2018-02-13 16:40:48 +0200129 cmd: salt --hard-crash --state-output=mixed --state-verbose=False -C 'I@salt:minion' state.sls salt.minion.grains
Dennis Dmitriev411dd102017-09-15 16:04:47 +0300130 node_name: {{ HOSTNAME_CFG01 }}
131 retry: {count: 1, delay: 10}
132 skip_fail: false
133
134- description: Sync modules
Dennis Dmitriev281221b2018-02-13 16:40:48 +0200135 cmd: salt --hard-crash --state-output=mixed --state-verbose=False -C 'I@salt:minion' saltutil.refresh_modules
Dennis Dmitriev411dd102017-09-15 16:04:47 +0300136 node_name: {{ HOSTNAME_CFG01 }}
137 retry: {count: 1, delay: 10}
138 skip_fail: false
139
140- description: Update mine
Dennis Dmitriev281221b2018-02-13 16:40:48 +0200141 cmd: salt --hard-crash --state-output=mixed --state-verbose=False -C 'I@salt:minion' mine.update; sleep 5;
Dennis Dmitriev411dd102017-09-15 16:04:47 +0300142 node_name: {{ HOSTNAME_CFG01 }}
143 retry: {count: 1, delay: 10}
144 skip_fail: false
145
Dennis Dmitriev411dd102017-09-15 16:04:47 +0300146# Configure the services running in Docker Swarm
147- description: Install prometheus alertmanager
Dmitry Kalashnik81444d92018-02-15 17:42:15 +0400148 cmd: salt --hard-crash --state-output=mixed --state-verbose=False -C 'I@prometheus:server' state.sls prometheus -b 1
Dennis Dmitriev411dd102017-09-15 16:04:47 +0300149 node_name: {{ HOSTNAME_CFG01 }}
150 retry: {count: 1, delay: 10}
151 skip_fail: false
152
153- description: run docker state
Dennis Dmitriev281221b2018-02-13 16:40:48 +0200154 cmd: salt --hard-crash --state-output=mixed --state-verbose=False -C 'I@docker:swarm:role:master' state.sls docker
Dennis Dmitriev411dd102017-09-15 16:04:47 +0300155 node_name: {{ HOSTNAME_CFG01 }}
156 retry: {count: 1, delay: 10}
157 skip_fail: false
158
159- description: docker ps
Dennis Dmitriev281221b2018-02-13 16:40:48 +0200160 cmd: salt --hard-crash --state-output=mixed --state-verbose=False -C 'I@docker:swarm' dockerng.ps
Dennis Dmitriev411dd102017-09-15 16:04:47 +0300161 node_name: {{ HOSTNAME_CFG01 }}
162 retry: {count: 1, delay: 10}
163 skip_fail: false
164
165- description: Configure Grafana dashboards and datasources
Dennis Dmitriev281221b2018-02-13 16:40:48 +0200166 cmd: sleep 30; salt --hard-crash --state-output=mixed --state-verbose=False -C 'I@grafana:client' state.sls grafana.client
Dennis Dmitriev411dd102017-09-15 16:04:47 +0300167 node_name: {{ HOSTNAME_CFG01 }}
168 retry: {count: 2, delay: 10}
169 skip_fail: false
170
171- description: Run salt minion to create cert files
172 cmd: salt --hard-crash --state-output=mixed --state-verbose=False "*" state.sls salt.minion
173 node_name: {{ HOSTNAME_CFG01 }}
174 retry: {count: 1, delay: 10}
175 skip_fail: false
176