mirror of
https://bitbucket.org/atlassian/dc-deployments-automation.git
synced 2025-12-15 09:23:06 -06:00
first pass at incorporating mesh setup/config
This commit is contained in:
49
roles/bitbucket_mesh_config/tasks/meshvol_create.yml
Normal file
49
roles/bitbucket_mesh_config/tasks/meshvol_create.yml
Normal file
@@ -0,0 +1,49 @@
|
||||
---
|
||||
# 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: "{{ stack_name }}"
|
||||
Name: "{{ 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: final choice - create empty mesh_vol
|
||||
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: "{{ stack_name }}"
|
||||
Name: "{{ 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
|
||||
ansible.builtin.set_fact:
|
||||
mesh_vol: "{{ mesh_vol_info.volume_id }}"
|
||||
when: (mesh_snapshot is not defined) or (mesh_snapshot|length == 0)
|
||||
|
||||
# we should always have mesh_vol by now, if not, Barf !
|
||||
- name: we should always have mesh_vol by now
|
||||
ansible.builtin.debug:
|
||||
var: mesh_vol
|
||||
Reference in New Issue
Block a user