mirror of
https://bitbucket.org/atlassian/dc-deployments-automation.git
synced 2025-12-14 00:43:06 -06:00
122 lines
4.4 KiB
YAML
122 lines
4.4 KiB
YAML
---
|
|
|
|
# the owner/group on the unarchive above isn't thorough
|
|
- name: adjust permissions on the extracted directory
|
|
ansible.builtin.file:
|
|
state: directory
|
|
path: "/opt/atlassian/mesh/atlassian-bitbucket-mesh-{{ atl_product_version }}"
|
|
owner: "{{ atl_product_user }}"
|
|
group: "{{ atl_product_user }}"
|
|
recurse: yes
|
|
|
|
- name: touch the jmx password file
|
|
ansible.builtin.file:
|
|
path: "{{ atl_home_base }}/{{ atl_product_edition }}/jmx.access"
|
|
state: touch
|
|
owner: "{{ atl_product_user_uid }}"
|
|
group: "{{ atl_product_user_uid }}"
|
|
mode: 0600
|
|
|
|
# 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
|
|
ansible.builtin.import_tasks:
|
|
file: bitbucket_api_setup.yml
|
|
|
|
- name: import/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 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
|
|
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: get 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
|
|
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_tag_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
|
|
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) }}"
|
|
|
|
- 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
|
|
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: mesh_node_name related processing
|
|
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
|