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 %} |
| 2 | |
| 3 | # Install docker swarm |
Tatyana Leontovich | 5acc82a | 2017-05-23 15:41:35 +0300 | [diff] [blame] | 4 | - description: Configure docker service |
| 5 | cmd: salt -C 'I@docker:swarm' state.sls docker.host |
Tatyana Leontovich | c8b8ca2 | 2017-05-19 13:37:05 +0300 | [diff] [blame] | 6 | node_name: {{ HOSTNAME_CFG01 }} |
| 7 | retry: {count: 1, delay: 10} |
Tatyana Leontovich | 5acc82a | 2017-05-23 15:41:35 +0300 | [diff] [blame] | 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 | |
Tatyana Leontovich | 5acc82a | 2017-05-23 15:41:35 +0300 | [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 |
Tatyana Leontovich | c8b8ca2 | 2017-05-19 13:37:05 +0300 | [diff] [blame] | 51 | |
| 52 | # Install slv2 infra |
Tatyana Leontovich | 5acc82a | 2017-05-23 15:41:35 +0300 | [diff] [blame] | 53 | - description: Install telegraf |
Tatyana Leontovich | f8ec90d | 2017-07-18 16:36:16 +0300 | [diff] [blame] | 54 | cmd: salt -C 'I@telegraf:agent or I@telegraf:remote_agent' state.sls telegraf |
Tatyana Leontovich | f00b234 | 2017-07-04 18:26:25 +0300 | [diff] [blame] | 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 | f00b234 | 2017-07-04 18:26:25 +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 |
Tatyana Leontovich | c8b8ca2 | 2017-05-19 13:37:05 +0300 | [diff] [blame] | 70 | node_name: {{ HOSTNAME_CFG01 }} |
| 71 | retry: {count: 1, delay: 10} |
Tatyana Leontovich | 5acc82a | 2017-05-23 15:41:35 +0300 | [diff] [blame] | 72 | skip_fail: false |
Tatyana Leontovich | c8b8ca2 | 2017-05-19 13:37:05 +0300 | [diff] [blame] | 73 | |
Tatyana Leontovich | 5acc82a | 2017-05-23 15:41:35 +0300 | [diff] [blame] | 74 | - description: Install elasticsearch server |
| 75 | cmd: salt -C 'I@elasticsearch:server' state.sls elasticsearch.server -b 1 |
Tatyana Leontovich | c8b8ca2 | 2017-05-19 13:37:05 +0300 | [diff] [blame] | 76 | node_name: {{ HOSTNAME_CFG01 }} |
| 77 | retry: {count: 1, delay: 10} |
Tatyana Leontovich | 5acc82a | 2017-05-23 15:41:35 +0300 | [diff] [blame] | 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 | |
Tatyana Leontovich | 5acc82a | 2017-05-23 15:41:35 +0300 | [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 | 3645d2b | 2017-06-13 16:51:23 +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 | |
Tatyana Leontovich | 5acc82a | 2017-05-23 15:41:35 +0300 | [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 | f00b234 | 2017-07-04 18:26:25 +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 %} |
| 137 | node_name: {{ HOSTNAME_CFG01 }} |
| 138 | retry: {count: 1, delay: 1} |
| 139 | skip_fail: false |
| 140 | |
Tatyana Leontovich | 5acc82a | 2017-05-23 15:41:35 +0300 | [diff] [blame] | 141 | # Configure the services running in Docker Swarm |
| 142 | - description: Install prometheus alertmanager |
Tatyana Leontovich | f00b234 | 2017-07-04 18:26:25 +0300 | [diff] [blame] | 143 | cmd: salt -C 'I@docker:swarm' state.sls prometheus,heka.remote_collector -b 1 |
Tatyana Leontovich | 5acc82a | 2017-05-23 15:41:35 +0300 | [diff] [blame] | 144 | node_name: {{ HOSTNAME_CFG01 }} |
| 145 | retry: {count: 1, delay: 10} |
| 146 | skip_fail: false |
| 147 | |
Tatyana Leontovich | 5acc82a | 2017-05-23 15:41:35 +0300 | [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 | |
| 160 | - description: Configure Grafana dashboards and datasources |
Tatyana Leontovich | 572f749 | 2017-07-14 13:36:11 +0300 | [diff] [blame] | 161 | cmd: sleep 30; salt -C 'I@grafana:client' state.sls grafana.client |
Tatyana Leontovich | 5acc82a | 2017-05-23 15:41:35 +0300 | [diff] [blame] | 162 | node_name: {{ HOSTNAME_CFG01 }} |
Tatyana Leontovich | 572f749 | 2017-07-14 13:36:11 +0300 | [diff] [blame] | 163 | retry: {count: 2, delay: 10} |
Tatyana Leontovich | 5acc82a | 2017-05-23 15:41:35 +0300 | [diff] [blame] | 164 | skip_fail: false |
Tatyana Leontovich | ea45064 | 2017-07-11 18:56:11 +0300 | [diff] [blame] | 165 | |
| 166 | - description: Run salt minion to create cert files |
| 167 | cmd: salt --hard-crash --state-output=mixed --state-verbose=False "*" state.sls salt.minion |
| 168 | node_name: {{ HOSTNAME_CFG01 }} |
| 169 | retry: {count: 1, delay: 10} |
| 170 | skip_fail: false |
| 171 | |