blob: 3a89bf257198beea5f50b781bd185bf73854afde [file] [log] [blame]
Dennis Dmitrieveac3aab2017-07-12 16:36:41 +03001{% from 'virtual-mcp-ocata-cicd/underlay.yaml' import HOSTNAME_CFG01 with context %}
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
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
45
46# Install slv2 infra
47- description: Install telegraf
Dennis Dmitrievf512dce2017-07-18 16:45:05 +030048 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
Dennis Dmitrieveac3aab2017-07-12 16:36:41 +030055 node_name: {{ HOSTNAME_CFG01 }}
56 retry: {count: 1, delay: 10}
57 skip_fail: false
58
59- description: Install elasticsearch server
60 cmd: salt -C 'I@elasticsearch:server' state.sls elasticsearch.server -b 1
61 node_name: {{ HOSTNAME_CFG01 }}
62 retry: {count: 1, delay: 10}
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
Dennis Dmitrieveac3aab2017-07-12 16:36:41 +030071- 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
Dennis Dmitrievf512dce2017-07-18 16:45:05 +030083- 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
Dennis Dmitrieveac3aab2017-07-12 16:36:41 +030094# 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
Dennis Dmitrievf512dce2017-07-18 16:45:05 +0300114# 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 %}
Dennis Dmitrieveac3aab2017-07-12 16:36:41 +0300122 node_name: {{ HOSTNAME_CFG01 }}
123 retry: {count: 1, delay: 1}
124 skip_fail: false
125
Dennis Dmitrievf512dce2017-07-18 16:45:05 +0300126# Configure the services running in Docker Swarm
127- description: Install prometheus alertmanager
128 cmd: salt -C 'I@docker:swarm' state.sls prometheus,heka.remote_collector -b 1
129 node_name: {{ HOSTNAME_CFG01 }}
130 retry: {count: 1, delay: 10}
131 skip_fail: false
132
Dennis Dmitrieveac3aab2017-07-12 16:36:41 +0300133- 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
Dennis Dmitrievf512dce2017-07-18 16:45:05 +0300146 cmd: sleep 30; salt -C 'I@grafana:client' state.sls grafana.client
147 node_name: {{ HOSTNAME_CFG01 }}
148 retry: {count: 2, delay: 10}
149 skip_fail: false
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
Dennis Dmitrieveac3aab2017-07-12 16:36:41 +0300153 node_name: {{ HOSTNAME_CFG01 }}
154 retry: {count: 1, delay: 10}
155 skip_fail: false