From aa92a7f71755c6652e45a343f046d01ea1cbbe8b Mon Sep 17 00:00:00 2001 From: "Francesco Pantano (fmount)" Date: Wed, 6 Feb 2019 16:35:32 +0100 Subject: [PATCH] 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 Closes-Bug: 1814070 --- workbooks/ceph-ansible.yaml | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/workbooks/ceph-ansible.yaml b/workbooks/ceph-ansible.yaml index bf7f10608..cccf17ae1 100644 --- a/workbooks/ceph-ansible.yaml +++ b/workbooks/ceph-ansible.yaml @@ -108,7 +108,8 @@ workflows: gather_facts: no tasks: - 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: ansible_output: <% json_parse(task().result.stderr) %> on-success: set_ip_uuids @@ -121,10 +122,15 @@ workflows: json_node_data_lookup: <% json_parse($.node_data_lookup) %> on-error: - 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 map_node_data_lookup: 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 set_role_vars: publish: