Normalize how we run validations

This change normalizes how we execute validations by ensuring all validations calls are
running via a shell command and sourcing the `stackrc` file; this is due to validations
not being completely compatible with the OSC clouds config. All validations will now
run when the `run_validations` is set to true. This ensures that the playbook will only
execute validations when instructed to.

Change-Id: Ie1b0c739dc08023a1bba7a98292a8c570b8a2a9c
Signed-off-by: Kevin Carter <kecarter@redhat.com>
This commit is contained in:
Kevin Carter 2020-03-24 15:15:56 -05:00 committed by Kevin Carter (cloudnull)
parent 1fa6fe819d
commit 3cee97deee
6 changed files with 51 additions and 28 deletions

View File

@ -21,7 +21,6 @@
gather_facts: "{{ (tripleo_target_host is defined) | ternary(true, false) }}"
any_errors_fatal: true
vars:
run_validations: false
concurrency: 20
max_retries: 2
node_timeout: 1200

View File

@ -21,7 +21,6 @@
gather_facts: "{{ (tripleo_target_host is defined) | ternary(true, false) }}"
any_errors_fatal: true
vars:
run_validations: false
concurrency: 20
max_retries: 2
node_timeout: 1200

View File

@ -34,13 +34,6 @@
- node_uuids is undefined
tasks:
# Pre-cleaning validation
- name: Run Validations
command: >-
openstack --os-cloud undercloud tripleo validator run --group "pre-clean"
when:
- run_validations | bool
- name: Set node_uuids_clean fact
set_fact:
node_uuids_clean: "{{ node_uuids }}"

View File

@ -57,11 +57,33 @@
}}"
# Pre-introspection validation
- name: Run Validations
command: >
openstack tripleo validator run --group "pre-introspection"
- name: Validations block
when:
- run_validations | bool
block:
- name: Check if validation enabled
set_fact:
validations_enabled: "{{ lookup('hiera', 'tripleo_validations_enabled') }}"
run_once: true
become: true
# Pre-introspection validation
# NOTE(cloudnull): The stackrc file is sourced because validations are not
# 100% compatible with clouds.yaml at this time.
- name: Run Validations
shell: |-
source "{{ ansible_home }}/stackrc"
openstack --os-cloud undercloud tripleo validator run --group "pre-introspection"
when:
- validations_enabled | bool
- name: Fail if validations are disabled
fail:
msg: >-
Run validations were enabled but via hiera information disabled.
Check the configuration and try again.
when:
- not (validations_enabled | bool)
# Introspect nodes
- name: Start baremetal introspection

View File

@ -21,7 +21,6 @@
gather_facts: "{{ (tripleo_target_host is defined) | ternary(true, false) }}"
any_errors_fatal: true
vars:
run_validations: false
concurrency: 20
max_retries: 2
node_timeout: 1200

View File

@ -35,22 +35,33 @@
- (tripleo_target_host is defined) | ternary('ssh', 'local') == 'local'
tasks:
- name: Check if validation enabled
command: >
hiera tripleo_validations_enabled
register: validations_enabled
become: true
- name: Run Validations
# 1. tripleo-validations does not work with clouds.yaml
# 2. Ignore errors as certain validations in 'pre-deployment'
# group i.e tls-everywhere-pre-deployment.yaml would fail.
shell: |
source "{{ ansible_home }}/stackrc"
openstack tripleo validator run --group "pre-deployment"
- name: Validations block
when:
- validations_enabled.stdout | bool
ignore_errors: true
- run_validations | bool
block:
- name: Check if validation enabled
set_fact:
validations_enabled: "{{ lookup('hiera', 'tripleo_validations_enabled') }}"
run_once: true
become: true
# Pre-deployment validation
# NOTE(cloudnull): The stackrc file is sourced because validations are not
# 100% compatible with clouds.yaml at this time.
- name: Run Validations
shell: |-
source "{{ ansible_home }}/stackrc"
openstack --os-cloud undercloud tripleo validator run --group "pre-deployment"
when:
- validations_enabled | bool
- name: Fail if validations are disabled
fail:
msg: >-
Run validations were enabled but via hiera information disabled.
Check the configuration and try again.
when:
- not (validations_enabled | bool)
- name: Prepare Container images and update plan
tripleo_image_params_prepare: