Skip to content

Commit d389d25

Browse files
committed
terraform/AWS: Fix AWS support in the volume_group role
"make bringup" fails: The conditional check 'item.value.serial in ebs_volume_ids' failed. The error was: error while evaluating conditional (item.value.serial in ebs_volume_ids): 'dict object' has no attribute 'serial'. Unfortunately, the ansible_devices dictionary on some OS's (notably RHEL 9 and its derivatives ) does not include the .serial attribute. Fixes: d1867bb ("volume_group: Create volume group on terraform/AWS nodes") Signed-off-by: Chuck Lever <[email protected]>
1 parent 8538c69 commit d389d25

File tree

1 file changed

+2
-3
lines changed
  • playbooks/roles/volume_group/tasks/terraform

1 file changed

+2
-3
lines changed

playbooks/roles/volume_group/tasks/terraform/aws.yml

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@
3434
block_device_dict: "{{ terraform_output.stdout | from_json }}"
3535
local_map: "{{ block_device_dict[inventory_hostname] }}"
3636
ansible.builtin.set_fact:
37-
ebs_volume_ids: "{{ ebs_volume_ids + [ item.value | regex_replace('-', '') ] }}"
37+
ebs_volume_ids: "{{ ebs_volume_ids + [ 'nvme-Amazon_Elastic_Block_Store_' + item.value | regex_replace('-', '') ] }}"
3838
when:
3939
item.key != "/dev/sdf"
4040
with_dict: "{{ local_map }}"
@@ -43,8 +43,7 @@
4343
ansible.builtin.set_fact:
4444
physical_volumes: "{{ physical_volumes + ['/dev/' + item.key] }}"
4545
when:
46-
- item.value.model == "Amazon Elastic Block Store"
47-
- item.value.serial in ebs_volume_ids
46+
- item.value.links.ids | intersect(ebs_volume_ids) | list | count > 0
4847
loop_control:
4948
label: "Adding block device: /dev/{{ item.key }}"
5049
with_dict: "{{ ansible_devices }}"

0 commit comments

Comments
 (0)