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