sgudz | d7f8ec9 | 2018-04-19 16:22:47 +0300 | [diff] [blame] | 1 | {% from 'cookied-bm-mcp-ocata-contrail-nfv/underlay.yaml' import HOSTNAME_CFG01 with context %} |
sgudz | e12b509 | 2018-09-15 00:40:10 +0300 | [diff] [blame] | 2 | {% import 'shared-sl-tests.yaml' as SHARED_SL_TESTS with context %} |
sgudz | d7f8ec9 | 2018-04-19 16:22:47 +0300 | [diff] [blame] | 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 | |
sgudz | e12b509 | 2018-09-15 00:40:10 +0300 | [diff] [blame] | 69 | - description: Install keepalived on mon nodes |
| 70 | cmd: salt --hard-crash --state-output=mixed --state-verbose=False |
| 71 | -C 'I@glusterfs:client' state.sls glusterfs.client |
| 72 | node_name: {{ HOSTNAME_CFG01 }} |
| 73 | retry: {count: 2, delay: 15} |
| 74 | skip_fail: false |
| 75 | |
sgudz | d7f8ec9 | 2018-04-19 16:22:47 +0300 | [diff] [blame] | 76 | # Install slv2 infra |
| 77 | #Launch containers |
Tatyana Leontovich | 48a6af9 | 2018-06-04 15:16:20 +0300 | [diff] [blame] | 78 | - description: Install Mongo if target matches |
| 79 | cmd: | |
| 80 | if salt --hard-crash --state-output=mixed --state-verbose=False -C 'I@mongodb:server' match.pillar 'mongodb:server' ; then |
sgudz | e12b509 | 2018-09-15 00:40:10 +0300 | [diff] [blame] | 81 | salt --hard-crash --state-output=mixed --state-verbose=False -C 'I@mongodb:server' state.sls mongodb.server |
Tatyana Leontovich | 48a6af9 | 2018-06-04 15:16:20 +0300 | [diff] [blame] | 82 | fi |
| 83 | node_name: {{ HOSTNAME_CFG01 }} |
| 84 | retry: {count: 1, delay: 10} |
| 85 | skip_fail: false |
| 86 | |
sgudz | e12b509 | 2018-09-15 00:40:10 +0300 | [diff] [blame] | 87 | - description: Install Mongo if target matches |
Tatyana Leontovich | 48a6af9 | 2018-06-04 15:16:20 +0300 | [diff] [blame] | 88 | cmd: | |
sgudz | e12b509 | 2018-09-15 00:40:10 +0300 | [diff] [blame] | 89 | if salt --hard-crash --state-output=mixed --state-verbose=False -C 'I@mongodb:server' match.pillar 'mongodb:server' ; then |
| 90 | salt --hard-crash --state-output=mixed --state-verbose=False -C 'I@mongodb:server' state.sls mongodb.cluster |
Tatyana Leontovich | 48a6af9 | 2018-06-04 15:16:20 +0300 | [diff] [blame] | 91 | fi |
| 92 | node_name: {{ HOSTNAME_CFG01 }} |
sgudz | e12b509 | 2018-09-15 00:40:10 +0300 | [diff] [blame] | 93 | retry: {count: 5, delay: 20} |
sgudz | d7f8ec9 | 2018-04-19 16:22:47 +0300 | [diff] [blame] | 94 | skip_fail: false |
| 95 | |
| 96 | - description: Install telegraf |
| 97 | cmd: salt --hard-crash --state-output=mixed --state-verbose=False -C 'I@telegraf:agent or I@telegraf:remote_agent' state.sls telegraf |
| 98 | node_name: {{ HOSTNAME_CFG01 }} |
| 99 | retry: {count: 2, delay: 10} |
| 100 | skip_fail: false |
| 101 | |
| 102 | - description: Configure Prometheus exporters, if pillar 'prometheus:exporters' exists on any server |
| 103 | cmd: | |
| 104 | if salt --hard-crash --state-output=mixed --state-verbose=False -C 'I@prometheus:exporters' match.pillar 'prometheus:exporters' ; then |
| 105 | salt --hard-crash --state-output=mixed --state-verbose=False -C 'I@prometheus:exporters' state.sls prometheus |
| 106 | fi |
| 107 | node_name: {{ HOSTNAME_CFG01 }} |
| 108 | retry: {count: 1, delay: 10} |
| 109 | skip_fail: false |
| 110 | |
| 111 | - description: Install elasticsearch server |
sgudz | e12b509 | 2018-09-15 00:40:10 +0300 | [diff] [blame] | 112 | cmd: salt --hard-crash --state-output=mixed --state-verbose=False -C 'I@elasticsearch:server:enabled:true and *01*' state.sls elasticsearch.server |
| 113 | node_name: {{ HOSTNAME_CFG01 }} |
| 114 | retry: {count: 1, delay: 10} |
| 115 | skip_fail: false |
| 116 | |
| 117 | - description: Install elasticsearch server |
| 118 | cmd: salt --hard-crash --state-output=mixed --state-verbose=False -C 'I@elasticsearch:server:enabled:true' state.sls elasticsearch.server |
sgudz | d7f8ec9 | 2018-04-19 16:22:47 +0300 | [diff] [blame] | 119 | node_name: {{ HOSTNAME_CFG01 }} |
| 120 | retry: {count: 1, delay: 10} |
| 121 | skip_fail: false |
| 122 | |
| 123 | - description: Install kibana server |
sgudz | e12b509 | 2018-09-15 00:40:10 +0300 | [diff] [blame] | 124 | cmd: salt --hard-crash --state-output=mixed --state-verbose=False -C 'I@kibana:server:enabled:true and *01*' state.sls kibana.server |
| 125 | node_name: {{ HOSTNAME_CFG01 }} |
| 126 | retry: {count: 1, delay: 10} |
| 127 | skip_fail: false |
| 128 | |
| 129 | - description: Install kibana server |
| 130 | cmd: salt --hard-crash --state-output=mixed --state-verbose=False -C 'I@kibana:server:enabled:true' state.sls kibana.server |
sgudz | d7f8ec9 | 2018-04-19 16:22:47 +0300 | [diff] [blame] | 131 | node_name: {{ HOSTNAME_CFG01 }} |
| 132 | retry: {count: 1, delay: 10} |
| 133 | skip_fail: false |
| 134 | |
| 135 | - description: Install elasticsearch client |
sgudz | e12b509 | 2018-09-15 00:40:10 +0300 | [diff] [blame] | 136 | cmd: sleep 30; salt --hard-crash --state-output=mixed --state-verbose=False -C 'I@elasticsearch:client' state.sls elasticsearch.client |
sgudz | d7f8ec9 | 2018-04-19 16:22:47 +0300 | [diff] [blame] | 137 | node_name: {{ HOSTNAME_CFG01 }} |
Dennis Dmitriev | 4ad63e4 | 2018-05-01 05:18:54 +0300 | [diff] [blame] | 138 | retry: {count: 2, delay: 30} |
sgudz | d7f8ec9 | 2018-04-19 16:22:47 +0300 | [diff] [blame] | 139 | skip_fail: false |
| 140 | |
| 141 | - description: Install kibana client |
| 142 | cmd: salt --hard-crash --state-output=mixed --state-verbose=False -C 'I@kibana:client' state.sls kibana.client |
| 143 | node_name: {{ HOSTNAME_CFG01 }} |
| 144 | retry: {count: 1, delay: 10} |
| 145 | skip_fail: false |
| 146 | |
| 147 | - description: Check influix db |
| 148 | cmd: | |
| 149 | INFLUXDB_SERVICE=`salt --hard-crash --state-output=mixed --state-verbose=False -C 'I@influxdb:server' test.ping 1>/dev/null 2>&1 && echo true`; |
| 150 | echo "Influxdb service presence: ${INFLUXDB_SERVICE}"; |
| 151 | if [[ "$INFLUXDB_SERVICE" == "true" ]]; then |
sgudz | e12b509 | 2018-09-15 00:40:10 +0300 | [diff] [blame] | 152 | salt --hard-crash --state-output=mixed --state-verbose=False -C 'I@influxdb:server and *01*' state.sls influxdb; |
| 153 | salt --hard-crash --state-output=mixed --state-verbose=False -C 'I@influxdb:server' state.sls influxdb; |
sgudz | d7f8ec9 | 2018-04-19 16:22:47 +0300 | [diff] [blame] | 154 | fi |
| 155 | node_name: {{ HOSTNAME_CFG01 }} |
| 156 | retry: {count: 1, delay: 5} |
sgudz | e12b509 | 2018-09-15 00:40:10 +0300 | [diff] [blame] | 157 | skip_fail: false |
sgudz | d7f8ec9 | 2018-04-19 16:22:47 +0300 | [diff] [blame] | 158 | |
| 159 | # Install service for the log collection |
| 160 | - description: Configure fluentd |
| 161 | cmd: | |
| 162 | FLUENTD_SERVICE=`salt --hard-crash --state-output=mixed --state-verbose=False -C 'I@fluentd:agent' test.ping 1>/dev/null 2>&1 && echo true`; |
| 163 | echo "Fluentd service presence: ${FLUENTD_SERVICE}"; |
| 164 | if [[ "$FLUENTD_SERVICE" == "true" ]]; then |
| 165 | salt --hard-crash --state-output=mixed --state-verbose=False -C 'I@fluentd:agent' state.sls fluentd |
| 166 | else |
| 167 | salt --hard-crash --state-output=mixed --state-verbose=False -C 'I@heka:log_collector' state.sls heka.log_collector |
| 168 | fi |
| 169 | node_name: {{ HOSTNAME_CFG01 }} |
| 170 | retry: {count: 1, delay: 10} |
| 171 | skip_fail: false |
| 172 | |
| 173 | #Install heka ceilometer collector |
| 174 | - description: Install heka ceilometer if they exists |
| 175 | cmd: | |
| 176 | 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`; |
| 177 | echo "Ceilometer service presence: ${CEILO}"; |
| 178 | if [[ "$CEILO" == "true" ]]; then |
| 179 | salt --hard-crash --state-output=mixed --state-verbose=False -C 'I@heka:ceilometer_collector:enabled' state.sls heka.ceilometer_collector; |
| 180 | salt --hard-crash --state-output=mixed --state-verbose=False -C 'I@heka:ceilometer_collector:enabled' service.restart ceilometer_collector |
| 181 | fi |
| 182 | node_name: {{ HOSTNAME_CFG01 }} |
| 183 | retry: {count: 1, delay: 10} |
| 184 | skip_fail: false |
| 185 | |
sgudz | e12b509 | 2018-09-15 00:40:10 +0300 | [diff] [blame] | 186 | ###################################### |
| 187 | ###################################### |
| 188 | ###################################### |
sgudz | d7f8ec9 | 2018-04-19 16:22:47 +0300 | [diff] [blame] | 189 | |
sgudz | e12b509 | 2018-09-15 00:40:10 +0300 | [diff] [blame] | 190 | - description: Collect Grains |
| 191 | cmd: | |
| 192 | salt --hard-crash --state-output=mixed --state-verbose=False -C 'I@salt:minion' state.sls salt.minion.grains; |
| 193 | salt --hard-crash --state-output=mixed --state-verbose=False -C 'I@salt:minion' saltutil.refresh_modules; |
| 194 | salt --hard-crash --state-output=mixed --state-verbose=False -C 'I@salt:minion' mine.update |
sgudz | d7f8ec9 | 2018-04-19 16:22:47 +0300 | [diff] [blame] | 195 | node_name: {{ HOSTNAME_CFG01 }} |
| 196 | retry: {count: 1, delay: 10} |
| 197 | skip_fail: false |
| 198 | |
sgudz | e12b509 | 2018-09-15 00:40:10 +0300 | [diff] [blame] | 199 | - description: Check docker ps |
sgudz | d7f8ec9 | 2018-04-19 16:22:47 +0300 | [diff] [blame] | 200 | cmd: salt --hard-crash --state-output=mixed --state-verbose=False -C 'I@docker:swarm and I@prometheus:server' state.sls prometheus |
| 201 | node_name: {{ HOSTNAME_CFG01 }} |
sgudz | e12b509 | 2018-09-15 00:40:10 +0300 | [diff] [blame] | 202 | retry: {count: 2, delay: 10} |
sgudz | d7f8ec9 | 2018-04-19 16:22:47 +0300 | [diff] [blame] | 203 | skip_fail: false |
| 204 | |
| 205 | - description: Configure Remote Collector in Docker Swarm for Openstack deployments |
| 206 | cmd: salt --hard-crash --state-output=mixed --state-verbose=False -C 'I@docker:swarm and I@prometheus:server' state.sls heka.remote_collector |
| 207 | node_name: {{ HOSTNAME_CFG01 }} |
| 208 | retry: {count: 1, delay: 10} |
| 209 | skip_fail: false |
| 210 | |
sgudz | e12b509 | 2018-09-15 00:40:10 +0300 | [diff] [blame] | 211 | - description: launch prometheus containers |
| 212 | cmd: salt --hard-crash --state-output=mixed --state-verbose=False -C 'I@docker:swarm:role:master and I@prometheus:server' state.sls docker.client |
sgudz | d7f8ec9 | 2018-04-19 16:22:47 +0300 | [diff] [blame] | 213 | node_name: {{ HOSTNAME_CFG01 }} |
| 214 | retry: {count: 2, delay: 10} |
| 215 | skip_fail: false |
| 216 | |
sgudz | e12b509 | 2018-09-15 00:40:10 +0300 | [diff] [blame] | 217 | - description: Check docker ps |
| 218 | cmd: salt --hard-crash --state-output=mixed --state-verbose=False -C 'I@docker:swarm and I@prometheus:server' cmd.run "docker ps" |
sgudz | d7f8ec9 | 2018-04-19 16:22:47 +0300 | [diff] [blame] | 219 | node_name: {{ HOSTNAME_CFG01 }} |
| 220 | retry: {count: 1, delay: 10} |
| 221 | skip_fail: false |
sgudz | e12b509 | 2018-09-15 00:40:10 +0300 | [diff] [blame] | 222 | |
| 223 | - description: Configure Grafana dashboards and datasources |
| 224 | cmd: salt --hard-crash --state-output=mixed --state-verbose=False -C 'I@grafana:client' state.sls grafana.client |
| 225 | node_name: {{ HOSTNAME_CFG01 }} |
| 226 | retry: {count: 5, delay: 60} |
| 227 | skip_fail: false |
| 228 | |
| 229 | - description: Configure Alerta if it is exists |
| 230 | cmd: | |
| 231 | if salt --hard-crash --state-output=mixed --state-verbose=False -C 'I@prometheus:alerta' match.pillar 'prometheus:alerta' ; then |
| 232 | salt --hard-crash --state-output=mixed --state-verbose=False -C 'I@docker:swarm and I@prometheus:alerta' state.sls prometheus.alerta |
| 233 | fi |
| 234 | node_name: {{ HOSTNAME_CFG01 }} |
| 235 | retry: {count: 1, delay: 10} |
| 236 | skip_fail: false |
| 237 | |
| 238 | - description: Run salt minion to create cert files |
| 239 | cmd: salt --hard-crash --state-output=mixed --state-verbose=False "*" state.sls salt.minion.cert |
| 240 | node_name: {{ HOSTNAME_CFG01 }} |
| 241 | retry: {count: 1, delay: 10} |
| 242 | skip_fail: true |
| 243 | |
| 244 | {{ SHARED_SL_TESTS.MACRO_CLONE_SL_TESTS() }} |
| 245 | {{ SHARED_SL_TESTS.MACRO_CONFIGURE_TESTS() }} |