Allow to specify underlay and salt roles separatelly
- Manage custom node roles with 'underlay' fixture and use the
nodes names for 'execute_commands' templates:
export ROLES='["role1", "role2", ...]'
- Install salt-minion on custom node roles from config.underlay.ssh
export SALT_ROLES='["salt-role1", "salt-role2", ...]'
The SALT_ROLES allows to specify only the nodes for salt-minion, while
other nodes from ROLES will be available only for UnderlayManager.
Change-Id: Iab2d021ecf8a9f2fce6c322aea6439b8d1d11106
diff --git a/tcp_tests/templates/shared-salt.yaml b/tcp_tests/templates/shared-salt.yaml
index 95f207a..38c1da8 100644
--- a/tcp_tests/templates/shared-salt.yaml
+++ b/tcp_tests/templates/shared-salt.yaml
@@ -497,7 +497,15 @@
{%- macro MACRO_INSTALL_SALT_MINIONS() %}
{#######################################}
-{% for ssh in config.underlay.ssh %}
+{%- for ssh in config.underlay.ssh %}
+ {%- set salt_roles = [] %}
+ {%- for role in ssh['roles'] %}
+ {%- if role in config.salt_deploy.salt_roles %}
+ {%- set _ = salt_roles.append(role) %}
+ {%- endif %}
+ {%- endfor %}
+
+ {%- if salt_roles %}
- description: Configure salt-minion on {{ ssh['node_name'] }}
cmd: |
[ ! -d /etc/salt/minion.d ] && mkdir -p /etc/salt/minion.d;
@@ -530,8 +538,15 @@
node_name: {{ ssh['node_name'] }}
retry: {count: 1, delay: 1}
skip_fail: false
-{% endfor %}
+ {%- else %}
+- description: Check SSH connectivity to non-salt-minion node {{ ssh['node_name'] }}
+ cmd: echo "SSH to $(hostname -f) passed"
+ node_name: {{ ssh['node_name'] }}
+ retry: {count: 1, delay: 1}
+ skip_fail: false
+ {%- endif %}
+{%- endfor %}
- description: Accept salt keys from all the nodes
cmd: salt-key -A -y