Handle case change for dmidecode >= 3.1 in ceph-ansible workbook

Forced lowercase on the dmidecode output matching the UUID
format returned if SMBIOS is updated and added a task inside
the workflow to manipulate the node_data_lookup parameter
(lowercase enforcing).

Change-Id: Ic7ad351a7d564819bc8967045e6a227f158a9ae1
Co-Authored-By: Giulio Fidente <gfidente@redhat.com>
Closes-Bug: 1814070
This commit is contained in:
Francesco Pantano (fmount) 2019-02-06 16:35:32 +01:00
parent 7d89b37a53
commit aa92a7f717
1 changed files with 8 additions and 2 deletions

View File

@ -108,7 +108,8 @@ workflows:
gather_facts: no gather_facts: no
tasks: tasks:
- name: collect machine id - name: collect machine id
command: dmidecode -s system-uuid # awk strips unwanted output, see LP bug #1762460
shell: dmidecode -s system-uuid | awk 'match($0, /[0-9A-Fa-f]{8}-[0-9A-Fa-f]{4}-[0-9A-Fa-f]{4}-[0-9A-Fa-f]{4}-[0-9A-Fa-f]{12}/) { print substr($0, RSTART, RLENGTH) }' | tr A-F a-f
publish: publish:
ansible_output: <% json_parse(task().result.stderr) %> ansible_output: <% json_parse(task().result.stderr) %>
on-success: set_ip_uuids on-success: set_ip_uuids
@ -121,10 +122,15 @@ workflows:
json_node_data_lookup: <% json_parse($.node_data_lookup) %> json_node_data_lookup: <% json_parse($.node_data_lookup) %>
on-error: on-error:
- fail(msg=<% 'Ceph deployment stopped, NodeDataLookup (node_data_lookup) is not valid JSON. {0}'.format($.node_data_lookup) %>) - fail(msg=<% 'Ceph deployment stopped, NodeDataLookup (node_data_lookup) is not valid JSON. {0}'.format($.node_data_lookup) %>)
on-success:
- uuid_force_lowercase
uuid_force_lowercase:
publish:
node_data: <% dict($.json_node_data_lookup.keys().select($.toLower()).zip($.json_node_data_lookup.values())) %>
on-success: map_node_data_lookup on-success: map_node_data_lookup
map_node_data_lookup: map_node_data_lookup:
publish: publish:
ips_data: <% let(uuids => $.ip_uuids, root => $) -> $.ips_list.toDict($, $root.json_node_data_lookup.get($uuids.get($, "NO-UUID-FOUND"), {})) %> ips_data: <% let(uuids => $.ip_uuids, root => $) -> $.ips_list.toDict($, $root.node_data.get($uuids.get($, "NO-UUID-FOUND"), {})) %>
on-success: set_role_vars on-success: set_role_vars
set_role_vars: set_role_vars:
publish: publish: