Fix cicd and sl steps for virtual-ocata-cicd
Change-Id: I1cbc3cbe66d70beb91c05e849b6bbd7dbf632443
Reviewed-on: https://review.gerrithub.io/370564
Reviewed-by: Dennis Dmitriev <dis.xcom@gmail.com>
Tested-by: Dennis Dmitriev <dis.xcom@gmail.com>
diff --git a/tcp_tests/templates/virtual-mcp-ocata-cicd/sl.yaml b/tcp_tests/templates/virtual-mcp-ocata-cicd/sl.yaml
index 3a89bf2..7e0faf3 100644
--- a/tcp_tests/templates/virtual-mcp-ocata-cicd/sl.yaml
+++ b/tcp_tests/templates/virtual-mcp-ocata-cicd/sl.yaml
@@ -1,51 +1,44 @@
{% from 'virtual-mcp-ocata-cicd/underlay.yaml' import HOSTNAME_CFG01 with context %}
+# Pattern that helps salt to select Stacklight nodes
+{% set SL_NODES_SELECTOR = os_env('SL_NODES_SELECTOR','mon*') %}
+
# Install docker swarm
-- description: Configure docker service
- cmd: salt -C 'I@docker:swarm' state.sls docker.host
+- description: Prepare Docker host
+ cmd: salt --hard-crash --state-output=mixed --state-verbose=False -C 'I@docker:host and {{ SL_NODES_SELECTOR }}' state.sls docker.host
node_name: {{ HOSTNAME_CFG01 }}
- retry: {count: 1, delay: 10}
+ retry: {count: 1, delay: 5}
skip_fail: false
-- description: Install docker swarm on master node
- cmd: salt -C 'I@docker:swarm:role:master' state.sls docker.swarm
+- description: Install Docker Swarm master
+ cmd: salt --hard-crash --state-output=mixed --state-verbose=False -C 'I@docker:swarm:role:master and {{ SL_NODES_SELECTOR }}' state.sls docker.swarm
node_name: {{ HOSTNAME_CFG01 }}
- retry: {count: 1, delay: 10}
+ retry: {count: 1, delay: 5}
skip_fail: false
-- description: Send grains to the swarm slave nodes
- cmd: salt -C 'I@docker:swarm' state.sls salt.minion.grains
+- description: Setup salt-minion on docker swarm master
+ cmd: salt --hard-crash --state-output=mixed --state-verbose=False -C 'I@docker:swarm:role:master and {{ SL_NODES_SELECTOR }}' state.sls salt &&
+ salt --hard-crash --state-output=mixed --state-verbose=False -C 'I@docker:swarm:role:master and {{ SL_NODES_SELECTOR }}' mine.flush &&
+ salt --hard-crash --state-output=mixed --state-verbose=False -C 'I@docker:swarm:role:master and {{ SL_NODES_SELECTOR }}' mine.update
node_name: {{ HOSTNAME_CFG01 }}
- retry: {count: 1, delay: 10}
+ retry: {count: 3, delay: 15}
skip_fail: false
-- description: Update mine
- cmd: salt -C 'I@docker:swarm' mine.update
+- description: Install Docker Swarm on other nodes
+ cmd: salt --hard-crash --state-output=mixed --state-verbose=False -C 'I@docker:swarm and {{ SL_NODES_SELECTOR }}' state.sls docker.swarm
node_name: {{ HOSTNAME_CFG01 }}
- retry: {count: 1, delay: 10}
+ retry: {count: 1, delay: 5}
skip_fail: false
-- description: Refresh modules
- cmd: salt -C 'I@docker:swarm' saltutil.refresh_modules; sleep 5;
+- description: Show Docker Swarm nodes
+ cmd: salt --hard-crash --state-output=mixed --state-verbose=False -C 'I@docker:swarm:role:master and {{ SL_NODES_SELECTOR }}' cmd.run 'docker node ls'
node_name: {{ HOSTNAME_CFG01 }}
- retry: {count: 1, delay: 10}
- skip_fail: false
-
-- description: Configure slave nodes
- cmd: salt -C 'I@docker:swarm:role:manager' state.sls docker.swarm -b 1
- node_name: {{ HOSTNAME_CFG01 }}
- retry: {count: 1, delay: 10}
- skip_fail: false
-
-- description: List registered Docker swarm nodes
- cmd: salt -C 'I@docker:swarm:role:master' cmd.run 'docker node ls'
- node_name: {{ HOSTNAME_CFG01 }}
- retry: {count: 1, delay: 10}
+ retry: {count: 1, delay: 5}
skip_fail: false
# Install slv2 infra
- description: Install telegraf
- cmd: salt -C 'I@telegraf:agentor or I@telegraf:remote_agent' state.sls telegraf
+ cmd: salt -C 'I@telegraf:agent or I@telegraf:remote_agent' state.sls telegraf
node_name: {{ HOSTNAME_CFG01 }}
retry: {count: 1, delay: 10}
skip_fail: false
@@ -125,19 +118,19 @@
# Configure the services running in Docker Swarm
- description: Install prometheus alertmanager
- cmd: salt -C 'I@docker:swarm' state.sls prometheus,heka.remote_collector -b 1
+ cmd: salt -C 'I@docker:swarm and {{ SL_NODES_SELECTOR }}' state.sls prometheus,heka.remote_collector -b 1
node_name: {{ HOSTNAME_CFG01 }}
retry: {count: 1, delay: 10}
skip_fail: false
- description: run docker state
- cmd: salt -C 'I@docker:swarm:role:master' state.sls docker
+ cmd: salt -C 'I@docker:swarm:role:master and {{ SL_NODES_SELECTOR }}' state.sls docker
node_name: {{ HOSTNAME_CFG01 }}
retry: {count: 1, delay: 10}
skip_fail: false
- description: docker ps
- cmd: salt -C 'I@docker:swarm' dockerng.ps
+ cmd: salt -C 'I@docker:swarm and {{ SL_NODES_SELECTOR }}' dockerng.ps
node_name: {{ HOSTNAME_CFG01 }}
retry: {count: 1, delay: 10}
skip_fail: false