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/settings_oslo.py b/tcp_tests/settings_oslo.py
index ad4cce3..288013c 100644
--- a/tcp_tests/settings_oslo.py
+++ b/tcp_tests/settings_oslo.py
@@ -129,6 +129,11 @@
ct.Cfg('templates_dir', ct.String(),
help="Path to directory with templates",
default=_default_templates_dir),
+ ct.Cfg('salt_roles', ct.JSONList(),
+ help="Node roles to install salt-minions and manage by salt",
+ default=[ext.UNDERLAY_NODE_ROLES.salt_master,
+ ext.UNDERLAY_NODE_ROLES.salt_minion,
+ ext.UNDERLAY_NODE_ROLES.k8s_controller]),
]
salt_opts = [
ct.Cfg('salt_master_host', ct.IPAddress(),
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
diff --git a/tcp_tests/templates/virtual-mcp-pike-dvr-ceph-rgw/ceph.yaml b/tcp_tests/templates/virtual-mcp-pike-dvr-ceph-rgw/ceph.yaml
index 28c410b..c5f8f3c 100644
--- a/tcp_tests/templates/virtual-mcp-pike-dvr-ceph-rgw/ceph.yaml
+++ b/tcp_tests/templates/virtual-mcp-pike-dvr-ceph-rgw/ceph.yaml
@@ -110,14 +110,23 @@
retry: {count: 1, delay: 10}
skip_fail: false
-{% 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: Restart salt-minion as workaround of PROD-16970
cmd: |
service salt-minion restart; # For case if salt-minion was already installed
node_name: {{ ssh['node_name'] }}
retry: {count: 1, delay: 1}
skip_fail: false
-{% endfor %}
+ {%- endif %}
+{%- endfor %}
- description: Connect ceph to glance
cmd: |
diff --git a/tcp_tests/templates/virtual-mcp-pike-ovs-ceph/ceph.yaml b/tcp_tests/templates/virtual-mcp-pike-ovs-ceph/ceph.yaml
index 317021a..bcbcad0 100644
--- a/tcp_tests/templates/virtual-mcp-pike-ovs-ceph/ceph.yaml
+++ b/tcp_tests/templates/virtual-mcp-pike-ovs-ceph/ceph.yaml
@@ -113,14 +113,23 @@
retry: {count: 1, delay: 10}
skip_fail: false
-{% 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: Restart salt-minion as workaround of PROD-16970
cmd: |
service salt-minion restart; # For case if salt-minion was already installed
node_name: {{ ssh['node_name'] }}
retry: {count: 1, delay: 1}
skip_fail: false
-{% endfor %}
+ {%- endif %}
+{%- endfor %}
- description: Connect ceph to glance
cmd: |