Add Stacklight v2 deploy
Change-Id: I0a26bec717dad40c3b3471785d046f22ef0cc42f
diff --git a/src/com/mirantis/mk/Orchestrate.groovy b/src/com/mirantis/mk/Orchestrate.groovy
index 20e6d64..1c074cc 100644
--- a/src/com/mirantis/mk/Orchestrate.groovy
+++ b/src/com/mirantis/mk/Orchestrate.groovy
@@ -320,8 +320,76 @@
salt.runSaltProcessStep(master, 'I@opencontrail:compute', 'system.reboot')
}
+def installDockerSwarm(master) {
+ def salt = new com.mirantis.mk.Salt()
-def installStacklightControl(master) {
+ //Install and Configure Docker
+ salt.enforceState(master, 'I@docker:swarm', 'docker.host')
+ salt.enforceState(master, 'I@docker:swarm:role:master', 'docker.swarm', true)
+ salt.enforceState(master, 'I@docker:swarm', 'salt.minion.grains', true)
+ salt.runSaltProcessStep(master, 'I@docker:swarm', 'mine.update', [], null, true)
+ salt.runSaltProcessStep(master, 'I@docker:swarm', 'saltutil.refresh_modules', [], null, true)
+ sleep(5)
+ salt.enforceState(master, 'I@docker:swarm:role:manager', 'docker.swarm', true)
+ salt.cmdRun(master, 'I@docker:swarm:role:master', 'docker node ls', true)
+
+}
+
+
+def installStacklight(master) {
+ def common = new com.mirantis.mk.Common()
+ def salt = new com.mirantis.mk.Salt()
+
+ //Install Telegraf
+ salt.enforceState(master, 'I@telegraf:agentor or I@telegraf:remote_agent', 'telegraf', true)
+
+ //Install Elasticsearch and Kibana
+ salt.enforceState(master, 'I@elasticsearch.server', 'elasticsearch.server', true)
+ salt.enforceState(master, 'I@kibana:server', 'kibana.server', true)
+ salt.enforceState(master, 'I@grafana:server', 'grafana.server', true)
+ salt.enforceState(master, 'I@nagios:server', 'nagios.server', true)
+ salt.enforceState(master, 'I@elasticsearch.client', 'elasticsearch.client', true)
+ salt.enforceState(master, 'I@kibana:client', 'kibana.client', true)
+ salt.enforceState(master, 'I@influxdb:server', 'influxdb', true)
+
+ //Collect Grains
+ salt.enforceState(master, 'I@salt:minion', 'salt.minion.grains', true)
+ salt.runSaltProcessStep(master, 'I@salt:minion', 'saltutil.refresh_modules', [], null, true)
+ salt.runSaltProcessStep(master, 'I@salt:minion', 'mine.update', [], null, true)
+ sleep(5)
+
+ //Configure services in Docker Swarm
+ salt.enforceState(master, 'I@docker:swarm', ['prometheus', 'heka.remote_collector'])
+ salt.enforceState(master, 'I@docker:swarm:role:master', 'docker', true)
+ salt.enforceState(master, 'I@docker:swarm', 'dockerng.ps', true)
+
+ //Configure Grafana
+ def pillar = salt.getPillar(master, 'ctl01*', '_param:stacklight_monitor_address')
+ common.prettyPrint(pillar)
+
+ def stacklight_vip
+ if(!pillar['return'].isEmpty()) {
+ stacklight_vip = pillar['return'][0].values()[0]
+ } else {
+ common.errorMsg('[ERROR] Stacklight VIP address could not be retrieved')
+ }
+
+ def service_response = -1
+ common.infoMsg("Waiting for service on http://${stacklight_vip}:15013/ to start")
+ timeout(120){
+ while (service_response != 200) {
+ common.infoMsg("Trying to connect to http://${stacklight_vip}:15013/")
+ service_response = salt.cmdRun(master, 'I@salt:master', 'curl -ksL -w "%{http_code}" -o /dev/null "${stacklight_vip}:15013/"')
+ sleep(5)
+ }
+ }
+
+ salt.enforceState(master, 'I@grafana:client', 'grafana.client', true)
+
+ salt.enforceState(master, 'I@heka:log_collector', 'heka.log_collector')
+}
+
+def installStacklightv1Control(master) {
def salt = new com.mirantis.mk.Salt()
// infra install
@@ -362,7 +430,7 @@
sleep(10)
}
-def installStacklightClient(master) {
+def installStacklightv1Client(master) {
def salt = new com.mirantis.mk.Salt()
def common = new com.mirantis.mk.Common()