ibumarskov | d1e2897 | 2018-03-27 10:39:08 +0400 | [diff] [blame] | 1 | {% from 'cookied-mcp-mitaka-dvr/underlay.yaml' import HOSTNAME_CFG01 with context %} |
ibumarskov | 12b79ae | 2018-03-15 01:11:41 -0700 | [diff] [blame] | 2 | {% import 'shared-sl-tests.yaml' as SHARED_SL_TESTS with context %} |
| 3 | # Install docker swarm |
| 4 | - description: Configure docker service |
| 5 | cmd: salt --hard-crash --state-output=mixed --state-verbose=False -C 'I@docker:swarm' state.sls docker.host |
| 6 | node_name: {{ HOSTNAME_CFG01 }} |
| 7 | retry: {count: 1, delay: 10} |
| 8 | skip_fail: false |
| 9 | |
| 10 | - description: Install docker swarm on master node |
| 11 | cmd: salt --hard-crash --state-output=mixed --state-verbose=False -C 'I@docker:swarm:role:master' state.sls docker.swarm |
| 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 |
| 17 | cmd: salt --hard-crash --state-output=mixed --state-verbose=False -C 'I@docker:swarm' state.sls salt.minion.grains |
| 18 | node_name: {{ HOSTNAME_CFG01 }} |
| 19 | retry: {count: 1, delay: 10} |
| 20 | skip_fail: false |
| 21 | |
| 22 | - description: Update mine |
| 23 | cmd: salt --hard-crash --state-output=mixed --state-verbose=False -C 'I@docker:swarm' mine.update |
| 24 | node_name: {{ HOSTNAME_CFG01 }} |
| 25 | retry: {count: 1, delay: 10} |
| 26 | skip_fail: false |
| 27 | |
| 28 | - description: Refresh modules |
| 29 | cmd: salt --hard-crash --state-output=mixed --state-verbose=False -C 'I@docker:swarm' saltutil.refresh_modules; sleep 5; |
| 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 |
| 35 | cmd: salt --hard-crash --state-output=mixed --state-verbose=False -C 'I@docker:swarm:role:master' state.sls docker.swarm |
| 36 | node_name: {{ HOSTNAME_CFG01 }} |
| 37 | retry: {count: 1, delay: 10} |
| 38 | skip_fail: false |
| 39 | |
| 40 | - description: Configure slave nodes |
| 41 | cmd: salt --hard-crash --state-output=mixed --state-verbose=False -C 'I@docker:swarm:role:manager' state.sls docker.swarm -b 1 |
| 42 | node_name: {{ HOSTNAME_CFG01 }} |
| 43 | retry: {count: 1, delay: 10} |
| 44 | skip_fail: false |
| 45 | |
| 46 | - description: List registered Docker swarm nodes |
| 47 | cmd: salt --hard-crash --state-output=mixed --state-verbose=False -C 'I@docker:swarm:role:master' cmd.run 'docker node ls' |
| 48 | node_name: {{ HOSTNAME_CFG01 }} |
| 49 | retry: {count: 1, delay: 10} |
| 50 | skip_fail: false |
| 51 | |
| 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 | |
| 68 | # Install slv2 infra |
Dennis Dmitriev | 371ba5b | 2018-05-31 12:00:38 +0000 | [diff] [blame] | 69 | # Install MongoDB for alerta |
| 70 | - description: Install MongoDB |
| 71 | cmd: salt --hard-crash --state-output=mixed --state-verbose=False -C 'I@mongodb:server' state.sls mongodb |
| 72 | node_name: {{ HOSTNAME_CFG01 }} |
| 73 | retry: {count: 2, delay: 10} |
| 74 | skip_fail: false |
| 75 | |
ibumarskov | 12b79ae | 2018-03-15 01:11:41 -0700 | [diff] [blame] | 76 | - description: Install telegraf |
| 77 | cmd: salt --hard-crash --state-output=mixed --state-verbose=False -C 'I@telegraf:agent or I@telegraf:remote_agent' state.sls telegraf |
| 78 | node_name: {{ HOSTNAME_CFG01 }} |
| 79 | retry: {count: 2, delay: 10} |
| 80 | skip_fail: false |
| 81 | |
| 82 | - description: Configure Prometheus exporters, if pillar 'prometheus:exporters' exists on any server |
| 83 | cmd: | |
| 84 | if salt --hard-crash --state-output=mixed --state-verbose=False -C 'I@prometheus:exporters' match.pillar 'prometheus:exporters' ; then |
| 85 | salt --hard-crash --state-output=mixed --state-verbose=False -C 'I@prometheus:exporters' state.sls prometheus |
| 86 | fi |
| 87 | node_name: {{ HOSTNAME_CFG01 }} |
| 88 | retry: {count: 1, delay: 10} |
| 89 | skip_fail: false |
| 90 | |
| 91 | - description: Configure collector |
| 92 | cmd: salt --hard-crash --state-output=mixed --state-verbose=False -C 'I@heka:log_collector' state.sls heka.log_collector |
| 93 | node_name: {{ HOSTNAME_CFG01 }} |
| 94 | retry: {count: 1, delay: 10} |
| 95 | skip_fail: false |
| 96 | |
| 97 | - description: Install elasticsearch server |
| 98 | cmd: salt --hard-crash --state-output=mixed --state-verbose=False -C 'I@elasticsearch:server' state.sls elasticsearch.server -b 1 |
| 99 | node_name: {{ HOSTNAME_CFG01 }} |
| 100 | retry: {count: 1, delay: 10} |
| 101 | skip_fail: false |
| 102 | |
| 103 | - description: Install kibana server |
| 104 | cmd: salt --hard-crash --state-output=mixed --state-verbose=False -C 'I@kibana:server' state.sls kibana.server -b 1 |
| 105 | node_name: {{ HOSTNAME_CFG01 }} |
| 106 | retry: {count: 1, delay: 10} |
| 107 | skip_fail: false |
| 108 | |
| 109 | - description: Install elasticsearch client |
| 110 | cmd: salt --hard-crash --state-output=mixed --state-verbose=False -C 'I@elasticsearch:client' state.sls elasticsearch.client |
| 111 | node_name: {{ HOSTNAME_CFG01 }} |
Dennis Dmitriev | 4ad63e4 | 2018-05-01 05:18:54 +0300 | [diff] [blame] | 112 | retry: {count: 2, delay: 30} |
ibumarskov | 12b79ae | 2018-03-15 01:11:41 -0700 | [diff] [blame] | 113 | skip_fail: false |
| 114 | |
| 115 | - description: Install kibana client |
| 116 | cmd: salt --hard-crash --state-output=mixed --state-verbose=False -C 'I@kibana:client' state.sls kibana.client |
| 117 | node_name: {{ HOSTNAME_CFG01 }} |
| 118 | retry: {count: 1, delay: 10} |
| 119 | skip_fail: false |
| 120 | |
| 121 | - description: Check influix db |
| 122 | cmd: | |
| 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`; |
| 124 | echo "Influxdb service presence: ${INFLUXDB_SERVICE}"; |
| 125 | if [[ "$INFLUXDB_SERVICE" == "true" ]]; then |
| 126 | salt --hard-crash --state-output=mixed --state-verbose=False -C 'I@influxdb:server' state.sls influxdb |
| 127 | fi |
| 128 | node_name: {{ HOSTNAME_CFG01 }} |
| 129 | retry: {count: 1, delay: 5} |
| 130 | skip_fail: true |
| 131 | |
| 132 | # Collect grains needed to configure the services |
| 133 | |
| 134 | - description: Get grains |
| 135 | cmd: salt --hard-crash --state-output=mixed --state-verbose=False -C 'I@salt:minion' state.sls salt.minion.grains |
| 136 | node_name: {{ HOSTNAME_CFG01 }} |
| 137 | retry: {count: 1, delay: 10} |
| 138 | skip_fail: false |
| 139 | |
| 140 | - description: Sync modules |
| 141 | cmd: salt --hard-crash --state-output=mixed --state-verbose=False -C 'I@salt:minion' saltutil.refresh_modules |
| 142 | node_name: {{ HOSTNAME_CFG01 }} |
| 143 | retry: {count: 1, delay: 10} |
| 144 | skip_fail: false |
| 145 | |
| 146 | - description: Update mine |
| 147 | cmd: salt --hard-crash --state-output=mixed --state-verbose=False -C 'I@salt:minion' mine.update; sleep 5; |
| 148 | node_name: {{ HOSTNAME_CFG01 }} |
| 149 | retry: {count: 5, delay: 15} |
| 150 | skip_fail: false |
| 151 | |
| 152 | # Configure the services running in Docker Swarm |
| 153 | - description: Install prometheus alertmanager |
| 154 | cmd: salt --hard-crash --state-output=mixed --state-verbose=False -C 'I@docker:swarm' state.sls prometheus,heka.remote_collector -b 1 |
| 155 | node_name: {{ HOSTNAME_CFG01 }} |
| 156 | retry: {count: 1, delay: 10} |
| 157 | skip_fail: false |
| 158 | |
| 159 | - description: run docker state |
| 160 | cmd: salt --hard-crash --state-output=mixed --state-verbose=False -C 'I@docker:swarm:role:master' state.sls docker |
| 161 | node_name: {{ HOSTNAME_CFG01 }} |
| 162 | retry: {count: 1, delay: 10} |
| 163 | skip_fail: false |
| 164 | |
| 165 | - description: docker ps |
| 166 | cmd: salt --hard-crash --state-output=mixed --state-verbose=False -C 'I@docker:swarm' dockerng.ps |
| 167 | node_name: {{ HOSTNAME_CFG01 }} |
| 168 | retry: {count: 1, delay: 10} |
| 169 | skip_fail: false |
| 170 | |
| 171 | - description: Configure Grafana dashboards and datasources |
| 172 | cmd: sleep 30; salt --hard-crash --state-output=mixed --state-verbose=False -C 'I@grafana:client' state.sls grafana.client |
| 173 | node_name: {{ HOSTNAME_CFG01 }} |
| 174 | retry: {count: 2, delay: 10} |
| 175 | skip_fail: false |
| 176 | |
| 177 | - description: Run salt minion to create cert files |
| 178 | cmd: salt --hard-crash --state-output=mixed --state-verbose=False "*" state.sls salt.minion |
| 179 | node_name: {{ HOSTNAME_CFG01 }} |
| 180 | retry: {count: 1, delay: 10} |
| 181 | skip_fail: false |
| 182 | |
| 183 | {{ SHARED_SL_TESTS.MACRO_CLONE_SL_TESTS() }} |
| 184 | {{ SHARED_SL_TESTS.MACRO_CONFIGURE_TESTS() }} |