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