Skip to content

Commit 42d818e

Browse files
committed
👌 Package: use flexible regex for vdisk detection
The storage controller name can vary by machie. Replace the hardcoded controller name with a regex that matches any controller, making vdisk detection work regardless of the storage config.
1 parent dd5a24c commit 42d818e

1 file changed

Lines changed: 4 additions & 2 deletions

File tree

playbook-package.yml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,10 @@
2222

2323
- name: Set VM machine information
2424
ansible.builtin.set_fact:
25-
vdisk_path: "{{ vminfo.stdout | regex_search('\"SATA Controller-0-0\"=\"(.+)\"', '\\1') | first }}"
26-
vdisk_uuid: "{{ vminfo.stdout | regex_search('\"SATA Controller-ImageUUID-0-0\"=\"(.+)\"', '\\1') | first }}"
25+
vdisk_path: >-
26+
{{ vminfo.stdout | regex_search('"[^"]*-0-0"="([^"]+\.vmdk)"', '\1') | first }}
27+
vdisk_uuid: >-
28+
{{ vminfo.stdout | regex_search('"[^"]*-ImageUUID-0-0"="([^"]+)"', '\1') | first }}
2729
tags: [always]
2830

2931
- name: Get stats of {{ vdisk_path }}

0 commit comments

Comments
 (0)