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 | |
| 34 | - description: Configure slave nodes |
| 35 | cmd: salt -C 'I@docker:swarm:role:manager' state.sls docker.swarm -b 1 |
| 36 | node_name: {{ HOSTNAME_CFG01 }} |
| 37 | retry: {count: 1, delay: 10} |
| 38 | skip_fail: false |
| 39 | |
| 40 | - description: List registered Docker swarm nodes |
| 41 | cmd: salt -C 'I@docker:swarm:role:master' cmd.run 'docker node ls' |
| 42 | node_name: {{ HOSTNAME_CFG01 }} |
| 43 | retry: {count: 1, delay: 10} |
| 44 | skip_fail: false |
Tatyana Leontovich | c8b8ca2 | 2017-05-19 13:37:05 +0300 | [diff] [blame] | 45 | |
| 46 | # Install slv2 infra |
Tatyana Leontovich | 5acc82a | 2017-05-23 15:41:35 +0300 | [diff] [blame] | 47 | - description: Install telegraf |
Tatyana Leontovich | f00b234 | 2017-07-04 18:26:25 +0300 | [diff] [blame] | 48 | cmd: salt -C 'I@telegraf:agentor or I@telegraf:remote_agent' state.sls telegraf |
| 49 | node_name: {{ HOSTNAME_CFG01 }} |
| 50 | retry: {count: 1, delay: 10} |
| 51 | skip_fail: false |
| 52 | |
| 53 | - description: Configure collector |
| 54 | cmd: salt -C 'I@heka:log_collector' state.sls heka.log_collector |
Tatyana Leontovich | c8b8ca2 | 2017-05-19 13:37:05 +0300 | [diff] [blame] | 55 | node_name: {{ HOSTNAME_CFG01 }} |
| 56 | retry: {count: 1, delay: 10} |
Tatyana Leontovich | 5acc82a | 2017-05-23 15:41:35 +0300 | [diff] [blame] | 57 | skip_fail: false |
Tatyana Leontovich | c8b8ca2 | 2017-05-19 13:37:05 +0300 | [diff] [blame] | 58 | |
Tatyana Leontovich | 5acc82a | 2017-05-23 15:41:35 +0300 | [diff] [blame] | 59 | - description: Install elasticsearch server |
| 60 | cmd: salt -C 'I@elasticsearch:server' state.sls elasticsearch.server -b 1 |
Tatyana Leontovich | c8b8ca2 | 2017-05-19 13:37:05 +0300 | [diff] [blame] | 61 | node_name: {{ HOSTNAME_CFG01 }} |
| 62 | retry: {count: 1, delay: 10} |
Tatyana Leontovich | 5acc82a | 2017-05-23 15:41:35 +0300 | [diff] [blame] | 63 | skip_fail: false |
| 64 | |
| 65 | - description: Install kibana server |
| 66 | cmd: salt -C 'I@kibana:server' state.sls kibana.server -b 1 |
| 67 | node_name: {{ HOSTNAME_CFG01 }} |
| 68 | retry: {count: 1, delay: 10} |
| 69 | skip_fail: false |
| 70 | |
Tatyana Leontovich | 5acc82a | 2017-05-23 15:41:35 +0300 | [diff] [blame] | 71 | - description: Install elasticsearch client |
| 72 | cmd: salt -C 'I@elasticsearch:client' state.sls elasticsearch.client |
| 73 | node_name: {{ HOSTNAME_CFG01 }} |
| 74 | retry: {count: 1, delay: 10} |
| 75 | skip_fail: false |
| 76 | |
| 77 | - description: Install kibana client |
| 78 | cmd: salt -C 'I@kibana:client' state.sls kibana.client |
| 79 | node_name: {{ HOSTNAME_CFG01 }} |
| 80 | retry: {count: 1, delay: 10} |
| 81 | skip_fail: false |
| 82 | |
Tatyana Leontovich | 3645d2b | 2017-06-13 16:51:23 +0300 | [diff] [blame] | 83 | - description: Check influix db |
| 84 | cmd: | |
| 85 | INFLUXDB_SERVICE=`salt -C 'I@influxdb:server' test.ping 1>/dev/null 2>&1 && echo true`; |
| 86 | echo "Influxdb service presence: ${INFLUXDB_SERVICE}"; |
| 87 | if [[ "$INFLUXDB_SERVICE" == "true" ]]; then |
| 88 | salt -C 'I@influxdb:server' state.sls influxdb |
| 89 | fi |
| 90 | node_name: {{ HOSTNAME_CFG01 }} |
| 91 | retry: {count: 1, delay: 5} |
| 92 | skip_fail: true |
| 93 | |
Tatyana Leontovich | 5acc82a | 2017-05-23 15:41:35 +0300 | [diff] [blame] | 94 | # Collect grains needed to configure the services |
| 95 | |
| 96 | - description: Get grains |
| 97 | cmd: salt -C 'I@salt:minion' state.sls salt.minion.grains |
| 98 | node_name: {{ HOSTNAME_CFG01 }} |
| 99 | retry: {count: 1, delay: 10} |
| 100 | skip_fail: false |
| 101 | |
| 102 | - description: Sync modules |
| 103 | cmd: salt -C 'I@salt:minion' saltutil.refresh_modules |
| 104 | node_name: {{ HOSTNAME_CFG01 }} |
| 105 | retry: {count: 1, delay: 10} |
| 106 | skip_fail: false |
| 107 | |
| 108 | - description: Update mine |
| 109 | cmd: salt -C 'I@salt:minion' mine.update; sleep 5; |
| 110 | node_name: {{ HOSTNAME_CFG01 }} |
| 111 | retry: {count: 1, delay: 10} |
| 112 | skip_fail: false |
| 113 | |
Tatyana Leontovich | f00b234 | 2017-07-04 18:26:25 +0300 | [diff] [blame] | 114 | # Change environment configuration before deploy |
| 115 | - description: Set SL docker images deploy parameters |
| 116 | cmd: | |
| 117 | {% for sl_opt, value in config.sl_deploy.items() %} |
| 118 | {% if value|string() %} |
| 119 | salt-call reclass.cluster_meta_set {{ sl_opt }} {{ value }}; |
| 120 | {% endif %} |
| 121 | {% endfor %} |
| 122 | node_name: {{ HOSTNAME_CFG01 }} |
| 123 | retry: {count: 1, delay: 1} |
| 124 | skip_fail: false |
| 125 | |
Tatyana Leontovich | 5acc82a | 2017-05-23 15:41:35 +0300 | [diff] [blame] | 126 | # Configure the services running in Docker Swarm |
| 127 | - description: Install prometheus alertmanager |
Tatyana Leontovich | f00b234 | 2017-07-04 18:26:25 +0300 | [diff] [blame] | 128 | 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] | 129 | node_name: {{ HOSTNAME_CFG01 }} |
| 130 | retry: {count: 1, delay: 10} |
| 131 | skip_fail: false |
| 132 | |
Tatyana Leontovich | 5acc82a | 2017-05-23 15:41:35 +0300 | [diff] [blame] | 133 | - description: run docker state |
| 134 | cmd: salt -C 'I@docker:swarm:role:master' state.sls docker |
| 135 | node_name: {{ HOSTNAME_CFG01 }} |
| 136 | retry: {count: 1, delay: 10} |
| 137 | skip_fail: false |
| 138 | |
| 139 | - description: docker ps |
| 140 | cmd: salt -C 'I@docker:swarm' dockerng.ps |
| 141 | node_name: {{ HOSTNAME_CFG01 }} |
| 142 | retry: {count: 1, delay: 10} |
| 143 | skip_fail: false |
| 144 | |
| 145 | - description: Configure Grafana dashboards and datasources |
Tatyana Leontovich | 572f749 | 2017-07-14 13:36:11 +0300 | [diff] [blame^] | 146 | cmd: sleep 30; salt -C 'I@grafana:client' state.sls grafana.client |
Tatyana Leontovich | 5acc82a | 2017-05-23 15:41:35 +0300 | [diff] [blame] | 147 | node_name: {{ HOSTNAME_CFG01 }} |
Tatyana Leontovich | 572f749 | 2017-07-14 13:36:11 +0300 | [diff] [blame^] | 148 | retry: {count: 2, delay: 10} |
Tatyana Leontovich | 5acc82a | 2017-05-23 15:41:35 +0300 | [diff] [blame] | 149 | skip_fail: false |
Tatyana Leontovich | ea45064 | 2017-07-11 18:56:11 +0300 | [diff] [blame] | 150 | |
| 151 | - description: Run salt minion to create cert files |
| 152 | cmd: salt --hard-crash --state-output=mixed --state-verbose=False "*" state.sls salt.minion |
| 153 | node_name: {{ HOSTNAME_CFG01 }} |
| 154 | retry: {count: 1, delay: 10} |
| 155 | skip_fail: false |
| 156 | |