blob: 37c8e0c72df1c374910ae62765144e096386f52f [file] [log] [blame]
sgudz8c888ec2017-10-02 15:29:23 +03001{% from 'cookied-bm-mcp-ocata-contrail/underlay.yaml' import HOSTNAME_CFG01 with context %}
2
sgudzcced67d2017-10-11 15:56:09 +03003# Install docker swarm.
sgudz8c888ec2017-10-02 15:29:23 +03004- description: Configure docker service
Dennis Dmitriev281221b2018-02-13 16:40:48 +02005 cmd: salt --hard-crash --state-output=mixed --state-verbose=False -C 'I@docker:swarm' state.sls docker.host
sgudz8c888ec2017-10-02 15:29:23 +03006 node_name: {{ HOSTNAME_CFG01 }}
7 retry: {count: 1, delay: 10}
8 skip_fail: false
9
10- description: Install docker swarm on master node
Dennis Dmitriev281221b2018-02-13 16:40:48 +020011 cmd: salt --hard-crash --state-output=mixed --state-verbose=False -C 'I@docker:swarm:role:master' state.sls docker.swarm
sgudz8c888ec2017-10-02 15:29:23 +030012 node_name: {{ HOSTNAME_CFG01 }}
13 retry: {count: 1, delay: 10}
14 skip_fail: false
15
16- description: Send grains to the swarm slave nodes
Dennis Dmitriev281221b2018-02-13 16:40:48 +020017 cmd: salt --hard-crash --state-output=mixed --state-verbose=False -C 'I@docker:swarm' state.sls salt.minion.grains
sgudz8c888ec2017-10-02 15:29:23 +030018 node_name: {{ HOSTNAME_CFG01 }}
19 retry: {count: 1, delay: 10}
20 skip_fail: false
21
22- description: Update mine
Dennis Dmitriev281221b2018-02-13 16:40:48 +020023 cmd: salt --hard-crash --state-output=mixed --state-verbose=False -C 'I@docker:swarm' mine.update
sgudz8c888ec2017-10-02 15:29:23 +030024 node_name: {{ HOSTNAME_CFG01 }}
25 retry: {count: 1, delay: 10}
26 skip_fail: false
27
28- description: Refresh modules
Dennis Dmitriev281221b2018-02-13 16:40:48 +020029 cmd: salt --hard-crash --state-output=mixed --state-verbose=False -C 'I@docker:swarm' saltutil.refresh_modules; sleep 5;
sgudz8c888ec2017-10-02 15:29:23 +030030 node_name: {{ HOSTNAME_CFG01 }}
31 retry: {count: 1, delay: 10}
32 skip_fail: false
33
34- description: Rerun swarm on slaves to proper token population
Dennis Dmitriev281221b2018-02-13 16:40:48 +020035 cmd: salt --hard-crash --state-output=mixed --state-verbose=False -C 'I@docker:swarm:role:master' state.sls docker.swarm
sgudz8c888ec2017-10-02 15:29:23 +030036 node_name: {{ HOSTNAME_CFG01 }}
37 retry: {count: 1, delay: 10}
38 skip_fail: false
39
40- description: Configure slave nodes
Dennis Dmitriev281221b2018-02-13 16:40:48 +020041 cmd: salt --hard-crash --state-output=mixed --state-verbose=False -C 'I@docker:swarm:role:manager' state.sls docker.swarm -b 1
sgudz8c888ec2017-10-02 15:29:23 +030042 node_name: {{ HOSTNAME_CFG01 }}
43 retry: {count: 1, delay: 10}
44 skip_fail: false
45
46- description: List registered Docker swarm nodes
Dennis Dmitriev281221b2018-02-13 16:40:48 +020047 cmd: salt --hard-crash --state-output=mixed --state-verbose=False -C 'I@docker:swarm:role:master' cmd.run 'docker node ls'
sgudz8c888ec2017-10-02 15:29:23 +030048 node_name: {{ HOSTNAME_CFG01 }}
49 retry: {count: 1, delay: 10}
50 skip_fail: false
51
Dennis Dmitriev002c2672018-03-06 18:43:27 +020052- description: Install keepalived on mon nodes
53 cmd: salt --hard-crash --state-output=mixed --state-verbose=False
54 -C 'mon*' state.sls keepalived
55 node_name: {{ HOSTNAME_CFG01 }}
56 retry: {count: 1, delay: 10}
57 skip_fail: false
58
59- description: Check the VIP on StackLight mon nodes
60 cmd: |
61 SL_VIP=$(salt --out=newline_values_only "mon01*" pillar.get _param:cluster_vip_address);
62 echo "_param:cluster_vip_address (vip): ${SL_VIP}";
63 salt --hard-crash --state-output=mixed --state-verbose=False -C 'mon*' cmd.run "ip a | grep ${SL_VIP}" | grep -B1 ${SL_VIP}
64 node_name: {{ HOSTNAME_CFG01 }}
65 retry: {count: 1, delay: 5}
66 skip_fail: false
67
sgudz8c888ec2017-10-02 15:29:23 +030068# Install slv2 infra
69- description: Install telegraf
Dennis Dmitriev281221b2018-02-13 16:40:48 +020070 cmd: salt --hard-crash --state-output=mixed --state-verbose=False -C 'I@telegraf:agent or I@telegraf:remote_agent' state.sls telegraf
sgudz8c888ec2017-10-02 15:29:23 +030071 node_name: {{ HOSTNAME_CFG01 }}
72 retry: {count: 2, delay: 10}
73 skip_fail: false
74
75- description: Configure Prometheus exporters, if pillar 'prometheus:exporters' exists on any server
76 cmd: |
Dennis Dmitriev281221b2018-02-13 16:40:48 +020077 if salt --hard-crash --state-output=mixed --state-verbose=False -C 'I@prometheus:exporters' match.pillar 'prometheus:exporters' ; then
78 salt --hard-crash --state-output=mixed --state-verbose=False -C 'I@prometheus:exporters' state.sls prometheus
sgudz8c888ec2017-10-02 15:29:23 +030079 fi
80 node_name: {{ HOSTNAME_CFG01 }}
81 retry: {count: 1, delay: 10}
82 skip_fail: false
83
84- description: Configure collector
Dennis Dmitriev281221b2018-02-13 16:40:48 +020085 cmd: salt --hard-crash --state-output=mixed --state-verbose=False -C 'I@heka:log_collector' state.sls heka.log_collector
sgudz8c888ec2017-10-02 15:29:23 +030086 node_name: {{ HOSTNAME_CFG01 }}
87 retry: {count: 1, delay: 10}
88 skip_fail: false
89
90- description: Install elasticsearch server
Dennis Dmitriev281221b2018-02-13 16:40:48 +020091 cmd: salt --hard-crash --state-output=mixed --state-verbose=False -C 'I@elasticsearch:server' state.sls elasticsearch.server -b 1
sgudz8c888ec2017-10-02 15:29:23 +030092 node_name: {{ HOSTNAME_CFG01 }}
93 retry: {count: 1, delay: 10}
94 skip_fail: false
95
96- description: Install kibana server
Dennis Dmitriev281221b2018-02-13 16:40:48 +020097 cmd: salt --hard-crash --state-output=mixed --state-verbose=False -C 'I@kibana:server' state.sls kibana.server -b 1
sgudz8c888ec2017-10-02 15:29:23 +030098 node_name: {{ HOSTNAME_CFG01 }}
99 retry: {count: 1, delay: 10}
100 skip_fail: false
101
102- description: Install elasticsearch client
Dennis Dmitriev281221b2018-02-13 16:40:48 +0200103 cmd: salt --hard-crash --state-output=mixed --state-verbose=False -C 'I@elasticsearch:client' state.sls elasticsearch.client
sgudz8c888ec2017-10-02 15:29:23 +0300104 node_name: {{ HOSTNAME_CFG01 }}
105 retry: {count: 1, delay: 10}
106 skip_fail: false
107
108- description: Install kibana client
Dennis Dmitriev281221b2018-02-13 16:40:48 +0200109 cmd: salt --hard-crash --state-output=mixed --state-verbose=False -C 'I@kibana:client' state.sls kibana.client
sgudz8c888ec2017-10-02 15:29:23 +0300110 node_name: {{ HOSTNAME_CFG01 }}
111 retry: {count: 1, delay: 10}
112 skip_fail: false
113
114- description: Check influix db
115 cmd: |
Dennis Dmitriev281221b2018-02-13 16:40:48 +0200116 INFLUXDB_SERVICE=`salt --hard-crash --state-output=mixed --state-verbose=False -C 'I@influxdb:server' test.ping 1>/dev/null 2>&1 && echo true`;
sgudz8c888ec2017-10-02 15:29:23 +0300117 echo "Influxdb service presence: ${INFLUXDB_SERVICE}";
118 if [[ "$INFLUXDB_SERVICE" == "true" ]]; then
Dennis Dmitriev281221b2018-02-13 16:40:48 +0200119 salt --hard-crash --state-output=mixed --state-verbose=False -C 'I@influxdb:server' state.sls influxdb
sgudz8c888ec2017-10-02 15:29:23 +0300120 fi
121 node_name: {{ HOSTNAME_CFG01 }}
122 retry: {count: 1, delay: 5}
123 skip_fail: true
124
125# Collect grains needed to configure the services
126
127- description: Get grains
Dennis Dmitriev281221b2018-02-13 16:40:48 +0200128 cmd: salt --hard-crash --state-output=mixed --state-verbose=False -C 'I@salt:minion' state.sls salt.minion.grains
sgudz8c888ec2017-10-02 15:29:23 +0300129 node_name: {{ HOSTNAME_CFG01 }}
130 retry: {count: 1, delay: 10}
131 skip_fail: false
132
133- description: Sync modules
Dennis Dmitriev281221b2018-02-13 16:40:48 +0200134 cmd: salt --hard-crash --state-output=mixed --state-verbose=False -C 'I@salt:minion' saltutil.refresh_modules
sgudz8c888ec2017-10-02 15:29:23 +0300135 node_name: {{ HOSTNAME_CFG01 }}
136 retry: {count: 1, delay: 10}
137 skip_fail: false
138
139- description: Update mine
Dennis Dmitriev281221b2018-02-13 16:40:48 +0200140 cmd: salt --hard-crash --state-output=mixed --state-verbose=False -C 'I@salt:minion' mine.update; sleep 5;
sgudz8c888ec2017-10-02 15:29:23 +0300141 node_name: {{ HOSTNAME_CFG01 }}
142 retry: {count: 1, delay: 10}
143 skip_fail: false
144
sgudz8c888ec2017-10-02 15:29:23 +0300145# Configure the services running in Docker Swarm
146- description: Install prometheus alertmanager
Dennis Dmitriev281221b2018-02-13 16:40:48 +0200147 cmd: salt --hard-crash --state-output=mixed --state-verbose=False -C 'I@docker:swarm' state.sls prometheus,heka.remote_collector -b 1
sgudz8c888ec2017-10-02 15:29:23 +0300148 node_name: {{ HOSTNAME_CFG01 }}
sgudzcced67d2017-10-11 15:56:09 +0300149 retry: {count: 2, delay: 10}
sgudz8c888ec2017-10-02 15:29:23 +0300150 skip_fail: false
151
152- description: run docker state
Dennis Dmitriev281221b2018-02-13 16:40:48 +0200153 cmd: salt --hard-crash --state-output=mixed --state-verbose=False -C 'I@docker:swarm:role:master' state.sls docker
sgudz8c888ec2017-10-02 15:29:23 +0300154 node_name: {{ HOSTNAME_CFG01 }}
sgudzcced67d2017-10-11 15:56:09 +0300155 retry: {count: 2, delay: 120}
sgudz8c888ec2017-10-02 15:29:23 +0300156 skip_fail: false
157
158- description: docker ps
Dennis Dmitriev281221b2018-02-13 16:40:48 +0200159 cmd: sleep 120; salt --hard-crash --state-output=mixed --state-verbose=False -C 'I@docker:swarm' dockerng.ps
sgudz8c888ec2017-10-02 15:29:23 +0300160 node_name: {{ HOSTNAME_CFG01 }}
161 retry: {count: 1, delay: 10}
162 skip_fail: false
163
164- description: Configure Grafana dashboards and datasources
Dennis Dmitriev281221b2018-02-13 16:40:48 +0200165 cmd: sleep 60; salt --hard-crash --state-output=mixed --state-verbose=False -C 'I@grafana:client' state.sls grafana.client
sgudz8c888ec2017-10-02 15:29:23 +0300166 node_name: {{ HOSTNAME_CFG01 }}
167 retry: {count: 2, delay: 10}
168 skip_fail: false
169
170- description: Run salt minion to create cert files
171 cmd: salt --hard-crash --state-output=mixed --state-verbose=False "*" state.sls salt.minion
172 node_name: {{ HOSTNAME_CFG01 }}
173 retry: {count: 1, delay: 10}
174 skip_fail: false
175