Skip to content

Commit 8538c69

Browse files
committed
create_data_partition: Fix AWS data_device logic
Unfortunately, the ansible_devices dictionary on some OS's (notably RHEL 9 and its derivatives ) does not include the .serial attribute. Fixes: 0d5ade2 ("create_data_partition: Detect device to be used for /data partition") Signed-off-by: Chuck Lever <[email protected]>
1 parent d1dcd96 commit 8538c69

File tree

1 file changed

+2
-3
lines changed
  • playbooks/roles/create_data_partition/tasks

1 file changed

+2
-3
lines changed

playbooks/roles/create_data_partition/tasks/main.yml

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
block_device_dict: "{{ terraform_output.stdout | from_json }}"
2626
local_map: "{{ block_device_dict[inventory_hostname] }}"
2727
ansible.builtin.set_fact:
28-
data_volume_id: "{{ item.value | regex_replace('-', '') }}"
28+
data_volume_id: "{{ 'nvme-Amazon_Elastic_Block_Store_' + item.value | regex_replace('-', '') }}"
2929
when:
3030
item.key == "/dev/sdf"
3131
with_dict: "{{ local_map }}"
@@ -35,8 +35,7 @@
3535
ansible.builtin.set_fact:
3636
data_device: "{{ '/dev/' + item.key }}"
3737
when:
38-
- item.value.model == "Amazon Elastic Block Store"
39-
- item.value.serial == data_volume_id
38+
- data_volume_id in item.value.links.ids
4039
loop_control:
4140
label: "Adding block device: /dev/{{ item.key }}"
4241
with_dict: "{{ ansible_devices }}"

0 commit comments

Comments
 (0)