Files
dc-deployments-automation/roles/bitbucket_mesh_config/tasks/meshvol_create.yml

49 lines
1.7 KiB
YAML

---
# hydrate mesh volume from snapshot or create empty one if no snapshot set
- name: Create new EBS from snapshot for this mesh node with correct tags
amazon.aws.ec2_vol:
region: "{{ ansible_ec2_placement_region }}"
instance: "{{ ansible_ec2_instance_id }}"
volume_type: gp3
throughput: 250
device_name: /dev/xvdd
snapshot: "{{ mesh_snapshot }}"
tags:
service_name: "{{ atl_aws_stack_name }}"
Name: "{{ atl_aws_stack_name }} mesh volume {{ ansible_ec2_placement_availability_zone }}"
volume_type: "mesh"
register: mesh_vol_info
when: (mesh_snapshot is defined) and (mesh_snapshot | length > 0)
- name: Set mesh_vol from info of vol created from snapshot
ansible.builtin.set_fact:
mesh_vol: "{{ mesh_vol_info.volume_id }}"
new_meshvol_from_snap: true
when: (mesh_snapshot is defined) and (mesh_snapshot | length > 0)
# if we still dont have mesh_vol, create new/empty one
- name: Create new/empty mesh volume
amazon.aws.ec2_vol:
region: "{{ ansible_ec2_placement_region }}"
instance: "{{ ansible_ec2_instance_id }}"
volume_size: "{{ atl_mesh_volume_size }}"
volume_type: gp3
throughput: 250
iops: 3072
device_name: /dev/xvdd
tags:
service_name: "{{ atl_aws_stack_name }}"
Name: "{{ atl_aws_stack_name }} mesh volume {{ ansible_ec2_placement_availability_zone }}"
volume_type: "mesh"
register: mesh_vol_info
when: (mesh_snapshot is not defined) or (mesh_snapshot | length == 0)
- name: Set mesh_vol from info of created volume
ansible.builtin.set_fact:
mesh_vol: "{{ mesh_vol_info.volume_id }}"
when: (mesh_snapshot is not defined) or (mesh_snapshot | length == 0)
- name: Log mesh_vol
ansible.builtin.debug:
var: mesh_vol