Skip to content

Commit 8591b48

Browse files
eduolivareslewisdenny
authored andcommitted
[artifacts] Collect logs from all networker and compute nodes
Recently, PR [1] improved the collection of logs from EDPM nodes adding the networker nodes. This new PR includes any nodes from groups whose name includes either "networker" or "compute". This is relevant for BGP deployments, where EDPM groups are named "<rack>-<nodetype>" (e.g. r1-computes) and for DCN deployments where compute groups are named "dcn1_computes" and "dcn2_computes". [1] #2758 OSPRH-14643
1 parent b96d2f9 commit 8591b48

File tree

1 file changed

+13
-14
lines changed

1 file changed

+13
-14
lines changed

roles/artifacts/tasks/edpm.yml

+13-14
Original file line numberDiff line numberDiff line change
@@ -31,25 +31,24 @@
3131
- name: Extract Compute and Networker from zuul mapping if any
3232
when:
3333
- cifmw_edpm_deploy_extra_vars is defined
34+
- _edpm_vms_data | length > 0
3435
vars:
3536
_inv_data: "{{ _cifmw_artifacs_inventory_slurp['content'] | b64decode | from_yaml }}"
37+
# _edpm_vms_data is a list of dictionaries, each one with only one entry
38+
# that corresponds with a compute or a networker node
3639
_edpm_vms_data: >-
37-
{{
38-
(_inv_data['computes']['hosts'] | combine(_inv_data['networkers']['hosts']))
39-
if 'computes' in _inv_data and 'networkers' in _inv_data
40-
else ((_inv_data['computes']['hosts']) if 'computes' in _inv_data else
41-
(_inv_data['all']['hosts'] | default({})))
42-
}}
40+
{{
41+
_inv_data | dict2items |
42+
selectattr('key', 'match', '^.*(compute|networker).*$') |
43+
map(attribute='value.hosts') | flatten
44+
}}
45+
# each item is the single-entry dict
46+
_edpm_vms_item: "{{ item | dict2items | first }}"
4347
ansible.builtin.set_fact:
4448
ssh_key_file: "{{ cifmw_edpm_deploy_extra_vars.SSH_KEY_FILE }}"
45-
ssh_user: "{{ hostvars['compute-0'].ansible_user | default('zuul') }}"
46-
edpm_vms: >-
47-
{{
48-
_edpm_vms_data | dict2items |
49-
selectattr('value.ansible_host', 'defined') |
50-
selectattr('key', 'match', '^(compute|networker).*$') |
51-
map(attribute='value.ansible_host')
52-
}}
49+
ssh_user: "{{ _edpm_vms_item.value.ansible_user | default('zuul') }}" # all EDPM nodes have a common ansible_user
50+
edpm_vms: "{{ edpm_vms | default([]) + [_edpm_vms_item.value.ansible_host] }}"
51+
loop: "{{ _edpm_vms_data }}"
5352

5453
- name: Generate logs on EDPM vms
5554
when:

0 commit comments

Comments
 (0)