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