blob: 74f9c09b44a7f9616b1929567b75aa3e3fe8b5d7 [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
4- description: Configure docker service
5 cmd: salt -C 'I@docker:swarm' state.sls docker.host
6 node_name: {{ HOSTNAME_CFG01 }}
7 retry: {count: 1, delay: 10}
8 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
45
46# Install slv2 infra
47- description: Install telegraf
Tatyana Leontovich09b7b012017-07-10 12:53:45 +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
Sergii Golovatiuk17ef1492017-05-29 19:54:03 +020055 node_name: {{ HOSTNAME_CFG01 }}
56 retry: {count: 1, delay: 10}
57 skip_fail: false
58
59- description: Install elasticsearch server
60 cmd: salt -C 'I@elasticsearch:server' state.sls elasticsearch.server -b 1
61 node_name: {{ HOSTNAME_CFG01 }}
62 retry: {count: 1, delay: 10}
63 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
Sergii Golovatiuk17ef1492017-05-29 19:54:03 +020071- 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 Leontovich09b7b012017-07-10 12:53:45 +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
Sergii Golovatiuk17ef1492017-05-29 19:54:03 +020094# 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 Leontovich09b7b012017-07-10 12:53:45 +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 %}
Sergii Golovatiuk17ef1492017-05-29 19:54:03 +0200122 node_name: {{ HOSTNAME_CFG01 }}
123 retry: {count: 1, delay: 1}
124 skip_fail: false
125
Tatyana Leontovich09b7b012017-07-10 12:53:45 +0300126# Configure the services running in Docker Swarm
127- description: Install prometheus alertmanager
128 cmd: salt -C 'I@docker:swarm' state.sls prometheus,heka.remote_collector -b 1
129 node_name: {{ HOSTNAME_CFG01 }}
130 retry: {count: 1, delay: 10}
131 skip_fail: false
132
Sergii Golovatiuk17ef1492017-05-29 19:54:03 +0200133- 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
Tatyana Leontovich6c696e62017-07-31 16:39:16 +0300145- description: Restart keepalived service
146 cmd: salt -C 'mon*' cmd.run "systemctl restart keepalived"
147 node_name: {{ HOSTNAME_CFG01 }}
148 retry: {count: 1, delay: 10}
149 skip_fail: false
150
151- description: Check the VIP
152 cmd: |
153 SL_MONITOR_ADDRESS=`salt-call --out=newline_values_only pillar.get _param:stacklight_monitor_address`;
154 echo "_param:stacklight_monitor_address (vip): ${SL_MONITOR_ADDRESS}";
155 salt --hard-crash --state-output=mixed --state-verbose=False -C 'mon*' cmd.run "ip a | grep ${SL_MONITOR_ADDRESS}" | grep -B1 ${SL_MONITOR_ADDRESS}
156 node_name: {{ HOSTNAME_CFG01 }}
157 retry: {count: 1, delay: 5}
158 skip_fail: false
159
Sergii Golovatiuk17ef1492017-05-29 19:54:03 +0200160- 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
Sergii Golovatiuk17ef1492017-05-29 19:54:03 +0200162 node_name: {{ HOSTNAME_CFG01 }}
Tatyana Leontovich572f7492017-07-14 13:36:11 +0300163 retry: {count: 2, delay: 10}
Sergii Golovatiuk17ef1492017-05-29 19:54:03 +0200164 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