mirror of
https://bitbucket.org/atlassian/dc-deployments-automation.git
synced 2025-12-14 08:53:07 -06:00
task name, comments, and other general formatting updates
This commit is contained in:
@@ -19,7 +19,7 @@
|
||||
- molecule_yml is not defined
|
||||
no_log: true
|
||||
|
||||
- name: register_mesh_node
|
||||
- name: Register Mesh Node
|
||||
ansible.builtin.uri:
|
||||
url: '{{ atl_proxy_name }}/rest/api/latest/admin/git/mesh/nodes'
|
||||
method: POST
|
||||
@@ -38,7 +38,7 @@
|
||||
delay: 30
|
||||
no_log: True
|
||||
|
||||
- name: update_mesh_node
|
||||
- name: Update Mesh Node
|
||||
ansible.builtin.uri:
|
||||
url: '{{ atl_proxy_name }}/rest/api/latest/admin/git/mesh/nodes/{{ mesh_node_id }}'
|
||||
method: PUT
|
||||
@@ -59,7 +59,7 @@
|
||||
delay: 30
|
||||
no_log: True
|
||||
|
||||
- name: Remove orphan_vol lease_lock
|
||||
- name: Remove orphan_vol lease lock
|
||||
ansible.builtin.file:
|
||||
path: '{{ atl_shared_mountpoint }}/.{{ orphan_vol }}'
|
||||
state: absent
|
||||
|
||||
@@ -1,27 +1,27 @@
|
||||
# handle setting up to call the bitbucket api
|
||||
|
||||
- name: retrieve cloudformation facts
|
||||
- name: Retrieve cloudformation facts
|
||||
amazon.aws.cloudformation_info:
|
||||
stack_name: '{{ atl_aws_stack_id }}'
|
||||
region: '{{ ansible_ec2_placement_region }}'
|
||||
stack_resources: yes
|
||||
register: cfn_stack_facts
|
||||
|
||||
- name: set fact for the MeshRegistrationCredentialsSecret
|
||||
- name: Set fact for the MeshRegistrationCredentialsSecret
|
||||
ansible.builtin.set_fact:
|
||||
mesh_registration_credential_secret: "{{ cfn_stack_facts.cloudformation[atl_aws_stack_name].stack_resources.MeshRegistrationCredentialsSecret }}"
|
||||
# NOTE: we decided we want to barf early if the secret doesnt exist as ll the rest of this is somewhat useless if we cant register nodes
|
||||
# when:
|
||||
# - cfn_stack_facts.cloudformation[stack_name].stack_resources.MeshRegistrationCredentialsSecret is defined
|
||||
|
||||
- name: get the mesh registration username
|
||||
- name: Retrieve the mesh registration username
|
||||
ansible.builtin.set_fact:
|
||||
mesh_registration_username: "{{ lookup('amazon.aws.secretsmanager_secret', secretpath, region=ansible_ec2_placement_region, bypath=false, nested=true) }}"
|
||||
ignore_errors: no
|
||||
vars:
|
||||
secretpath: "{{ mesh_registration_credential_secret }}.username"
|
||||
|
||||
- name: get the mesh registration password
|
||||
- name: Retrieve the mesh registration password
|
||||
ansible.builtin.set_fact:
|
||||
mesh_registration_password: "{{ lookup('amazon.aws.secretsmanager_secret', secretpath, region=ansible_ec2_placement_region, bypath=false, nested=true) }}"
|
||||
ignore_errors: no
|
||||
@@ -29,7 +29,7 @@
|
||||
secretpath: "{{ mesh_registration_credential_secret }}.password"
|
||||
no_log: True
|
||||
|
||||
- name: generate the basic auth string
|
||||
- name: Generate the basic auth string
|
||||
ansible.builtin.set_fact:
|
||||
mesh_basic_auth: "{{ auth_string | b64encode }}"
|
||||
vars:
|
||||
|
||||
@@ -10,25 +10,25 @@
|
||||
|
||||
# assume bbdc secret exists (else fail) - setup stuff for calling bitbucket rest api and get mesh node report
|
||||
# get the registered mesh node info as we need it for determining nodenames
|
||||
- name: Import bitbucket api setup pieces and do initial mesh node_report
|
||||
- name: Import Bitbucket API setup pieces
|
||||
ansible.builtin.import_tasks:
|
||||
file: bitbucket_api_setup.yml
|
||||
|
||||
- name: import/run mesh_node_report
|
||||
- name: Import and run mesh_node_report
|
||||
ansible.builtin.import_tasks:
|
||||
file: mesh_node_report.yml
|
||||
|
||||
- name: set fact if this stack is a mesh clone
|
||||
- name: Set fact if this stack is a mesh clone
|
||||
ansible.builtin.set_fact:
|
||||
mesh_clone: "{{ (atl_mesh_snapshot_az1 is defined) | ternary(true, false) }}"
|
||||
|
||||
# workout if there is a valid mesh_vol, either mounted or abandoned, set mesh_vol or mesh_snap
|
||||
- name: check for valid mesh_vol
|
||||
- name: Check for valid mesh_vol
|
||||
ansible.builtin.import_tasks:
|
||||
file: meshvol_check.yml
|
||||
|
||||
# create/set mesh_vol if still needed
|
||||
- name: create/set mesh_vol if still needed
|
||||
- name: Create/set mesh_vol if still needed
|
||||
ansible.builtin.import_tasks:
|
||||
file: meshvol_create.yml
|
||||
when:
|
||||
@@ -36,7 +36,7 @@
|
||||
|
||||
# ensure logs and cache have fs and are mounted
|
||||
# action this block when mesh volume is not in mount list
|
||||
- name: setup and mount mesh releated filesystems
|
||||
- name: Setup and mount mesh releated filesystems
|
||||
ansible.builtin.import_tasks:
|
||||
file: meshvols_setup.yml
|
||||
when:
|
||||
@@ -44,26 +44,26 @@
|
||||
- "'/dev/xvdd' not in devices_list"
|
||||
|
||||
# Setup Mesh product
|
||||
- name: setup mesh product and related pieces
|
||||
- name: Setup mesh product and related pieces
|
||||
ansible.builtin.import_tasks:
|
||||
file: mesh_setup.yml
|
||||
|
||||
# get tag info of mesh_vol
|
||||
- name: get info of attached mesh_vol
|
||||
- name: Retrieve info of attached mesh_vol
|
||||
amazon.aws.ec2_vol_info:
|
||||
region: "{{ ansible_ec2_placement_region }}"
|
||||
filters:
|
||||
volume-id: "{{ mesh_vol }}"
|
||||
register: mesh_vol_tag_info
|
||||
register: mesh_vol_info
|
||||
tags: notest # doesn't work in molecule
|
||||
|
||||
- name: set mesh_node_name_tag var from the mesh_node_name tag of .mesh_vol
|
||||
- name: Set mesh_node_name_tag var from the mesh_node_name tag of mesh_vol
|
||||
ansible.builtin.set_fact:
|
||||
mesh_node_name: "{{ mesh_vol_tag_info.volumes[0].tags['mesh_node_name'] }}"
|
||||
mesh_node_name: "{{ mesh_vol_info.volumes[0].tags['mesh_node_name'] }}"
|
||||
ignore_errors: yes
|
||||
|
||||
# workout if we are a clone_firstrun
|
||||
- name: remove node_id from mesh.properties if new_meshvol_from_snap
|
||||
- name: Remove node.id from mesh.properties if mesh volume was re-hydrated from snapshot
|
||||
ansible.builtin.lineinfile:
|
||||
path: "{{ mesh_properties_file }}"
|
||||
regexp: '^node\.id.+$'
|
||||
@@ -72,41 +72,41 @@
|
||||
- new_meshvol_from_snap is defined
|
||||
- new_meshvol_from_snap | bool
|
||||
|
||||
- name: set mesh_node_id var from the existing mesh.properties file
|
||||
- name: Set mesh_node_id var from the existing mesh.properties file
|
||||
ansible.builtin.set_fact:
|
||||
mesh_node_id: "{{ lookup('ansible.builtin.ini', 'node.id type=properties file={{ mesh_properties_file }}', errors='ignore' )| default('absent', true) }}"
|
||||
mesh_node_id: "{{ lookup('ansible.builtin.ini', 'node.id type=properties file={{ mesh_properties_file }}', errors='ignore') | default('absent', true) }}"
|
||||
|
||||
- name: set string to test mesh_clone_firstrun (node_name contains meshnode_{{ mesh_node_id }}")
|
||||
- name: Set string to test mesh_clone_firstrun (node_name contains meshnode_{{ mesh_node_id }}")
|
||||
ansible.builtin.set_fact:
|
||||
mesh_clone_teststring: "meshnode_{{ mesh_node_id }}"
|
||||
|
||||
# workout if this is mesh_clone_firstrun - either no mounted volume or teststring found in mesh_nodes_report
|
||||
- name: work out if this is firstrun of a mesh_clone
|
||||
# workout if this is mesh_clone_firstrun
|
||||
- name: Work out if this is first_run of a mesh_clone
|
||||
ansible.builtin.set_fact:
|
||||
mesh_clone_firstrun: false
|
||||
|
||||
- name: set firstrun true if mesh_node_id is absent
|
||||
- name: Set firstrun true if mesh_node_id is absent
|
||||
ansible.builtin.set_fact:
|
||||
mesh_clone_firstrun: true
|
||||
when: mesh_node_id == 'absent'
|
||||
|
||||
# if meshvol has no petname or this is the first run of a clone, create a new petname, tag the vol and set mesh_node_name
|
||||
- name: new petname related processing
|
||||
- name: New petname related processing
|
||||
ansible.builtin.import_tasks:
|
||||
file: mesh_newpet.yml
|
||||
when: (mesh_node_name is not defined) or (mesh_node_name | length == 0) or mesh_clone_firstrun
|
||||
|
||||
# bundle all the node_name releated updates together
|
||||
- name: mesh_node_name related processing
|
||||
- name: Process mesh_node_name related tasks
|
||||
ansible.builtin.import_tasks:
|
||||
file: mesh_node_name.yml
|
||||
|
||||
# handle reregistering the correct node if node.id exists
|
||||
- name: set mesh_node_id var from the existing mesh.properties file
|
||||
- name: Set mesh_node_id var from the existing mesh.properties file
|
||||
ansible.builtin.set_fact:
|
||||
mesh_node_id: "{{ lookup('ansible.builtin.ini', 'node.id type=properties file={{ mesh_properties_file }}') | split('.') | first }}"
|
||||
|
||||
# handle functionality relating to starting and registering the mesh service
|
||||
- name: mesh service related processing
|
||||
- name: Mesh service related processing
|
||||
ansible.builtin.import_tasks:
|
||||
file: mesh_service.yml
|
||||
|
||||
@@ -3,10 +3,10 @@
|
||||
# this may need to be expanded later, but don't add node.id unless you get it from bitbucket primary cluster
|
||||
# first see if it's already set - if it is, use that, else generate a random one
|
||||
|
||||
- name: set mesh_node_name var from the existing mesh.properties file
|
||||
- name: Set mesh_node_name var from the existing mesh.properties file
|
||||
ansible.builtin.set_fact:
|
||||
mesh_node_name: "{{ lookup('ansible.builtin.ini', 'node.name type=properties file={{ mesh_properties_file }}') | split('.') | first }}"
|
||||
|
||||
- name: generate a pet name if mesh_node_name is empty or this is a clone firstrun # noqa jinja[invalid]
|
||||
- name: Generate a pet name if mesh_node_name is empty or this is a clone firstrun # noqa jinja[invalid]
|
||||
ansible.builtin.set_fact:
|
||||
mesh_node_name: "{{ lookup('community.general.random_pet', words=3) }}"
|
||||
|
||||
@@ -1,25 +1,25 @@
|
||||
---
|
||||
# update mesh.properties with the mesh_node_name from the tag in mesh_vol_info
|
||||
- name: enforce node.name per volume tag
|
||||
- name: Update mesh.properties 'node.name' with mesh_node_name value
|
||||
ansible.builtin.lineinfile:
|
||||
line: node.name={{ mesh_node_name }}
|
||||
path: "{{ mesh_properties_file }}"
|
||||
regexp: '^node\.name='
|
||||
|
||||
- name: enforce node.rpc-url per node_name
|
||||
- name: Update mesh.properties 'node.rpc-url' with mesh_node_name value
|
||||
ansible.builtin.lineinfile:
|
||||
path: "{{ mesh_properties_file }}"
|
||||
search_string: 'node.rpc-url='
|
||||
line: node.rpc-url={{ mesh_node_scheme }}://{{ mesh_node_name }}.{{ atl_aws_stack_name }}-{{ ansible_ec2_placement_region }}.{{ atl_hostedzone }}:{{ mesh_node_port }}
|
||||
|
||||
- name: enforce metrics.tags.host per volume tag
|
||||
- name: Update mesh.properties 'metrics.tags.host' with mesh_node_name value
|
||||
ansible.builtin.lineinfile:
|
||||
path: "{{ mesh_properties_file }}"
|
||||
search_string: 'metrics.tags.host='
|
||||
line: metrics.tags.host={{ mesh_node_name }}
|
||||
|
||||
# the idea here is that the pet name will persist through clones, and just the stack_name - region part of the url will change (and maybe the hosted zone)
|
||||
- name: create r53 entry for this mesh node based on the mesh_node_name
|
||||
- name: Create Route 53 entry for this mesh node based on the mesh_node_name
|
||||
amazon.aws.route53:
|
||||
command: create
|
||||
zone: "{{ atl_hostedzone }}"
|
||||
@@ -34,7 +34,7 @@
|
||||
- mesh_vol is regex('^vol-.*')
|
||||
tags: notest # doesn't work in molecule
|
||||
|
||||
- name: build a dict of tags from the ec2 instance to apply to the ebs volume
|
||||
- name: Build a dict of tags from the EC2 instance to apply to the EBS volume
|
||||
ansible.builtin.set_fact:
|
||||
ebs_tags: "{{ ebs_tags | default({}) | combine({item.key: item.value}) }}"
|
||||
when:
|
||||
@@ -42,7 +42,7 @@
|
||||
- item.key is not match("aws:.*")
|
||||
with_dict: "{{ ec2_instance_tags.tags }}"
|
||||
|
||||
- name: apply the tags from the ec2 instance to the ebs volume
|
||||
- name: Apply the tags from the EC2 instance to the EBS volume
|
||||
amazon.aws.ec2_tag:
|
||||
region: "{{ ansible_ec2_placement_region }}"
|
||||
resource: "{{ ((mesh_vol is defined) and (mesh_vol | length > 0)) | ternary(mesh_vol, mesh_vol_info.volume.id) }}"
|
||||
@@ -51,7 +51,7 @@
|
||||
purge_tags: false
|
||||
tags: notest # doesn't work in molecule
|
||||
|
||||
- name: add the mesh_node_name tag to the ebs volume and current ec2
|
||||
- name: Add the mesh_node_name tag to the EBS volume and current EC2
|
||||
amazon.aws.ec2_tag:
|
||||
region: "{{ ansible_ec2_placement_region }}"
|
||||
resource: "{{ item }}"
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
# create a report on existing mesh nodes
|
||||
|
||||
- block:
|
||||
- name: try calling the server to get a list of the mesh nodes
|
||||
- name: Try calling the server to get a list of the mesh nodes
|
||||
ansible.builtin.uri:
|
||||
url: '{{ atl_proxy_name }}/rest/api/latest/admin/git/mesh/nodes'
|
||||
method: GET
|
||||
@@ -15,31 +15,31 @@
|
||||
delay: 10
|
||||
no_log: True # http headers contain auth strings
|
||||
|
||||
- name: set bitbucket dc cluster available fact
|
||||
- name: Set Bitbucket DC cluster available fact
|
||||
ansible.builtin.set_fact:
|
||||
bitbucket_cluster_available: true
|
||||
|
||||
- name: print out the mesh_nodes_report
|
||||
- name: Print out the mesh_nodes_report
|
||||
ansible.builtin.debug:
|
||||
msg: "{{ mesh_nodes_report.json }}"
|
||||
when:
|
||||
- mesh_nodes_report.status == 200
|
||||
|
||||
- name: set mesh_nodenames_list
|
||||
- name: Set mesh_nodenames_list fact
|
||||
ansible.builtin.set_fact:
|
||||
mesh_nodenames_list: "{{ mesh_nodes_report | json_query('json[*].name') }}"
|
||||
when: mesh_nodes_report.status == 200
|
||||
|
||||
- name: print out the mesh_nodenames_list
|
||||
- name: Print out the mesh_nodenames_list
|
||||
ansible.builtin.debug:
|
||||
var: mesh_nodenames_list
|
||||
when: mesh_nodes_report.status == 200
|
||||
|
||||
rescue:
|
||||
- name: set bitbucket dc cluster available fact
|
||||
- name: Set Bitbucket DC cluster available fact
|
||||
ansible.builtin.set_fact:
|
||||
bitbucket_cluster_available: false
|
||||
|
||||
- name: log a message about bb cluster unavailable
|
||||
- name: Log a message about Bitbucket DC cluster unavailable
|
||||
ansible.builtin.debug:
|
||||
msg: "Bitbucket DC cluster not currently available."
|
||||
|
||||
@@ -16,12 +16,12 @@
|
||||
become: false
|
||||
register: mesh_service_waiter
|
||||
|
||||
- name: trigger the handler to update this existing mesh node
|
||||
- name: Trigger the handler to update this existing mesh node
|
||||
ansible.builtin.assert:
|
||||
that:
|
||||
- mesh_nodes_report.json | community.general.json_query(query) | length == 0
|
||||
changed_when: true
|
||||
notify: update_mesh_node
|
||||
notify: Update Mesh Node
|
||||
when:
|
||||
- bitbucket_cluster_available
|
||||
- mesh_nodes_report.json | community.general.json_query(query) | length == 0
|
||||
@@ -30,7 +30,7 @@
|
||||
query: "[?name=='{{ mesh_node_name }}']"
|
||||
|
||||
# if node.id doesnt exist this is new/clean mesh node and we need to register a new node
|
||||
- name: if this node is not registered, cleanup any old keys to allow registration of new
|
||||
- name: If this node is not registered, cleanup any old keys to allow registration of new
|
||||
ansible.builtin.file:
|
||||
path: "{{ atl_product_home }}/config/{{ item }}"
|
||||
state: absent
|
||||
@@ -44,12 +44,12 @@
|
||||
vars:
|
||||
query: "[?name=='{{ mesh_node_name }}']"
|
||||
|
||||
- name: trigger the handler to register this new mesh node
|
||||
- name: Trigger the handler to register this new mesh node
|
||||
ansible.builtin.assert:
|
||||
that:
|
||||
- mesh_nodes_report.json | community.general.json_query(query) | length == 0
|
||||
changed_when: true
|
||||
notify: register_mesh_node
|
||||
notify: Register Mesh Node
|
||||
when:
|
||||
- bitbucket_cluster_available
|
||||
- mesh_nodes_report.json | community.general.json_query(query) | length == 0
|
||||
|
||||
@@ -26,7 +26,7 @@
|
||||
- pem_chown.failed | bool
|
||||
- "'No such file or directory' not in pem_chown.msg"
|
||||
|
||||
- name: touch mesh.properties to make sure it exists
|
||||
- name: Touch mesh.properties to make sure it exists
|
||||
ansible.builtin.file:
|
||||
state: touch
|
||||
path: "{{ mesh_properties_file }}"
|
||||
@@ -35,7 +35,7 @@
|
||||
mode: 0600
|
||||
|
||||
# check for lines starting with '!' and prefix them with #
|
||||
- name: prefix properties files bangs with hashes
|
||||
- name: Prefix properties files bangs with hashes
|
||||
ansible.builtin.replace:
|
||||
path: "{{ mesh_properties_file }}"
|
||||
regexp: '^(\!.*)$'
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
---
|
||||
# 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
|
||||
- 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 }}"
|
||||
@@ -13,16 +13,16 @@
|
||||
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)
|
||||
when: (mesh_snapshot is defined) and (mesh_snapshot | length > 0)
|
||||
|
||||
- name: set mesh_vol from info of vol created from snapshot
|
||||
- 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)
|
||||
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
|
||||
- name: Create new/empty mesh volume
|
||||
amazon.aws.ec2_vol:
|
||||
region: "{{ ansible_ec2_placement_region }}"
|
||||
instance: "{{ ansible_ec2_instance_id }}"
|
||||
@@ -36,14 +36,13 @@
|
||||
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)
|
||||
when: (mesh_snapshot is not defined) or (mesh_snapshot | length == 0)
|
||||
|
||||
- name: set mesh_vol from info of created
|
||||
- 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)
|
||||
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
|
||||
- name: Log mesh_vol
|
||||
ansible.builtin.debug:
|
||||
var: mesh_vol
|
||||
var: mesh_vol
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
---
|
||||
# rerun the mesh volume stat now that we _really_ should have the volume
|
||||
- name: discover mesh volume device stat
|
||||
- name: Discover mesh volume device stat
|
||||
ansible.builtin.stat:
|
||||
path: '/dev/xvdd'
|
||||
follow: no
|
||||
@@ -10,11 +10,11 @@
|
||||
delay: 10
|
||||
until: mesh_device_stat.stat['lnk_source'] is defined
|
||||
|
||||
- name: describe mesh volume true device
|
||||
- name: Describe mesh volume true device
|
||||
ansible.builtin.set_fact:
|
||||
mesh_device: "{{ mesh_device_stat.stat['lnk_source'] }}"
|
||||
|
||||
- name: check mesh, caches and logs filetypes
|
||||
- name: Check mesh, caches and logs filetypes
|
||||
community.general.parted:
|
||||
device: "{{ item }}"
|
||||
with_items:
|
||||
@@ -23,20 +23,20 @@
|
||||
- "{{ mesh_device }}"
|
||||
register: filesystem_types
|
||||
|
||||
- name: set filesystem type fact for mesh volume
|
||||
- name: Set filesystem type fact for mesh volume
|
||||
ansible.builtin.set_fact:
|
||||
mesh_filesystem: "{{ filesystem_types.results | community.general.json_query(query) }}"
|
||||
vars:
|
||||
query: "[?item=='{{ mesh_device }}'].partitions[0].fstype"
|
||||
|
||||
- name: ensure mesh volume has a filesystem
|
||||
- name: Ensure mesh volume has a filesystem
|
||||
community.general.filesystem:
|
||||
dev: "{{ mesh_device }}"
|
||||
fstype: "{{ fstype }}"
|
||||
vars:
|
||||
fstype: "{{ (mesh_filesystem|length > 0) | ternary(mesh_filesystem[0], 'xfs') }}"
|
||||
fstype: "{{ (mesh_filesystem | length > 0) | ternary(mesh_filesystem[0], 'xfs') }}"
|
||||
|
||||
- name: ensure caches and logs volumes have filesystem
|
||||
- name: Ensure caches and logs volumes have filesystem
|
||||
community.general.filesystem:
|
||||
dev: "{{ item }}"
|
||||
fstype: "xfs"
|
||||
@@ -44,7 +44,7 @@
|
||||
- /dev/nvme1n1
|
||||
- /dev/nvme2n1
|
||||
|
||||
- name: mount mesh vol to atl_product_home
|
||||
- name: Mount mesh vol to atl_product_home
|
||||
ansible.posix.mount:
|
||||
path: "{{ atl_product_home }}"
|
||||
src: '/dev/xvdd'
|
||||
@@ -52,16 +52,16 @@
|
||||
state: mounted
|
||||
register: xfs_mesh_mount
|
||||
vars:
|
||||
fstype: "{{ (mesh_filesystem|length > 0) | ternary(mesh_filesystem[0], 'xfs') }}"
|
||||
fstype: "{{ (mesh_filesystem | length > 0) | ternary(mesh_filesystem[0], 'xfs') }}"
|
||||
|
||||
- name: mount cache to atl_product_home/caches
|
||||
- name: Mount cache to atl_product_home/caches
|
||||
ansible.posix.mount:
|
||||
path: "{{ atl_product_home }}/caches"
|
||||
src: '/dev/xvdb'
|
||||
fstype: xfs
|
||||
state: mounted
|
||||
|
||||
- name: mount log to atl_product_home/log
|
||||
- name: Mount log to atl_product_home/log
|
||||
ansible.posix.mount:
|
||||
path: "{{ atl_product_home }}/log"
|
||||
src: '/dev/xvdc'
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
---
|
||||
- name: try to create lease_lock directory in efs for this test_orphan_vol
|
||||
- name: Try to create lease_lock directory in EFS for this test_orphan_vol
|
||||
ansible.builtin.file:
|
||||
path: '{{ atl_shared_mountpoint }}/.{{ test_orphan_vol }}'
|
||||
state: directory
|
||||
@@ -12,9 +12,9 @@
|
||||
ansible.builtin.set_fact:
|
||||
orphan_vol: '{{ test_orphan_vol }}'
|
||||
changed_when: true
|
||||
notify: Remove orphan_vol lease_lock
|
||||
notify: Remove orphan_vol lease lock
|
||||
when:
|
||||
- orphan_vol is not defined
|
||||
- orphan_vol_lease_lock is defined
|
||||
- orphan_vol_lease_lock.changed
|
||||
tags: molecule-idempotence-notest
|
||||
tags: molecule-idempotence-notest
|
||||
|
||||
Reference in New Issue
Block a user