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