mirror of
https://bitbucket.org/atlassian/dc-deployments-automation.git
synced 2025-12-14 08:53:07 -06:00
96 lines
3.4 KiB
YAML
96 lines
3.4 KiB
YAML
---
|
|
|
|
# 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
|
|
ansible.builtin.import_tasks:
|
|
file: bitbucket_api_setup.yml
|
|
|
|
- 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
|
|
ansible.builtin.set_fact:
|
|
mesh_clone: "{{ (atl_mesh_snapshot_az1 | length > 0) | 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
|
|
ansible.builtin.import_tasks:
|
|
file: meshvol_check.yml
|
|
|
|
# create/set mesh_vol if still needed
|
|
- name: Create/set mesh_vol if still needed
|
|
ansible.builtin.import_tasks:
|
|
file: meshvol_create.yml
|
|
when:
|
|
- (mesh_vol is not defined) or (mesh_vol | length == 0)
|
|
|
|
# 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
|
|
ansible.builtin.import_tasks:
|
|
file: meshvols_setup.yml
|
|
when:
|
|
- atl_product_home not in mounts_list
|
|
- "'/dev/xvdd' not in devices_list"
|
|
|
|
# Setup Mesh product
|
|
- name: Setup mesh product and related pieces
|
|
ansible.builtin.import_tasks:
|
|
file: mesh_setup.yml
|
|
|
|
# get tag info of 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_info
|
|
tags: notest # doesn't work in molecule
|
|
|
|
- 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_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 mesh volume was re-hydrated from snapshot
|
|
ansible.builtin.lineinfile:
|
|
path: "{{ mesh_properties_file }}"
|
|
regexp: '^node\.id.+$'
|
|
state: absent
|
|
when:
|
|
- new_meshvol_from_snap is defined
|
|
- new_meshvol_from_snap | bool
|
|
|
|
# handle adding/updating some ansible managed mesh properties
|
|
- name: Import management of additional ansible-managed mesh properties
|
|
ansible.builtin.import_tasks:
|
|
file: mesh_properties.yml
|
|
when:
|
|
- atl_mesh_properties is defined
|
|
- atl_mesh_properties | length > 0
|
|
|
|
# handle reregistering the correct node if node.id exists
|
|
- 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 }}') }}"
|
|
ignore_errors: yes
|
|
|
|
# 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
|
|
ansible.builtin.import_tasks:
|
|
file: mesh_newpet.yml
|
|
when: (mesh_node_name is not defined) or (mesh_node_name | length == 0) or (mesh_node_id is not defined) or (mesh_node_id | length == 0)
|
|
|
|
# bundle all the node_name related updates together
|
|
- name: Process mesh_node_name related tasks
|
|
ansible.builtin.import_tasks:
|
|
file: mesh_node_name.yml
|
|
|
|
# handle functionality relating to starting and registering the mesh service
|
|
- name: Mesh service related processing
|
|
ansible.builtin.import_tasks:
|
|
file: mesh_service.yml
|