Files
hla_framework_bd/ansible/tasks/utils/get-ioc-port.yml
T

19 lines
848 B
YAML

---
- name: Read the service registry file
ansible.builtin.slurp:
src: "{{ workspace_dir }}/config/services_registry.yml"
register: remote_registry_file
- name: Parse the service registry YAML content into a fact
ansible.builtin.set_fact:
services_registry: "{{ remote_registry_file.content | b64decode | from_yaml }}"
- name: Extract the port from the services registry and save it as a persistent fact
ansible.builtin.set_fact:
ioc_port: "{{ services_registry.services | selectattr('name', 'equalto', target_service_name_lower) | map(attribute='ioc_port') | first | default(none) }}"
- name: Fail if the service or port wasn't found in the registry
ansible.builtin.fail:
msg: "Service '{{ target_service_name_lower }}' not found in services registry or port not set"
when: ioc_port | trim == "" or ioc_port is none