validations-common/roles/validations/tasks/run.yaml

30 lines
1.0 KiB
YAML

---
- name: Run validations
block:
- name: Set fact for extra args.
set_fact:
execution_extra_args: "{{ name.value.negative_results.extra_args }}"
when:
- "'negative_results' in name.value "
- negative | default(False) | bool
- name: Execute Validations {{ name.key }}
ignore_errors: true
register: run_results
shell:
cmd: >-
{{ validation_command }} run --validation {{ name.key }}
{{ validation_dir }} {{ ansible_dir }}
--inventory {{ inventory }}
--output-log validation_{{ name.key }}_positive.log
{{ execution_extra_args | default(name.value.extra_args) }}
{{ name.value.extra_env_args }}
executable: /bin/bash
when: (negative | default(False) | bool and 'negative_results' in name.value) or
(not negative | default(False) | bool)
- name: set fact for run_results
ignore_errors: true
set_fact: result_failed=true
when: run_results.rc != expected_rc