Dennis Dmitriev | 67aea4a | 2018-03-14 14:20:20 +0200 | [diff] [blame] | 1 | {% from 'cookied-mcp-pike-ovs/underlay.yaml' import HOSTNAME_CFG01 with context %} |
Tatyana Leontovich | b0b68d9 | 2018-01-11 13:27:08 +0200 | [diff] [blame] | 2 | |
| 3 | {% import 'shared-sl-tests.yaml' as SHARED_SL_TESTS with context %} |
| 4 | |
| 5 | # Install docker swarm |
Tatyana Leontovich | b0b68d9 | 2018-01-11 13:27:08 +0200 | [diff] [blame] | 6 | - description: Configure docker service |
Dennis Dmitriev | 281221b | 2018-02-13 16:40:48 +0200 | [diff] [blame] | 7 | cmd: salt --hard-crash --state-output=mixed --state-verbose=False -C 'I@docker:swarm' state.sls docker.host |
Tatyana Leontovich | b0b68d9 | 2018-01-11 13:27:08 +0200 | [diff] [blame] | 8 | node_name: {{ HOSTNAME_CFG01 }} |
| 9 | retry: {count: 1, delay: 10} |
| 10 | skip_fail: false |
| 11 | |
| 12 | - description: Install docker swarm on master node |
Dennis Dmitriev | 281221b | 2018-02-13 16:40:48 +0200 | [diff] [blame] | 13 | cmd: salt --hard-crash --state-output=mixed --state-verbose=False -C 'I@docker:swarm:role:master' state.sls docker.swarm |
Tatyana Leontovich | b0b68d9 | 2018-01-11 13:27:08 +0200 | [diff] [blame] | 14 | node_name: {{ HOSTNAME_CFG01 }} |
| 15 | retry: {count: 1, delay: 10} |
| 16 | skip_fail: false |
| 17 | |
| 18 | - description: Send grains to the swarm slave nodes |
Dennis Dmitriev | 281221b | 2018-02-13 16:40:48 +0200 | [diff] [blame] | 19 | cmd: salt --hard-crash --state-output=mixed --state-verbose=False -C 'I@docker:swarm' state.sls salt.minion.grains |
Tatyana Leontovich | b0b68d9 | 2018-01-11 13:27:08 +0200 | [diff] [blame] | 20 | node_name: {{ HOSTNAME_CFG01 }} |
| 21 | retry: {count: 1, delay: 10} |
| 22 | skip_fail: false |
| 23 | |
| 24 | - description: Update mine |
Dennis Dmitriev | 281221b | 2018-02-13 16:40:48 +0200 | [diff] [blame] | 25 | cmd: salt --hard-crash --state-output=mixed --state-verbose=False -C 'I@docker:swarm' mine.update |
Tatyana Leontovich | b0b68d9 | 2018-01-11 13:27:08 +0200 | [diff] [blame] | 26 | node_name: {{ HOSTNAME_CFG01 }} |
| 27 | retry: {count: 1, delay: 10} |
| 28 | skip_fail: false |
| 29 | |
| 30 | - description: Refresh modules |
Dennis Dmitriev | 281221b | 2018-02-13 16:40:48 +0200 | [diff] [blame] | 31 | cmd: salt --hard-crash --state-output=mixed --state-verbose=False -C 'I@docker:swarm' saltutil.refresh_modules; sleep 5; |
Tatyana Leontovich | b0b68d9 | 2018-01-11 13:27:08 +0200 | [diff] [blame] | 32 | node_name: {{ HOSTNAME_CFG01 }} |
| 33 | retry: {count: 1, delay: 10} |
| 34 | skip_fail: false |
| 35 | |
| 36 | - description: Rerun swarm on slaves to proper token population |
Dennis Dmitriev | 281221b | 2018-02-13 16:40:48 +0200 | [diff] [blame] | 37 | cmd: salt --hard-crash --state-output=mixed --state-verbose=False -C 'I@docker:swarm:role:master' state.sls docker.swarm |
Tatyana Leontovich | b0b68d9 | 2018-01-11 13:27:08 +0200 | [diff] [blame] | 38 | node_name: {{ HOSTNAME_CFG01 }} |
| 39 | retry: {count: 1, delay: 10} |
| 40 | skip_fail: false |
| 41 | |
| 42 | - description: Configure slave nodes |
Dennis Dmitriev | 281221b | 2018-02-13 16:40:48 +0200 | [diff] [blame] | 43 | cmd: salt --hard-crash --state-output=mixed --state-verbose=False -C 'I@docker:swarm:role:manager' state.sls docker.swarm -b 1 |
Tatyana Leontovich | b0b68d9 | 2018-01-11 13:27:08 +0200 | [diff] [blame] | 44 | node_name: {{ HOSTNAME_CFG01 }} |
| 45 | retry: {count: 1, delay: 10} |
| 46 | skip_fail: false |
| 47 | |
| 48 | - description: List registered Docker swarm nodes |
Dennis Dmitriev | 281221b | 2018-02-13 16:40:48 +0200 | [diff] [blame] | 49 | cmd: salt --hard-crash --state-output=mixed --state-verbose=False -C 'I@docker:swarm:role:master' cmd.run 'docker node ls' |
Tatyana Leontovich | b0b68d9 | 2018-01-11 13:27:08 +0200 | [diff] [blame] | 50 | node_name: {{ HOSTNAME_CFG01 }} |
| 51 | retry: {count: 1, delay: 10} |
| 52 | skip_fail: false |
| 53 | |
Dennis Dmitriev | 002c267 | 2018-03-06 18:43:27 +0200 | [diff] [blame] | 54 | - description: Install keepalived on mon nodes |
| 55 | cmd: salt --hard-crash --state-output=mixed --state-verbose=False |
| 56 | -C 'mon*' state.sls keepalived |
| 57 | node_name: {{ HOSTNAME_CFG01 }} |
| 58 | retry: {count: 1, delay: 10} |
| 59 | skip_fail: false |
| 60 | |
| 61 | - description: Check the VIP on mon nodes |
| 62 | cmd: | |
| 63 | SL_VIP=`salt-call --out=newline_values_only pillar.get _param:stacklight_monitor_address`; |
| 64 | echo "_param:stacklight_monitor_address (vip): ${SL_VIP}"; |
| 65 | salt --hard-crash --state-output=mixed --state-verbose=False -C 'mon*' cmd.run "ip a | grep ${SL_VIP}" | grep -B1 ${SL_VIP} |
| 66 | node_name: {{ HOSTNAME_CFG01 }} |
| 67 | retry: {count: 1, delay: 5} |
| 68 | skip_fail: false |
| 69 | |
Tatyana Leontovich | b0b68d9 | 2018-01-11 13:27:08 +0200 | [diff] [blame] | 70 | # Install slv2 infra |
Tatyana Leontovich | d033346 | 2018-03-16 12:40:44 +0200 | [diff] [blame] | 71 | #Launch containers |
| 72 | - description: launch prometheus containers |
| 73 | cmd: salt --hard-crash --state-output=mixed --state-verbose=False -C 'I@docker:swarm:role:master and I@prometheus:server' state.sls docker.client |
| 74 | node_name: {{ HOSTNAME_CFG01 }} |
| 75 | retry: {count: 2, delay: 10} |
| 76 | skip_fail: false |
| 77 | |
| 78 | - description: Check docker ps |
| 79 | cmd: salt --hard-crash --state-output=mixed --state-verbose=False -C 'I@docker:swarm and I@prometheus:server' cmd.run "docker ps" |
| 80 | node_name: {{ HOSTNAME_CFG01 }} |
| 81 | retry: {count: 2, delay: 10} |
| 82 | skip_fail: false |
| 83 | |
Tatyana Leontovich | b0b68d9 | 2018-01-11 13:27:08 +0200 | [diff] [blame] | 84 | - description: Install telegraf |
Dennis Dmitriev | 281221b | 2018-02-13 16:40:48 +0200 | [diff] [blame] | 85 | cmd: salt --hard-crash --state-output=mixed --state-verbose=False -C 'I@telegraf:agent or I@telegraf:remote_agent' state.sls telegraf |
Tatyana Leontovich | b0b68d9 | 2018-01-11 13:27:08 +0200 | [diff] [blame] | 86 | node_name: {{ HOSTNAME_CFG01 }} |
| 87 | retry: {count: 2, delay: 10} |
| 88 | skip_fail: false |
| 89 | |
Tatyana Leontovich | d033346 | 2018-03-16 12:40:44 +0200 | [diff] [blame] | 90 | - description: Configure Prometheus exporters, if pillar 'prometheus:exporters' exists on any server |
| 91 | cmd: | |
| 92 | if salt --hard-crash --state-output=mixed --state-verbose=False -C 'I@prometheus:exporters' match.pillar 'prometheus:exporters' ; then |
| 93 | salt --hard-crash --state-output=mixed --state-verbose=False -C 'I@prometheus:exporters' state.sls prometheus |
| 94 | fi |
Tatyana Leontovich | b0b68d9 | 2018-01-11 13:27:08 +0200 | [diff] [blame] | 95 | node_name: {{ HOSTNAME_CFG01 }} |
| 96 | retry: {count: 1, delay: 10} |
| 97 | skip_fail: false |
| 98 | |
| 99 | - description: Install elasticsearch server |
Dennis Dmitriev | 281221b | 2018-02-13 16:40:48 +0200 | [diff] [blame] | 100 | cmd: salt --hard-crash --state-output=mixed --state-verbose=False -C 'I@elasticsearch:server' state.sls elasticsearch.server -b 1 |
Tatyana Leontovich | b0b68d9 | 2018-01-11 13:27:08 +0200 | [diff] [blame] | 101 | node_name: {{ HOSTNAME_CFG01 }} |
| 102 | retry: {count: 1, delay: 10} |
| 103 | skip_fail: false |
| 104 | |
| 105 | - description: Install kibana server |
Dennis Dmitriev | 281221b | 2018-02-13 16:40:48 +0200 | [diff] [blame] | 106 | cmd: salt --hard-crash --state-output=mixed --state-verbose=False -C 'I@kibana:server' state.sls kibana.server -b 1 |
Tatyana Leontovich | b0b68d9 | 2018-01-11 13:27:08 +0200 | [diff] [blame] | 107 | node_name: {{ HOSTNAME_CFG01 }} |
| 108 | retry: {count: 1, delay: 10} |
| 109 | skip_fail: false |
| 110 | |
| 111 | - description: Install elasticsearch client |
Dennis Dmitriev | 281221b | 2018-02-13 16:40:48 +0200 | [diff] [blame] | 112 | cmd: salt --hard-crash --state-output=mixed --state-verbose=False -C 'I@elasticsearch:client' state.sls elasticsearch.client |
Tatyana Leontovich | b0b68d9 | 2018-01-11 13:27:08 +0200 | [diff] [blame] | 113 | node_name: {{ HOSTNAME_CFG01 }} |
| 114 | retry: {count: 1, delay: 10} |
| 115 | skip_fail: false |
| 116 | |
| 117 | - description: Install kibana client |
Dennis Dmitriev | 281221b | 2018-02-13 16:40:48 +0200 | [diff] [blame] | 118 | cmd: salt --hard-crash --state-output=mixed --state-verbose=False -C 'I@kibana:client' state.sls kibana.client |
Tatyana Leontovich | b0b68d9 | 2018-01-11 13:27:08 +0200 | [diff] [blame] | 119 | node_name: {{ HOSTNAME_CFG01 }} |
| 120 | retry: {count: 1, delay: 10} |
| 121 | skip_fail: false |
| 122 | |
| 123 | - description: Check influix db |
| 124 | cmd: | |
Dennis Dmitriev | 281221b | 2018-02-13 16:40:48 +0200 | [diff] [blame] | 125 | INFLUXDB_SERVICE=`salt --hard-crash --state-output=mixed --state-verbose=False -C 'I@influxdb:server' test.ping 1>/dev/null 2>&1 && echo true`; |
Tatyana Leontovich | b0b68d9 | 2018-01-11 13:27:08 +0200 | [diff] [blame] | 126 | echo "Influxdb service presence: ${INFLUXDB_SERVICE}"; |
| 127 | if [[ "$INFLUXDB_SERVICE" == "true" ]]; then |
Dennis Dmitriev | 281221b | 2018-02-13 16:40:48 +0200 | [diff] [blame] | 128 | salt --hard-crash --state-output=mixed --state-verbose=False -C 'I@influxdb:server' state.sls influxdb |
Tatyana Leontovich | b0b68d9 | 2018-01-11 13:27:08 +0200 | [diff] [blame] | 129 | fi |
| 130 | node_name: {{ HOSTNAME_CFG01 }} |
| 131 | retry: {count: 1, delay: 5} |
| 132 | skip_fail: true |
| 133 | |
Tatyana Leontovich | cdca5d9 | 2018-03-16 18:31:50 +0200 | [diff] [blame] | 134 | # Install Prometheus LTS(optional if set in model) |
| 135 | - description: Prometheus LTS(optional if set in model) |
| 136 | cmd: | |
| 137 | PROMETHEUS_SERVICE=`salt --hard-crash --state-output=mixed --state-verbose=False -C 'I@prometheus:relay' test.ping 1>/dev/null 2>&1 && echo true`; |
| 138 | echo "PROMETHEUS rely service presence: ${PROMETHEUS_SERVICE}"; |
| 139 | if [[ "$PROMETHEUS_SERVICE" == "true" ]]; then |
| 140 | salt --hard-crash --state-output=mixed --state-verbose=False -C 'I@prometheus:relay' state.sls prometheus |
| 141 | fi |
| 142 | node_name: {{ HOSTNAME_CFG01 }} |
| 143 | retry: {count: 1, delay: 5} |
| 144 | skip_fail: true |
| 145 | |
Tatyana Leontovich | d033346 | 2018-03-16 12:40:44 +0200 | [diff] [blame] | 146 | # Install service for the log collection |
| 147 | - description: Configure fluentd |
| 148 | cmd: | |
| 149 | FLUENTD_SERVICE=`salt --hard-crash --state-output=mixed --state-verbose=False -C 'I@fluentd:agent' test.ping 1>/dev/null 2>&1 && echo true`; |
| 150 | echo "Fluentd service presence: ${FLUENTD_SERVICE}"; |
Tatyana Leontovich | 88cd51b | 2018-03-17 00:05:14 +0200 | [diff] [blame] | 151 | if [[ "$FLUENTD_SERVICE" == "true" ]]; then |
Tatyana Leontovich | d033346 | 2018-03-16 12:40:44 +0200 | [diff] [blame] | 152 | salt --hard-crash --state-output=mixed --state-verbose=False -C 'I@fluentd:agent' state.sls fluentd |
| 153 | else |
| 154 | salt --hard-crash --state-output=mixed --state-verbose=False -C 'I@heka:log_collector' state.sls heka.log_collector |
| 155 | fi |
| 156 | node_name: {{ HOSTNAME_CFG01 }} |
| 157 | retry: {count: 1, delay: 10} |
| 158 | skip_fail: false |
| 159 | |
| 160 | #Install heka ceilometer collector |
| 161 | - description: Install heka ceilometer if they exists |
| 162 | cmd: | |
| 163 | CEILO=`salt --hard-crash --state-output=mixed --state-verbose=False -C 'I@heka:ceilometer_collector:enabled' test.ping 1>/dev/null 2>&1 && echo true`; |
| 164 | echo "Ceilometer service presence: ${CEILO}"; |
Tatyana Leontovich | 88cd51b | 2018-03-17 00:05:14 +0200 | [diff] [blame] | 165 | if [[ "$CEILO" == "true" ]]; then |
Tatyana Leontovich | d033346 | 2018-03-16 12:40:44 +0200 | [diff] [blame] | 166 | salt --hard-crash --state-output=mixed --state-verbose=False -C 'I@heka:ceilometer_collector:enabled' state.sls heka.ceilometer_collector; |
Dennis Dmitriev | d7ebbaf | 2018-03-20 05:44:30 +0200 | [diff] [blame^] | 167 | salt --hard-crash --state-output=mixed --state-verbose=False -C 'I@heka:ceilometer_collector:enabled' service.restart ceilometer_collector |
Tatyana Leontovich | d033346 | 2018-03-16 12:40:44 +0200 | [diff] [blame] | 168 | fi |
| 169 | node_name: {{ HOSTNAME_CFG01 }} |
| 170 | retry: {count: 1, delay: 10} |
| 171 | skip_fail: false |
| 172 | |
Tatyana Leontovich | b0b68d9 | 2018-01-11 13:27:08 +0200 | [diff] [blame] | 173 | # Collect grains needed to configure the services |
| 174 | |
| 175 | - description: Get grains |
Dennis Dmitriev | 281221b | 2018-02-13 16:40:48 +0200 | [diff] [blame] | 176 | cmd: salt --hard-crash --state-output=mixed --state-verbose=False -C 'I@salt:minion' state.sls salt.minion.grains |
Tatyana Leontovich | b0b68d9 | 2018-01-11 13:27:08 +0200 | [diff] [blame] | 177 | node_name: {{ HOSTNAME_CFG01 }} |
| 178 | retry: {count: 1, delay: 10} |
| 179 | skip_fail: false |
| 180 | |
| 181 | - description: Sync modules |
Dennis Dmitriev | 281221b | 2018-02-13 16:40:48 +0200 | [diff] [blame] | 182 | cmd: salt --hard-crash --state-output=mixed --state-verbose=False -C 'I@salt:minion' saltutil.refresh_modules |
Tatyana Leontovich | b0b68d9 | 2018-01-11 13:27:08 +0200 | [diff] [blame] | 183 | node_name: {{ HOSTNAME_CFG01 }} |
| 184 | retry: {count: 1, delay: 10} |
| 185 | skip_fail: false |
| 186 | |
| 187 | - description: Update mine |
Dennis Dmitriev | 281221b | 2018-02-13 16:40:48 +0200 | [diff] [blame] | 188 | cmd: salt --hard-crash --state-output=mixed --state-verbose=False -C 'I@salt:minion' mine.update; sleep 5; |
Tatyana Leontovich | b0b68d9 | 2018-01-11 13:27:08 +0200 | [diff] [blame] | 189 | node_name: {{ HOSTNAME_CFG01 }} |
Tatyana Leontovich | d033346 | 2018-03-16 12:40:44 +0200 | [diff] [blame] | 190 | retry: {count: 5, delay: 15} |
Tatyana Leontovich | b0b68d9 | 2018-01-11 13:27:08 +0200 | [diff] [blame] | 191 | skip_fail: false |
| 192 | |
| 193 | # Configure the services running in Docker Swarm |
Tatyana Leontovich | d033346 | 2018-03-16 12:40:44 +0200 | [diff] [blame] | 194 | - description: Configure prometheus in docker swarm |
| 195 | cmd: salt --hard-crash --state-output=mixed --state-verbose=False -C 'I@docker:swarm and I@prometheus:server' state.sls prometheus |
Tatyana Leontovich | b0b68d9 | 2018-01-11 13:27:08 +0200 | [diff] [blame] | 196 | node_name: {{ HOSTNAME_CFG01 }} |
| 197 | retry: {count: 1, delay: 10} |
| 198 | skip_fail: false |
| 199 | |
Tatyana Leontovich | d033346 | 2018-03-16 12:40:44 +0200 | [diff] [blame] | 200 | - description: Configure Remote Collector in Docker Swarm for Openstack deployments |
| 201 | cmd: salt --hard-crash --state-output=mixed --state-verbose=False -C 'I@docker:swarm and I@prometheus:server' state.sls heka.remote_collector |
Tatyana Leontovich | b0b68d9 | 2018-01-11 13:27:08 +0200 | [diff] [blame] | 202 | node_name: {{ HOSTNAME_CFG01 }} |
| 203 | retry: {count: 1, delay: 10} |
| 204 | skip_fail: false |
| 205 | |
Tatyana Leontovich | d033346 | 2018-03-16 12:40:44 +0200 | [diff] [blame] | 206 | - description: Install sphinx |
| 207 | cmd: salt --hard-crash --state-output=mixed --state-verbose=False -C 'I@sphinx:server' state.sls sphinx |
Tatyana Leontovich | b0b68d9 | 2018-01-11 13:27:08 +0200 | [diff] [blame] | 208 | node_name: {{ HOSTNAME_CFG01 }} |
| 209 | retry: {count: 1, delay: 10} |
| 210 | skip_fail: false |
| 211 | |
Tatyana Leontovich | d033346 | 2018-03-16 12:40:44 +0200 | [diff] [blame] | 212 | |
| 213 | #- description: Install prometheus alertmanager |
| 214 | # cmd: salt --hard-crash --state-output=mixed --state-verbose=False -C 'I@docker:swarm' state.sls prometheus,heka.remote_collector -b 1 |
| 215 | # node_name: {{ HOSTNAME_CFG01 }} |
| 216 | # retry: {count: 1, delay: 10} |
| 217 | # skip_fail: false |
| 218 | |
| 219 | #- description: run docker state |
| 220 | # cmd: salt --hard-crash --state-output=mixed --state-verbose=False -C 'I@docker:swarm:role:master' state.sls docker |
| 221 | # node_name: {{ HOSTNAME_CFG01 }} |
| 222 | # retry: {count: 1, delay: 10} |
| 223 | # skip_fail: false |
| 224 | # |
| 225 | #- description: docker ps |
| 226 | # cmd: salt --hard-crash --state-output=mixed --state-verbose=False -C 'I@docker:swarm' dockerng.ps |
| 227 | # node_name: {{ HOSTNAME_CFG01 }} |
| 228 | # retry: {count: 1, delay: 10} |
| 229 | # skip_fail: false |
| 230 | |
Tatyana Leontovich | b0b68d9 | 2018-01-11 13:27:08 +0200 | [diff] [blame] | 231 | - description: Configure Grafana dashboards and datasources |
Dennis Dmitriev | 281221b | 2018-02-13 16:40:48 +0200 | [diff] [blame] | 232 | cmd: sleep 30; salt --hard-crash --state-output=mixed --state-verbose=False -C 'I@grafana:client' state.sls grafana.client |
Tatyana Leontovich | b0b68d9 | 2018-01-11 13:27:08 +0200 | [diff] [blame] | 233 | node_name: {{ HOSTNAME_CFG01 }} |
| 234 | retry: {count: 2, delay: 10} |
| 235 | skip_fail: false |
| 236 | |
| 237 | - description: Run salt minion to create cert files |
| 238 | cmd: salt --hard-crash --state-output=mixed --state-verbose=False "*" state.sls salt.minion |
| 239 | node_name: {{ HOSTNAME_CFG01 }} |
| 240 | retry: {count: 1, delay: 10} |
| 241 | skip_fail: false |
| 242 | |
| 243 | {{ SHARED_SL_TESTS.MACRO_CLONE_SL_TESTS() }} |
| 244 | {{ SHARED_SL_TESTS.MACRO_CONFIGURE_TESTS() }} |