try deferring all startup and registration tasks to handlers; skip if atl_startup_restart is false to match other products

This commit is contained in:
Lee Goolsbee
2024-04-04 11:08:18 -05:00
parent 9668c34b9d
commit b4b05f49f5
3 changed files with 34 additions and 40 deletions

View File

@@ -1,6 +1,13 @@
---
# Handlers are executed in the order they are defined in the handlers section, not in the order listed in the notify statement.
- name: Wait for Mesh to become available
ansible.builtin.wait_for:
port: "{{ mesh_node_port }}"
timeout: 300
delegate_to: localhost
become: false
- name: Register New Mesh Node
ansible.builtin.uri:
url: '{{ atl_proxy_name }}/rest/api/latest/admin/git/mesh/nodes'
@@ -14,8 +21,6 @@
body:
name: "{{ mesh_node_name }}"
rpcUrl: "{{ mesh_node_scheme }}://{{ mesh_node_name }}.{{ atl_aws_stack_name }}-{{ ansible_ec2_placement_region }}.{{ atl_hostedzone }}:{{ mesh_node_port }}"
changed_when: register_mesh_node_result.status == 200
notify: Stop Product
register: register_mesh_node_result
until: register_mesh_node_result is not failed
retries: 5
@@ -43,15 +48,6 @@
delay: 30
no_log: True
- name: Stop Product
ansible.builtin.service:
name: "{{ atl_systemd_service_name }}"
state: stopped
when:
- not atl_startup_restart | bool
- molecule_yml is not defined
no_log: true
- name: Remove orphan_vol lease lock
ansible.builtin.file:
path: '{{ atl_shared_mountpoint }}/.{{ orphan_vol }}'