Testing
---
- name: Determine environment type
ansible.builtin.set_fact:
is_develop: "{{ (AAP_Env | default('') | lower) == 'develop' }}"
- name: Run Demo Job To Test Job Execution in DMZ
ansible.builtin.ping:
# no_log: false ← usually not needed unless debugging logging
register: result
ignore_errors: true
when: not is_develop
- name: Set fact - successful ping
ansible.builtin.set_fact:
ping_result: true
when:
- not is_develop
- result is success
- name: Set fact - unsuccessful ping
ansible.builtin.set_fact:
ping_result: false
when:
- not is_develop
- result is unreachable # or: result is failed (depending on what you consider "bad")
- name: Set artifact - actual execution happened
ansible.builtin.set_stats:
data:
demo_job_output: "{{ ping_result }}"
when: not is_develop
ignore_errors: true
- name: Set artifact - develop environment (skipped)
ansible.builtin.set_stats:
data:
demo_job_output: "Skipped — running in develop environment (AAP_Env = develop)"
when: is_develop
ignore_errors: true
Comments
Post a Comment