Tatyana Leontovich | 19a8ca5 | 2017-09-08 12:24:28 +0300 | [diff] [blame] | 1 | {% from 'virtual-mcp-ocata-ovs/underlay.yaml' import HOSTNAME_CFG01 with context %} |
| 2 | |
| 3 | {% import 'shared-sl-tests.yaml' as SHARED_SL_TESTS with context %} |
Tatyana Leontovich | 126b003 | 2017-08-30 20:51:20 +0300 | [diff] [blame] | 4 | |
| 5 | # Install docker swarm |
| 6 | - description: Install keepalived on mon nodes |
| 7 | cmd: salt --hard-crash --state-output=mixed --state-verbose=False |
| 8 | -C 'mon*' state.sls keepalived |
| 9 | node_name: {{ HOSTNAME_CFG01 }} |
| 10 | retry: {count: 1, delay: 10} |
| 11 | skip_fail: false |
| 12 | |
| 13 | - description: Check the VIP on mon nodes |
| 14 | cmd: | |
| 15 | SL_VIP=`salt-call --out=newline_values_only pillar.get _param:stacklight_monitor_address`; |
| 16 | echo "_param:stacklight_monitor_address (vip): ${SL_VIP}"; |
| 17 | salt --hard-crash --state-output=mixed --state-verbose=False -C 'mon*' cmd.run "ip a | grep ${SL_VIP}" | grep -B1 ${SL_VIP} |
| 18 | node_name: {{ HOSTNAME_CFG01 }} |
| 19 | retry: {count: 1, delay: 5} |
| 20 | skip_fail: false |
| 21 | |
| 22 | - description: Configure docker service |
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' state.sls docker.host |
Tatyana Leontovich | 126b003 | 2017-08-30 20:51:20 +0300 | [diff] [blame] | 24 | node_name: {{ HOSTNAME_CFG01 }} |
| 25 | retry: {count: 1, delay: 10} |
| 26 | skip_fail: false |
| 27 | |
| 28 | - description: Install docker swarm on master node |
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:role:master' state.sls docker.swarm |
Tatyana Leontovich | 126b003 | 2017-08-30 20:51:20 +0300 | [diff] [blame] | 30 | node_name: {{ HOSTNAME_CFG01 }} |
| 31 | retry: {count: 1, delay: 10} |
| 32 | skip_fail: false |
| 33 | |
| 34 | - description: Send grains to the swarm slave nodes |
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' state.sls salt.minion.grains |
Tatyana Leontovich | 126b003 | 2017-08-30 20:51:20 +0300 | [diff] [blame] | 36 | node_name: {{ HOSTNAME_CFG01 }} |
| 37 | retry: {count: 1, delay: 10} |
| 38 | skip_fail: false |
| 39 | |
| 40 | - description: Update mine |
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' mine.update |
Tatyana Leontovich | 126b003 | 2017-08-30 20:51:20 +0300 | [diff] [blame] | 42 | node_name: {{ HOSTNAME_CFG01 }} |
| 43 | retry: {count: 1, delay: 10} |
| 44 | skip_fail: false |
| 45 | |
| 46 | - description: Refresh modules |
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' saltutil.refresh_modules; sleep 5; |
Tatyana Leontovich | 126b003 | 2017-08-30 20:51:20 +0300 | [diff] [blame] | 48 | node_name: {{ HOSTNAME_CFG01 }} |
| 49 | retry: {count: 1, delay: 10} |
| 50 | skip_fail: false |
| 51 | |
| 52 | - description: Rerun swarm on slaves to proper token population |
Dennis Dmitriev | 281221b | 2018-02-13 16:40:48 +0200 | [diff] [blame^] | 53 | cmd: salt --hard-crash --state-output=mixed --state-verbose=False -C 'I@docker:swarm:role:master' state.sls docker.swarm |
Tatyana Leontovich | 126b003 | 2017-08-30 20:51:20 +0300 | [diff] [blame] | 54 | node_name: {{ HOSTNAME_CFG01 }} |
| 55 | retry: {count: 1, delay: 10} |
| 56 | skip_fail: false |
| 57 | |
| 58 | - description: Configure slave nodes |
Dennis Dmitriev | 281221b | 2018-02-13 16:40:48 +0200 | [diff] [blame^] | 59 | cmd: salt --hard-crash --state-output=mixed --state-verbose=False -C 'I@docker:swarm:role:manager' state.sls docker.swarm -b 1 |
Tatyana Leontovich | 126b003 | 2017-08-30 20:51:20 +0300 | [diff] [blame] | 60 | node_name: {{ HOSTNAME_CFG01 }} |
| 61 | retry: {count: 1, delay: 10} |
| 62 | skip_fail: false |
| 63 | |
| 64 | - description: List registered Docker swarm nodes |
Dennis Dmitriev | 281221b | 2018-02-13 16:40:48 +0200 | [diff] [blame^] | 65 | cmd: salt --hard-crash --state-output=mixed --state-verbose=False -C 'I@docker:swarm:role:master' cmd.run 'docker node ls' |
Tatyana Leontovich | 126b003 | 2017-08-30 20:51:20 +0300 | [diff] [blame] | 66 | node_name: {{ HOSTNAME_CFG01 }} |
| 67 | retry: {count: 1, delay: 10} |
| 68 | skip_fail: false |
| 69 | |
| 70 | # Install slv2 infra |
| 71 | - description: Install telegraf |
Dennis Dmitriev | 281221b | 2018-02-13 16:40:48 +0200 | [diff] [blame^] | 72 | cmd: salt --hard-crash --state-output=mixed --state-verbose=False -C 'I@telegraf:agent or I@telegraf:remote_agent' state.sls telegraf |
Tatyana Leontovich | 126b003 | 2017-08-30 20:51:20 +0300 | [diff] [blame] | 73 | node_name: {{ HOSTNAME_CFG01 }} |
| 74 | retry: {count: 2, delay: 10} |
| 75 | skip_fail: false |
| 76 | |
| 77 | - description: Configure Prometheus exporters |
Dennis Dmitriev | 281221b | 2018-02-13 16:40:48 +0200 | [diff] [blame^] | 78 | cmd: salt --hard-crash --state-output=mixed --state-verbose=False -C 'I@prometheus:exporters' state.sls prometheus |
Tatyana Leontovich | 126b003 | 2017-08-30 20:51:20 +0300 | [diff] [blame] | 79 | node_name: {{ HOSTNAME_CFG01 }} |
| 80 | retry: {count: 1, delay: 10} |
| 81 | skip_fail: false |
| 82 | |
| 83 | - description: Configure collector |
Dennis Dmitriev | 281221b | 2018-02-13 16:40:48 +0200 | [diff] [blame^] | 84 | cmd: salt --hard-crash --state-output=mixed --state-verbose=False -C 'I@heka:log_collector' state.sls heka.log_collector |
Tatyana Leontovich | 126b003 | 2017-08-30 20:51:20 +0300 | [diff] [blame] | 85 | node_name: {{ HOSTNAME_CFG01 }} |
| 86 | retry: {count: 1, delay: 10} |
| 87 | skip_fail: false |
| 88 | |
| 89 | - description: Install elasticsearch server |
Dennis Dmitriev | 281221b | 2018-02-13 16:40:48 +0200 | [diff] [blame^] | 90 | cmd: salt --hard-crash --state-output=mixed --state-verbose=False -C 'I@elasticsearch:server' state.sls elasticsearch.server -b 1 |
Tatyana Leontovich | 126b003 | 2017-08-30 20:51:20 +0300 | [diff] [blame] | 91 | node_name: {{ HOSTNAME_CFG01 }} |
| 92 | retry: {count: 1, delay: 10} |
| 93 | skip_fail: false |
| 94 | |
| 95 | - description: Install kibana server |
Dennis Dmitriev | 281221b | 2018-02-13 16:40:48 +0200 | [diff] [blame^] | 96 | cmd: salt --hard-crash --state-output=mixed --state-verbose=False -C 'I@kibana:server' state.sls kibana.server -b 1 |
Tatyana Leontovich | 126b003 | 2017-08-30 20:51:20 +0300 | [diff] [blame] | 97 | node_name: {{ HOSTNAME_CFG01 }} |
| 98 | retry: {count: 1, delay: 10} |
| 99 | skip_fail: false |
| 100 | |
| 101 | - description: Install elasticsearch client |
Dennis Dmitriev | 281221b | 2018-02-13 16:40:48 +0200 | [diff] [blame^] | 102 | cmd: salt --hard-crash --state-output=mixed --state-verbose=False -C 'I@elasticsearch:client' state.sls elasticsearch.client |
Tatyana Leontovich | 126b003 | 2017-08-30 20:51:20 +0300 | [diff] [blame] | 103 | node_name: {{ HOSTNAME_CFG01 }} |
| 104 | retry: {count: 1, delay: 10} |
| 105 | skip_fail: false |
| 106 | |
| 107 | - description: Install kibana client |
Dennis Dmitriev | 281221b | 2018-02-13 16:40:48 +0200 | [diff] [blame^] | 108 | cmd: salt --hard-crash --state-output=mixed --state-verbose=False -C 'I@kibana:client' state.sls kibana.client |
Tatyana Leontovich | 126b003 | 2017-08-30 20:51:20 +0300 | [diff] [blame] | 109 | node_name: {{ HOSTNAME_CFG01 }} |
| 110 | retry: {count: 1, delay: 10} |
| 111 | skip_fail: false |
| 112 | |
| 113 | - description: Check influix db |
| 114 | cmd: | |
Dennis Dmitriev | 281221b | 2018-02-13 16:40:48 +0200 | [diff] [blame^] | 115 | 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 | 126b003 | 2017-08-30 20:51:20 +0300 | [diff] [blame] | 116 | echo "Influxdb service presence: ${INFLUXDB_SERVICE}"; |
| 117 | if [[ "$INFLUXDB_SERVICE" == "true" ]]; then |
Dennis Dmitriev | 281221b | 2018-02-13 16:40:48 +0200 | [diff] [blame^] | 118 | salt --hard-crash --state-output=mixed --state-verbose=False -C 'I@influxdb:server' state.sls influxdb |
Tatyana Leontovich | 126b003 | 2017-08-30 20:51:20 +0300 | [diff] [blame] | 119 | fi |
| 120 | node_name: {{ HOSTNAME_CFG01 }} |
| 121 | retry: {count: 1, delay: 5} |
| 122 | skip_fail: true |
| 123 | |
| 124 | # Collect grains needed to configure the services |
| 125 | |
| 126 | - description: Get grains |
Dennis Dmitriev | 281221b | 2018-02-13 16:40:48 +0200 | [diff] [blame^] | 127 | cmd: salt --hard-crash --state-output=mixed --state-verbose=False -C 'I@salt:minion' state.sls salt.minion.grains |
Tatyana Leontovich | 126b003 | 2017-08-30 20:51:20 +0300 | [diff] [blame] | 128 | node_name: {{ HOSTNAME_CFG01 }} |
| 129 | retry: {count: 1, delay: 10} |
| 130 | skip_fail: false |
| 131 | |
| 132 | - description: Sync modules |
Dennis Dmitriev | 281221b | 2018-02-13 16:40:48 +0200 | [diff] [blame^] | 133 | cmd: salt --hard-crash --state-output=mixed --state-verbose=False -C 'I@salt:minion' saltutil.refresh_modules |
Tatyana Leontovich | 126b003 | 2017-08-30 20:51:20 +0300 | [diff] [blame] | 134 | node_name: {{ HOSTNAME_CFG01 }} |
| 135 | retry: {count: 1, delay: 10} |
| 136 | skip_fail: false |
| 137 | |
| 138 | - description: Update mine |
Dennis Dmitriev | 281221b | 2018-02-13 16:40:48 +0200 | [diff] [blame^] | 139 | cmd: salt --hard-crash --state-output=mixed --state-verbose=False -C 'I@salt:minion' mine.update; sleep 5; |
Tatyana Leontovich | 126b003 | 2017-08-30 20:51:20 +0300 | [diff] [blame] | 140 | node_name: {{ HOSTNAME_CFG01 }} |
| 141 | retry: {count: 1, delay: 10} |
| 142 | skip_fail: false |
| 143 | |
Tatyana Leontovich | 126b003 | 2017-08-30 20:51:20 +0300 | [diff] [blame] | 144 | # Configure the services running in Docker Swarm |
| 145 | - description: Install prometheus alertmanager |
Dennis Dmitriev | 281221b | 2018-02-13 16:40:48 +0200 | [diff] [blame^] | 146 | cmd: salt --hard-crash --state-output=mixed --state-verbose=False -C 'I@docker:swarm' state.sls prometheus,heka.remote_collector -b 1 |
Tatyana Leontovich | 126b003 | 2017-08-30 20:51:20 +0300 | [diff] [blame] | 147 | node_name: {{ HOSTNAME_CFG01 }} |
| 148 | retry: {count: 1, delay: 10} |
| 149 | skip_fail: false |
| 150 | |
| 151 | - description: run docker state |
Dennis Dmitriev | 281221b | 2018-02-13 16:40:48 +0200 | [diff] [blame^] | 152 | cmd: salt --hard-crash --state-output=mixed --state-verbose=False -C 'I@docker:swarm:role:master' state.sls docker |
Tatyana Leontovich | 126b003 | 2017-08-30 20:51:20 +0300 | [diff] [blame] | 153 | node_name: {{ HOSTNAME_CFG01 }} |
| 154 | retry: {count: 1, delay: 10} |
| 155 | skip_fail: false |
| 156 | |
| 157 | - description: docker ps |
Dennis Dmitriev | 281221b | 2018-02-13 16:40:48 +0200 | [diff] [blame^] | 158 | cmd: salt --hard-crash --state-output=mixed --state-verbose=False -C 'I@docker:swarm' dockerng.ps |
Tatyana Leontovich | 126b003 | 2017-08-30 20:51:20 +0300 | [diff] [blame] | 159 | node_name: {{ HOSTNAME_CFG01 }} |
| 160 | retry: {count: 1, delay: 10} |
| 161 | skip_fail: false |
| 162 | |
| 163 | - description: Configure Grafana dashboards and datasources |
Dennis Dmitriev | 281221b | 2018-02-13 16:40:48 +0200 | [diff] [blame^] | 164 | cmd: sleep 30; salt --hard-crash --state-output=mixed --state-verbose=False -C 'I@grafana:client' state.sls grafana.client |
Tatyana Leontovich | 126b003 | 2017-08-30 20:51:20 +0300 | [diff] [blame] | 165 | node_name: {{ HOSTNAME_CFG01 }} |
| 166 | retry: {count: 2, delay: 10} |
| 167 | skip_fail: false |
| 168 | |
| 169 | - description: Run salt minion to create cert files |
| 170 | cmd: salt --hard-crash --state-output=mixed --state-verbose=False "*" state.sls salt.minion |
| 171 | node_name: {{ HOSTNAME_CFG01 }} |
| 172 | retry: {count: 1, delay: 10} |
| 173 | skip_fail: false |
| 174 | |
Tatyana Leontovich | 19a8ca5 | 2017-09-08 12:24:28 +0300 | [diff] [blame] | 175 | {{ SHARED_SL_TESTS.MACRO_CLONE_SL_TESTS() }} |
| 176 | {{ SHARED_SL_TESTS.MACRO_CONFIGURE_TESTS() }} |