task name, comments, and other general formatting updates

This commit is contained in:
Lee Goolsbee
2024-03-26 14:54:39 -05:00
parent b0824a858c
commit 6881bc1a89
12 changed files with 92 additions and 93 deletions

View File

@@ -4,7 +4,7 @@
# if we dont have mesh_vol then we need to either hydrate one from snap or make a new/empty one
# first, try to set mesh_vol from currently mounted volume
- name: create list of current mounts
- name: Create list of current mounts
ansible.builtin.set_fact:
mounts_list: "{{ ansible_mounts | map(attribute='mount') | list }}"
@@ -29,27 +29,27 @@
get_attributes: yes
register: mesh_device_stat
- name: describe mesh volume true device
- name: Describe mesh volume true device
ansible.builtin.set_fact:
mesh_device: "{{ mesh_device_stat.stat['lnk_source'] }}"
ignore_errors: yes
when: '"lnk_source" in mesh_device_stat.stat'
# lazy guess at mesh_vol - # TODO make this better
- name: set mesh_vol from currently mounted device
- name: Set mesh_vol from currently mounted device
ansible.builtin.set_fact:
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)
when: (mesh_device is defined) and (mesh_device | length > 0)
- name: shall we check for abandoned?
- name: Determine whether we should check for an abandoned EBS volume
ansible.builtin.set_fact:
abandoned_check: "{{ ((mesh_vol is not defined) or (mesh_vol|length == 0)) | ternary(true, false) }}"
abandoned_check: "{{ ((mesh_vol is not defined) or (mesh_vol | length == 0)) | ternary(true, false) }}"
# second, if we dont have a mesh_vol yet, try to set it from abandoned
- block:
- name: check for abandoned ebs vols of this stack in current AZ
- name: Check for abandoned EBS volumes of this stack in current AZ
amazon.aws.ec2_vol_info:
region: "{{ ansible_ec2_placement_region }}"
filters:
@@ -63,21 +63,21 @@
ansible.builtin.set_fact:
orphan_vol_list: "{{ orphan_vol_info | json_query('volumes[*].id') }}"
- name: loop to get an orphan_lease_lock (temporary lock on volume cleaned up in handler)
- name: Loop to get an orphan_lease_lock (temporary lock on volume cleaned up in handler)
ansible.builtin.include_tasks: orphan_lease_lock.yml
with_items: "{{ orphan_vol_list }}"
loop_control:
loop_var: test_orphan_vol
when: orphan_vol is not defined
- name: set mesh_vol from orphan_vol
- name: Set mesh_vol from orphan_vol
ansible.builtin.set_fact:
mesh_vol: "{{ orphan_vol }}"
when:
- orphan_vol is defined
- orphan_vol | length > 0
- name: attach abandoned mesh vol to this ec2
- name: Attach abandoned mesh vol to this ec2
amazon.aws.ec2_vol:
instance: "{{ ansible_ec2_instance_id }}"
id: "{{ mesh_vol }}"
@@ -92,7 +92,7 @@
# third, if no mesh_vol and this is a clone, set mesh_snap
- block:
- name: create az dict attributes
- name: Create AZ dict attributes
ansible.builtin.set_fact:
my_attributes:
- key: "{{ atl_mesh_azname_az1 }}"
@@ -102,15 +102,15 @@
- key: "{{ atl_mesh_azname_az3 }}"
value: "{{ atl_mesh_snapshot_az3 }}"
- name: create az dict if this stack is a mesh clone
- name: Create AZ dict if this stack is a mesh clone
ansible.builtin.set_fact:
azsnapdict: "{{ my_attributes | items2dict }}"
- name: set mesh clone node snapshot fact if this stack is a mesh clone
- name: Set mesh clone node snapshot fact if this stack is a mesh clone
ansible.builtin.set_fact:
mesh_snapshot: "{{ azsnapdict[ansible_ec2_placement_availability_zone] }}"
ignore_errors: yes
when:
- (mesh_vol is not defined) or (mesh_vol|length == 0)
- mesh_clone
- (mesh_vol is not defined) or (mesh_vol | length == 0)
- mesh_clone