Get rid of hardcoded node names in pipelines

Change-Id: I2cbb062e7e1a8d7c6e41f8234581e66d063276c9
Related-Prod: PROD-25517
diff --git a/ceph-add-osd-upmap.groovy b/ceph-add-osd-upmap.groovy
index 96ca29d..4bbb78d 100644
--- a/ceph-add-osd-upmap.groovy
+++ b/ceph-add-osd-upmap.groovy
@@ -64,7 +64,8 @@
 
         stage ("verify client versions")
         {
-          def nodes = salt.getMinions("pepperEnv", "I@ceph:common and not E@mon*")
+          // I@docker:swarm and I@prometheus:server - mon* nodes
+          def nodes = salt.getMinions("pepperEnv", "I@ceph:common and not ( I@docker:swarm and I@prometheus:server )")
           for ( node in nodes )
           {
             def versions = salt.cmdRun("pepperEnv", node, "ceph features --format json", checkResponse=true, batch=null, output=false).values()[0]
diff --git a/cloud-deploy-pipeline.groovy b/cloud-deploy-pipeline.groovy
index 1ab46de..496ef90 100644
--- a/cloud-deploy-pipeline.groovy
+++ b/cloud-deploy-pipeline.groovy
@@ -384,7 +384,7 @@
             // install k8s
             if (common.checkContains('STACK_INSTALL', 'k8s')) {
                 extra_tgt_bckp = extra_tgt
-                extra_tgt = 'and not kdt* and not cfg* ' + extra_tgt_bckp
+                extra_tgt = 'and not kdt* and not I@salt:master ' + extra_tgt_bckp
                 stage('Install Kubernetes infra') {
                     if (STACK_TYPE == 'aws') {
                         // configure kubernetes_control_address - save loadbalancer
@@ -509,7 +509,8 @@
                 // Workaround for PROD-17765 issue to prevent crashes of keystone.role_present state.
                 // More details: https://mirantis.jira.com/browse/PROD-17765
                 salt.restartSaltMinion(venvPepper, "I@keystone:client ${extra_tgt}")
-                salt.minionsReachable(venvPepper, "I@salt:master and *01* ${extra_tgt}", 'I@keystone:client', null, 10, 6)
+                //
+                salt.minionsReachable(venvPepper, 'I@salt:master', 'I@keystone:client ${extra_tgt}', null, 10, 6)
 
                 stage('Install OpenStack network') {
 
@@ -560,7 +561,7 @@
             if (common.checkContains('STACK_INSTALL', 'cicd')) {
                 stage('Install Cicd') {
                     extra_tgt_bckp = extra_tgt
-                    extra_tgt = 'and cid* ' + extra_tgt_bckp
+                    extra_tgt = 'and I@_param:drivetrain_role:cicd ' + extra_tgt_bckp
                     orchestrate.installInfra(venvPepper, extra_tgt)
                     orchestrate.installCicd(venvPepper, extra_tgt)
                     extra_tgt = extra_tgt_bckp
@@ -612,7 +613,7 @@
                         test.executeConformance(config)
                     } else {
                         def output_file = image.replaceAll('/', '-') + '.output'
-                        def target = "ctl01* ${extra_tgt}"
+                        def target = "I@keystone:server:role:primary ${extra_tgt}"
                         def conformance_output_file = 'conformance_test.tar'
 
                         // run image
@@ -642,7 +643,7 @@
                               "py.test --junit-xml=${report_dir}report.xml" +
                               " --html=${report_dir}report.html -v vapor/tests/ -k 'not destructive' "
 
-                    salt.runSaltProcessStep(venvPepper, 'cfg*', 'saltutil.refresh_pillar', [], null, true)
+                    salt.runSaltProcessStep(venvPepper, 'I@salt:master', 'saltutil.refresh_pillar', [], null, true)
                     salt.enforceState(venvPepper, 'I@opencontrail:test' , 'opencontrail.test' , true)
 
                     salt.cmdRun(venvPepper, 'I@opencontrail:test', cmd, false)
diff --git a/deploy-virtual-edge-mom.groovy b/deploy-virtual-edge-mom.groovy
index 875195b..8d35d37 100644
--- a/deploy-virtual-edge-mom.groovy
+++ b/deploy-virtual-edge-mom.groovy
@@ -171,7 +171,7 @@
                     saltMasterURL = "http://${edgeBuildsInfra[ed_].description.tokenize(' ')[1]}:6969"
 
 
-                    enableSyndic(saltMasterURL, 'cfg01*', SALT_MASTER_CREDENTIALS, salt_mom_ip)
+                    enableSyndic(saltMasterURL, 'I@salt:master', SALT_MASTER_CREDENTIALS, salt_mom_ip)
 
                     props_ = edge_deploy_schemas[ed_]['properties']
                     deploy_job = edge_deploy_schemas[ed_]['deploy_job_name']
diff --git a/opencontrail-upgrade.groovy b/opencontrail-upgrade.groovy
index a358222..7c761a0 100644
--- a/opencontrail-upgrade.groovy
+++ b/opencontrail-upgrade.groovy
@@ -66,7 +66,7 @@
 
             stage('Opencontrail controllers upgrade') {
 
-                oc_component_repo = salt.runSaltProcessStep(pepperEnv, 'I@opencontrail:control and *01*', 'cmd.shell', ['grep -RE \'oc[0-9]{2,3}\' /etc/apt/sources.list* | awk \'{print $1}\' | sed \'s/ *:.*//\''], null, true)
+                oc_component_repo = salt.runSaltProcessStep(pepperEnv, 'I@opencontrail:control:role:primary', 'cmd.shell', ['grep -RE \'oc[0-9]{2,3}\' /etc/apt/sources.list* | awk \'{print $1}\' | sed \'s/ *:.*//\''], null, true)
 
                 oc_component_repo = oc_component_repo['return'][0].values()[0]
 
@@ -103,22 +103,14 @@
                 args = 'apt install contrail-database -y;'
                 check = 'nodetool status'
 
-                // ntw01
-                runCommonCommands('I@opencontrail:control and *01*', command, args, check, salt, pepperEnv, common)
-                // ntw02
-                runCommonCommands('I@opencontrail:control and *02*', command, args, check, salt, pepperEnv, common)
-                // ntw03
-                runCommonCommands('I@opencontrail:control and *03*', command, args, check, salt, pepperEnv, common)
+                runCommonCommands('I@opencontrail:control:role:primary', command, args, check, salt, pepperEnv, common)
+                runCommonCommands('I@opencontrail:control:role:secondary', command, args, check, salt, pepperEnv, common)
 
                 args = "apt install -o Dpkg::Options::=\"--force-confold\" ${CONTROL_PKGS} -y --force-yes;"
                 check = 'contrail-status'
 
-                // ntw01
-                runCommonCommands('I@opencontrail:control and *01*', command, args, check, salt, pepperEnv, common)
-                // ntw02
-                runCommonCommands('I@opencontrail:control and *02*', command, args, check, salt, pepperEnv, common)
-                // ntw03
-                runCommonCommands('I@opencontrail:control and *03*', command, args, check, salt, pepperEnv, common)
+                runCommonCommands('I@opencontrail:control:role:primary', command, args, check, salt, pepperEnv, common)
+                runCommonCommands('I@opencontrail:control:role:secondary', command, args, check, salt, pepperEnv, common)
 
                 try {
                     salt.enforceState(pepperEnv, 'I@opencontrail:control', 'opencontrail')
@@ -144,7 +136,7 @@
 
             stage('Opencontrail analytics upgrade') {
 
-                oc_component_repo = salt.runSaltProcessStep(pepperEnv, 'I@opencontrail:collector and *01*', 'cmd.shell', ['grep -RE \'oc[0-9]{2,3}\' /etc/apt/sources.list* | awk \'{print $1}\' | sed \'s/ *:.*//\''], null, true)
+                oc_component_repo = salt.runSaltProcessStep(pepperEnv, 'I@opencontrail:collector:role:primary', 'cmd.shell', ['grep -RE \'oc[0-9]{2,3}\' /etc/apt/sources.list* | awk \'{print $1}\' | sed \'s/ *:.*//\''], null, true)
 
                 oc_component_repo = oc_component_repo['return'][0].values()[0]
 
@@ -161,22 +153,14 @@
                 args = 'apt install contrail-database -y;'
                 check = 'nodetool status'
 
-                // nal01
-                runCommonCommands('I@opencontrail:collector and *01*', command, args, check, salt, pepperEnv, common)
-                // nal02
-                runCommonCommands('I@opencontrail:collector and *02*', command, args, check, salt, pepperEnv, common)
-                // nal03
-                runCommonCommands('I@opencontrail:collector and *03*', command, args, check, salt, pepperEnv, common)
+                runCommonCommands('I@opencontrail:collector:role:primary', command, args, check, salt, pepperEnv, common)
+                runCommonCommands('I@opencontrail:collector:role:secondary', command, args, check, salt, pepperEnv, common)
 
                 args = "apt install -o Dpkg::Options::=\"--force-confold\" ${ANALYTIC_PKGS} -y --force-yes;"
                 check = 'contrail-status'
 
-                // nal01
-                runCommonCommands('I@opencontrail:collector and *01*', command, args, check, salt, pepperEnv, common)
-                // nal02
-                runCommonCommands('I@opencontrail:collector and *02*', command, args, check, salt, pepperEnv, common)
-                // nal03
-                runCommonCommands('I@opencontrail:collector and *03*', command, args, check, salt, pepperEnv, common)
+                runCommonCommands('I@opencontrail:collector:role:primary', command, args, check, salt, pepperEnv, common)
+                runCommonCommands('I@opencontrail:collector:role:secondary', command, args, check, salt, pepperEnv, common)
 
                 try {
                     salt.enforceState(pepperEnv, 'I@opencontrail:collector', 'opencontrail')
@@ -302,7 +286,7 @@
 
            stage('Opencontrail controllers rollback') {
 
-                oc_component_repo = salt.runSaltProcessStep(pepperEnv, 'I@opencontrail:control and *01*', 'cmd.shell', ['grep -RE \'oc[0-9]{2,3}\' /etc/apt/sources.list* | awk \'{print $1}\' | sed \'s/ *:.*//\''], null, true)
+                oc_component_repo = salt.runSaltProcessStep(pepperEnv, 'I@opencontrail:control:role:primary', 'cmd.shell', ['grep -RE \'oc[0-9]{2,3}\' /etc/apt/sources.list* | awk \'{print $1}\' | sed \'s/ *:.*//\''], null, true)
                 oc_component_repo = oc_component_repo['return'][0].values()[0]
 
                 try {
@@ -318,22 +302,14 @@
                 args = 'apt install contrail-database -y --force-yes;'
                 check = 'nodetool status'
 
-                // ntw01
-                runCommonCommands('I@opencontrail:control and *01*', command, args, check, salt, pepperEnv, common)
-                // ntw02
-                runCommonCommands('I@opencontrail:control and *02*', command, args, check, salt, pepperEnv, common)
-                // ntw03
-                runCommonCommands('I@opencontrail:control and *03*', command, args, check, salt, pepperEnv, common)
+                runCommonCommands('I@opencontrail:control:role:primary', command, args, check, salt, pepperEnv, common)
+                runCommonCommands('I@opencontrail:control:role:secondary', command, args, check, salt, pepperEnv, common)
 
                 args = "apt install -o Dpkg::Options::=\"--force-confold\" ${CONTROL_PKGS} -y --force-yes;"
                 check = 'contrail-status'
 
-                // ntw01
-                runCommonCommands('I@opencontrail:control and *01*', command, args, check, salt, pepperEnv, common)
-                // ntw02
-                runCommonCommands('I@opencontrail:control and *02*', command, args, check, salt, pepperEnv, common)
-                // ntw03
-                runCommonCommands('I@opencontrail:control and *03*', command, args, check, salt, pepperEnv, common)
+                runCommonCommands('I@opencontrail:control:role:primary', command, args, check, salt, pepperEnv, common)
+                runCommonCommands('I@opencontrail:control:role:secondary', command, args, check, salt, pepperEnv, common)
 
                 try {
                     salt.enforceState(pepperEnv, 'I@opencontrail:control', 'opencontrail')
@@ -361,7 +337,7 @@
 
             stage('Opencontrail analytics rollback') {
 
-                oc_component_repo = salt.runSaltProcessStep(pepperEnv, 'I@opencontrail:collector and *01*', 'cmd.shell', ['grep -RE \'oc[0-9]{2,3}\' /etc/apt/sources.list* | awk \'{print $1}\' | sed \'s/ *:.*//\''], null, true)
+                oc_component_repo = salt.runSaltProcessStep(pepperEnv, 'I@opencontrail:collector:role:primary', 'cmd.shell', ['grep -RE \'oc[0-9]{2,3}\' /etc/apt/sources.list* | awk \'{print $1}\' | sed \'s/ *:.*//\''], null, true)
                 oc_component_repo = oc_component_repo['return'][0].values()[0]
 
                 try {
@@ -377,22 +353,14 @@
                 args = 'apt install contrail-database -y --force-yes;'
                 check = 'nodetool status'
 
-                // nal01
-                runCommonCommands('I@opencontrail:collector and *01*', command, args, check, salt, pepperEnv, common)
-                // nal02
-                runCommonCommands('I@opencontrail:collector and *02*', command, args, check, salt, pepperEnv, common)
-                // nal03
-                runCommonCommands('I@opencontrail:collector and *03*', command, args, check, salt, pepperEnv, common)
+                runCommonCommands('I@opencontrail:collector:role:primary', command, args, check, salt, pepperEnv, common)
+                runCommonCommands('I@opencontrail:collector:role:secondary', command, args, check, salt, pepperEnv, common)
 
                 args = "apt install -o Dpkg::Options::=\"--force-confold\" ${ANALYTIC_PKGS} -y --force-yes;"
                 check = 'contrail-status'
 
-                // nal01
-                runCommonCommands('I@opencontrail:collector and *01*', command, args, check, salt, pepperEnv, common)
-                // nal02
-                runCommonCommands('I@opencontrail:collector and *02*', command, args, check, salt, pepperEnv, common)
-                // nal03
-                runCommonCommands('I@opencontrail:collector and *03*', command, args, check, salt, pepperEnv, common)
+                runCommonCommands('I@opencontrail:collector:role:primary', command, args, check, salt, pepperEnv, common)
+                runCommonCommands('I@opencontrail:collector:role:secondary', command, args, check, salt, pepperEnv, common)
 
                 try {
                     salt.enforceState(pepperEnv, 'I@opencontrail:collector', 'opencontrail')
diff --git a/update-salt-environment.groovy b/update-salt-environment.groovy
index b91f385..2ae408f 100644
--- a/update-salt-environment.groovy
+++ b/update-salt-environment.groovy
@@ -27,7 +27,7 @@
                         'apt-get update && apt-get install -y salt-formula-*'
                     )
                     common.infoMsg("Running salt sync-all")
-                    salt.runSaltProcessStep(venvPepper, 'jma*', 'saltutil.sync_all', [], null, true)
+                    salt.runSaltProcessStep(venvPepper, '*', 'saltutil.sync_all', [], null, true)
                 }
             }
             stage("Update Reclass") {
diff --git a/upgrade-mcp-release.groovy b/upgrade-mcp-release.groovy
index 5cd74ea..9b1c89d 100644
--- a/upgrade-mcp-release.groovy
+++ b/upgrade-mcp-release.groovy
@@ -128,12 +128,9 @@
         common.infoMsg('Work-around for PROD-29155 already apply, nothing todo')
         return
     }
-    salt.fullRefresh(venvPepper, 'cfg*')
-    salt.fullRefresh(venvPepper, 'cmp*')
+    salt.fullRefresh(venvPepper, 'I@salt:master')
+    salt.fullRefresh(venvPepper, 'I@nova:compute')
     for (String minion in saltMinions) {
-        if (!minion.startsWith('cmp')) {
-            continue
-        }
         // First attempt, second will be performed in next validateReclassModel() stages
         try {
             salt.cmdRun(venvPepper, 'I@salt:master', "reclass -n ${minion}", true, null, false).get('return')[0].values()[0].replaceAll('Salt command execution success', '').trim()
@@ -431,7 +428,8 @@
                 }
 
                 wa29352(minions, cluster_name)
-                wa29155(minions, cluster_name)
+                def computeMinions = salt.getMinions(venvPepper, 'I@nova:compute')
+                wa29155(computeMinions, cluster_name)
 
                 try {
                     common.infoMsg('Perform: UPDATE Reclass package')