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 |
| 48 | cmd: salt -C 'I@telegraf:agent' state.sls telegraf |
Tatyana Leontovich | c8b8ca2 | 2017-05-19 13:37:05 +0300 | [diff] [blame] | 49 | node_name: {{ HOSTNAME_CFG01 }} |
| 50 | retry: {count: 1, delay: 10} |
Tatyana Leontovich | 5acc82a | 2017-05-23 15:41:35 +0300 | [diff] [blame^] | 51 | skip_fail: false |
Tatyana Leontovich | c8b8ca2 | 2017-05-19 13:37:05 +0300 | [diff] [blame] | 52 | |
Tatyana Leontovich | 5acc82a | 2017-05-23 15:41:35 +0300 | [diff] [blame^] | 53 | - description: Install elasticsearch server |
| 54 | cmd: salt -C 'I@elasticsearch:server' state.sls elasticsearch.server -b 1 |
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 |
| 58 | |
| 59 | - description: Install kibana server |
| 60 | cmd: salt -C 'I@kibana:server' state.sls kibana.server -b 1 |
| 61 | node_name: {{ HOSTNAME_CFG01 }} |
| 62 | retry: {count: 1, delay: 10} |
| 63 | skip_fail: false |
| 64 | |
| 65 | - description: Install elasticsearch service |
| 66 | cmd: salt -C 'I@elasticsearch:client' state.sls elasticsearch.client.service |
| 67 | node_name: {{ HOSTNAME_CFG01 }} |
| 68 | retry: {count: 1, delay: 10} |
| 69 | skip_fail: false |
| 70 | |
| 71 | - description: Restart minions |
| 72 | cmd: salt -C 'I@elasticsearch:client' --async service.restart salt-minion; sleep 10; |
| 73 | node_name: {{ HOSTNAME_CFG01 }} |
| 74 | retry: {count: 1, delay: 10} |
| 75 | skip_fail: false |
| 76 | |
| 77 | - description: Install elasticsearch client |
| 78 | cmd: salt -C 'I@elasticsearch:client' state.sls elasticsearch.client |
| 79 | node_name: {{ HOSTNAME_CFG01 }} |
| 80 | retry: {count: 1, delay: 10} |
| 81 | skip_fail: false |
| 82 | |
| 83 | - description: Install kibana client |
| 84 | cmd: salt -C 'I@kibana:client' state.sls kibana.client |
| 85 | node_name: {{ HOSTNAME_CFG01 }} |
| 86 | retry: {count: 1, delay: 10} |
| 87 | skip_fail: false |
| 88 | |
| 89 | # Collect grains needed to configure the services |
| 90 | |
| 91 | - description: Get grains |
| 92 | cmd: salt -C 'I@salt:minion' state.sls salt.minion.grains |
| 93 | node_name: {{ HOSTNAME_CFG01 }} |
| 94 | retry: {count: 1, delay: 10} |
| 95 | skip_fail: false |
| 96 | |
| 97 | - description: Sync modules |
| 98 | cmd: salt -C 'I@salt:minion' saltutil.refresh_modules |
| 99 | node_name: {{ HOSTNAME_CFG01 }} |
| 100 | retry: {count: 1, delay: 10} |
| 101 | skip_fail: false |
| 102 | |
| 103 | - description: Update mine |
| 104 | cmd: salt -C 'I@salt:minion' mine.update; sleep 5; |
| 105 | node_name: {{ HOSTNAME_CFG01 }} |
| 106 | retry: {count: 1, delay: 10} |
| 107 | skip_fail: false |
| 108 | |
| 109 | # Configure the services running in Docker Swarm |
| 110 | - description: Install prometheus alertmanager |
| 111 | cmd: salt -C 'I@docker:swarm' state.sls prometheus.server,prometheus.alertmanager -b 1 |
| 112 | node_name: {{ HOSTNAME_CFG01 }} |
| 113 | retry: {count: 1, delay: 10} |
| 114 | skip_fail: false |
| 115 | |
| 116 | - description: Sync modules |
| 117 | cmd: salt -C 'I@salt:minion' saltutil.refresh_modules |
| 118 | node_name: {{ HOSTNAME_CFG01 }} |
| 119 | retry: {count: 1, delay: 10} |
| 120 | skip_fail: false |
| 121 | |
| 122 | - description: Update mine |
| 123 | cmd: salt -C 'I@salt:minion' mine.update; sleep 5; |
| 124 | node_name: {{ HOSTNAME_CFG01 }} |
| 125 | retry: {count: 1, delay: 10} |
| 126 | skip_fail: false |
| 127 | |
| 128 | - description: Pull images |
| 129 | cmd: salt -C 'I@docker:swarm:role:master' cmd.run 'docker node ls'; |
| 130 | for img in pushgateway alertmanager prometheus; do |
| 131 | salt -C 'I@docker:swarm' dockerng.pull "docker-sandbox.sandbox.mirantis.net/bkupidura/$img"; |
| 132 | salt -C 'I@docker:swarm' dockerng.tag "docker-sandbox.sandbox.mirantis.net/bkupidura/$img:latest" "$img:latest"; |
| 133 | done; |
| 134 | node_name: {{ HOSTNAME_CFG01 }} |
| 135 | retry: {count: 1, delay: 1} |
| 136 | skip_fail: false |
| 137 | |
| 138 | - description: run docker state |
| 139 | cmd: salt -C 'I@docker:swarm:role:master' state.sls docker |
| 140 | node_name: {{ HOSTNAME_CFG01 }} |
| 141 | retry: {count: 1, delay: 10} |
| 142 | skip_fail: false |
| 143 | |
| 144 | - description: docker ps |
| 145 | cmd: salt -C 'I@docker:swarm' dockerng.ps |
| 146 | node_name: {{ HOSTNAME_CFG01 }} |
| 147 | retry: {count: 1, delay: 10} |
| 148 | skip_fail: false |
| 149 | |
| 150 | - description: Configure Grafana dashboards and datasources |
| 151 | cmd: salt -C 'I@grafana:client' state.sls grafana.client |
| 152 | node_name: {{ HOSTNAME_CFG01 }} |
| 153 | retry: {count: 1, delay: 10} |
| 154 | skip_fail: false |