Tatyana Leontovich | 09b7b01 | 2017-07-10 12:53:45 +0300 | [diff] [blame] | 1 | {% from 'virtual-mcp11-k8s-contrail/underlay.yaml' import HOSTNAME_CFG01 with context %} |
Sergii Golovatiuk | 17ef149 | 2017-05-29 19:54:03 +0200 | [diff] [blame] | 2 | |
| 3 | # Install docker swarm |
| 4 | - description: Configure docker service |
| 5 | cmd: salt -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 -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 -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 -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 -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 | |
Tatyana Leontovich | 2fec09a | 2017-08-22 13:52:11 +0300 | [diff] [blame] | 34 | - description: Rerun swarm on slaves to proper token population |
| 35 | cmd: salt -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 | |
Sergii Golovatiuk | 17ef149 | 2017-05-29 19:54:03 +0200 | [diff] [blame] | 40 | - description: Configure slave nodes |
| 41 | cmd: salt -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 -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 | # Install slv2 infra |
| 53 | - description: Install telegraf |
Tatyana Leontovich | 09b7b01 | 2017-07-10 12:53:45 +0300 | [diff] [blame] | 54 | cmd: salt -C 'I@telegraf:agentor or I@telegraf:remote_agent' state.sls telegraf |
| 55 | node_name: {{ HOSTNAME_CFG01 }} |
Tatyana Leontovich | 2fec09a | 2017-08-22 13:52:11 +0300 | [diff] [blame] | 56 | retry: {count: 2, delay: 10} |
| 57 | skip_fail: false |
| 58 | |
Dennis Dmitriev | cc6e9b5 | 2017-09-01 11:27:58 +0300 | [diff] [blame^] | 59 | - description: Configure Prometheus exporters, if pillar 'prometheus:exporters' exists on any server |
| 60 | cmd: | |
| 61 | if salt -C 'I@prometheus:exporters' match.pillar 'prometheus:exporters' ; then |
| 62 | salt -C 'I@prometheus:exporters' state.sls prometheus |
| 63 | fi |
Tatyana Leontovich | 2fec09a | 2017-08-22 13:52:11 +0300 | [diff] [blame] | 64 | node_name: {{ HOSTNAME_CFG01 }} |
Tatyana Leontovich | 09b7b01 | 2017-07-10 12:53:45 +0300 | [diff] [blame] | 65 | retry: {count: 1, delay: 10} |
| 66 | skip_fail: false |
| 67 | |
| 68 | - description: Configure collector |
| 69 | cmd: salt -C 'I@heka:log_collector' state.sls heka.log_collector |
Sergii Golovatiuk | 17ef149 | 2017-05-29 19:54:03 +0200 | [diff] [blame] | 70 | node_name: {{ HOSTNAME_CFG01 }} |
| 71 | retry: {count: 1, delay: 10} |
| 72 | skip_fail: false |
| 73 | |
| 74 | - description: Install elasticsearch server |
| 75 | cmd: salt -C 'I@elasticsearch:server' state.sls elasticsearch.server -b 1 |
| 76 | node_name: {{ HOSTNAME_CFG01 }} |
| 77 | retry: {count: 1, delay: 10} |
| 78 | skip_fail: false |
| 79 | |
| 80 | - description: Install kibana server |
| 81 | cmd: salt -C 'I@kibana:server' state.sls kibana.server -b 1 |
| 82 | node_name: {{ HOSTNAME_CFG01 }} |
| 83 | retry: {count: 1, delay: 10} |
| 84 | skip_fail: false |
| 85 | |
Sergii Golovatiuk | 17ef149 | 2017-05-29 19:54:03 +0200 | [diff] [blame] | 86 | - description: Install elasticsearch client |
| 87 | cmd: salt -C 'I@elasticsearch:client' state.sls elasticsearch.client |
| 88 | node_name: {{ HOSTNAME_CFG01 }} |
| 89 | retry: {count: 1, delay: 10} |
| 90 | skip_fail: false |
| 91 | |
| 92 | - description: Install kibana client |
| 93 | cmd: salt -C 'I@kibana:client' state.sls kibana.client |
| 94 | node_name: {{ HOSTNAME_CFG01 }} |
| 95 | retry: {count: 1, delay: 10} |
| 96 | skip_fail: false |
| 97 | |
Tatyana Leontovich | 09b7b01 | 2017-07-10 12:53:45 +0300 | [diff] [blame] | 98 | - description: Check influix db |
| 99 | cmd: | |
| 100 | INFLUXDB_SERVICE=`salt -C 'I@influxdb:server' test.ping 1>/dev/null 2>&1 && echo true`; |
| 101 | echo "Influxdb service presence: ${INFLUXDB_SERVICE}"; |
| 102 | if [[ "$INFLUXDB_SERVICE" == "true" ]]; then |
| 103 | salt -C 'I@influxdb:server' state.sls influxdb |
| 104 | fi |
| 105 | node_name: {{ HOSTNAME_CFG01 }} |
| 106 | retry: {count: 1, delay: 5} |
| 107 | skip_fail: true |
| 108 | |
Sergii Golovatiuk | 17ef149 | 2017-05-29 19:54:03 +0200 | [diff] [blame] | 109 | # Collect grains needed to configure the services |
| 110 | |
| 111 | - description: Get grains |
| 112 | cmd: salt -C 'I@salt:minion' state.sls salt.minion.grains |
| 113 | node_name: {{ HOSTNAME_CFG01 }} |
| 114 | retry: {count: 1, delay: 10} |
| 115 | skip_fail: false |
| 116 | |
| 117 | - description: Sync modules |
| 118 | cmd: salt -C 'I@salt:minion' saltutil.refresh_modules |
| 119 | node_name: {{ HOSTNAME_CFG01 }} |
| 120 | retry: {count: 1, delay: 10} |
| 121 | skip_fail: false |
| 122 | |
| 123 | - description: Update mine |
| 124 | cmd: salt -C 'I@salt:minion' mine.update; sleep 5; |
| 125 | node_name: {{ HOSTNAME_CFG01 }} |
| 126 | retry: {count: 1, delay: 10} |
| 127 | skip_fail: false |
| 128 | |
Tatyana Leontovich | 09b7b01 | 2017-07-10 12:53:45 +0300 | [diff] [blame] | 129 | # Change environment configuration before deploy |
| 130 | - description: Set SL docker images deploy parameters |
| 131 | cmd: | |
| 132 | {% for sl_opt, value in config.sl_deploy.items() %} |
| 133 | {% if value|string() %} |
| 134 | salt-call reclass.cluster_meta_set {{ sl_opt }} {{ value }}; |
| 135 | {% endif %} |
| 136 | {% endfor %} |
Sergii Golovatiuk | 17ef149 | 2017-05-29 19:54:03 +0200 | [diff] [blame] | 137 | node_name: {{ HOSTNAME_CFG01 }} |
| 138 | retry: {count: 1, delay: 1} |
| 139 | skip_fail: false |
| 140 | |
Tatyana Leontovich | 09b7b01 | 2017-07-10 12:53:45 +0300 | [diff] [blame] | 141 | # Configure the services running in Docker Swarm |
| 142 | - description: Install prometheus alertmanager |
| 143 | cmd: salt -C 'I@docker:swarm' state.sls prometheus,heka.remote_collector -b 1 |
| 144 | node_name: {{ HOSTNAME_CFG01 }} |
| 145 | retry: {count: 1, delay: 10} |
| 146 | skip_fail: false |
| 147 | |
Sergii Golovatiuk | 17ef149 | 2017-05-29 19:54:03 +0200 | [diff] [blame] | 148 | - description: run docker state |
| 149 | cmd: salt -C 'I@docker:swarm:role:master' state.sls docker |
| 150 | node_name: {{ HOSTNAME_CFG01 }} |
| 151 | retry: {count: 1, delay: 10} |
| 152 | skip_fail: false |
| 153 | |
| 154 | - description: docker ps |
| 155 | cmd: salt -C 'I@docker:swarm' dockerng.ps |
| 156 | node_name: {{ HOSTNAME_CFG01 }} |
| 157 | retry: {count: 1, delay: 10} |
| 158 | skip_fail: false |
| 159 | |
Tatyana Leontovich | 6c696e6 | 2017-07-31 16:39:16 +0300 | [diff] [blame] | 160 | - description: Restart keepalived service |
| 161 | cmd: salt -C 'mon*' cmd.run "systemctl restart keepalived" |
| 162 | node_name: {{ HOSTNAME_CFG01 }} |
| 163 | retry: {count: 1, delay: 10} |
| 164 | skip_fail: false |
| 165 | |
| 166 | - description: Check the VIP |
| 167 | cmd: | |
| 168 | SL_MONITOR_ADDRESS=`salt-call --out=newline_values_only pillar.get _param:stacklight_monitor_address`; |
| 169 | echo "_param:stacklight_monitor_address (vip): ${SL_MONITOR_ADDRESS}"; |
| 170 | salt --hard-crash --state-output=mixed --state-verbose=False -C 'mon*' cmd.run "ip a | grep ${SL_MONITOR_ADDRESS}" | grep -B1 ${SL_MONITOR_ADDRESS} |
| 171 | node_name: {{ HOSTNAME_CFG01 }} |
| 172 | retry: {count: 1, delay: 5} |
| 173 | skip_fail: false |
| 174 | |
Sergii Golovatiuk | 17ef149 | 2017-05-29 19:54:03 +0200 | [diff] [blame] | 175 | - description: Configure Grafana dashboards and datasources |
Tatyana Leontovich | 572f749 | 2017-07-14 13:36:11 +0300 | [diff] [blame] | 176 | cmd: sleep 30; salt -C 'I@grafana:client' state.sls grafana.client |
Sergii Golovatiuk | 17ef149 | 2017-05-29 19:54:03 +0200 | [diff] [blame] | 177 | node_name: {{ HOSTNAME_CFG01 }} |
Tatyana Leontovich | 572f749 | 2017-07-14 13:36:11 +0300 | [diff] [blame] | 178 | retry: {count: 2, delay: 10} |
Sergii Golovatiuk | 17ef149 | 2017-05-29 19:54:03 +0200 | [diff] [blame] | 179 | skip_fail: false |
Tatyana Leontovich | ea45064 | 2017-07-11 18:56:11 +0300 | [diff] [blame] | 180 | |
| 181 | - description: Run salt minion to create cert files |
| 182 | cmd: salt --hard-crash --state-output=mixed --state-verbose=False "*" state.sls salt.minion |
| 183 | node_name: {{ HOSTNAME_CFG01 }} |
| 184 | retry: {count: 1, delay: 10} |
| 185 | skip_fail: false |