Sanitize the uuid string for ceph-ansible

dmidecode can return some additional data if SMBIOS is updated; this
ensures output matches the UUID format.

Change-Id: I5c61c0049bfd16114894cf4db3b79f94b6d9291b
Related-Bug: 1762460
This commit is contained in:
Giulio Fidente 2019-02-07 09:01:32 +01:00
parent 94203f0447
commit ad803ab716
1 changed files with 2 additions and 1 deletions

View File

@ -446,7 +446,8 @@ outputs:
set_fact:
nodes_data: "{% raw %}{{ lookup('file','./nodes_uuid_data.json') | from_json }}{% endraw %}"
- name: register machine id
command: dmidecode -s system-uuid | tr A-F a-f
# 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
register: machine_uuid
# NOTE(tonyb): 0 == no error, 1 == -EPERM or bad data and 2 == Command not found
# 1 and 2 aren't great but shouldn't cause the deploy to fail. If we're using