more fixes

This commit is contained in:
Lee Goolsbee
2024-03-26 09:32:20 -05:00
parent d58d02f1f6
commit e2ea50d4f7
9 changed files with 40 additions and 24 deletions

View File

@@ -8,22 +8,21 @@
ansible.builtin.set_fact:
mounts_list: "{{ ansible_mounts | map(attribute='mount') | list }}"
# - name: discover mesh volume device stat
# ansible.builtin.stat:
# path: '/dev/xvdd'
# follow: no
# get_attributes: yes
# register: mesh_device_stat
- name: Retrieve info for this instance from EC2
amazon.aws.ec2_instance_info:
region: "{{ ansible_ec2_placement_region }}"
instance_ids:
- "{{ ansible_ec2_instance_id }}"
retries: 10
delay: 10
register: ec2_instance_facts
until: ec2_instance_facts.error is not defined
- name: pull info for this_instance from instanceFacts
- name: Create list of current block devices attached to this instance
ansible.builtin.set_fact:
this_instance: "{{ instanceFacts.instances | first }}"
devices_list: "{{ ec2_instance_facts.instances[0].block_device_mappings | map(attribute='device_name') | list }}"
- name: create list of current block devices
ansible.builtin.set_fact:
devices_list: "{{ this_instance.block_device_mappings | map(attribute='device_name') | list }}"
- name: discover mesh volume device stat
- name: Discover mesh volume device stat
ansible.builtin.stat:
path: '/dev/xvdd'
follow: no
@@ -39,7 +38,7 @@
# lazy guess at mesh_vol - # TODO make this better
- name: set mesh_vol from currently mounted device
ansible.builtin.set_fact:
mesh_vol: "{{ this_instance | community.general.json_query(vol_id_query) | first }}"
mesh_vol: "{{ ec2_instance_facts.instances[0] | community.general.json_query(vol_id_query) | first }}"
vars:
vol_id_query: "block_device_mappings[?(@.device_name=='/dev/xvdd')].ebs.volume_id"
when: (mesh_device is defined) and (mesh_device|length > 0)