Files
dc-deployments-automation/roles/bitbucket_mesh_config/tasks/main.yml
Lee Goolsbee 47589f03a9 bug fixes
2024-03-27 14:46:01 -05:00

101 lines
3.6 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
- 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) }}"
# 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
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
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: 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
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
ansible.builtin.import_tasks:
file: mesh_service.yml