68 lines
2.1 KiB
YAML
68 lines
2.1 KiB
YAML
---
|
|
- name: Set oc_container_cli and container_name for the Controller
|
|
set_fact:
|
|
oc_container_cli: "{{ hostvars[inventory_hostname].container_cli | default('podman', true) }}"
|
|
container_name: "neutron_api"
|
|
when: "'Controller' in group_names"
|
|
|
|
- when: "'Undercloud' in group_names"
|
|
block:
|
|
- name: Get the path of tripleo undercloud config file
|
|
become: true
|
|
hiera:
|
|
name: "tripleo_undercloud_conf_file"
|
|
|
|
- name: Get the Container CLI from the undercloud.conf file
|
|
become: true
|
|
validations_read_ini:
|
|
path: "{{ tripleo_undercloud_conf_file }}"
|
|
section: DEFAULT
|
|
key: container_cli
|
|
ignore_missing_file: true
|
|
register: container_cli
|
|
|
|
- name: Set uc_container_cli and container_name for the Undercloud
|
|
set_fact:
|
|
uc_container_cli: "{{ container_cli.value|default('podman', true) }}"
|
|
container_name: "neutron_ovs_agent"
|
|
|
|
- name: Run neutron-sanity-check
|
|
command: >
|
|
{% if oc_container_cli is defined %}{{ oc_container_cli }}{% else %}{{ uc_container_cli }}{% endif %}
|
|
exec -u root {{ container_name }}
|
|
/bin/bash -c 'neutron-sanity-check --config-file {{ item }}'
|
|
with_items: "{{ configs }}"
|
|
become: true
|
|
register: nsc_return
|
|
ignore_errors: true
|
|
changed_when: false
|
|
|
|
- name: Detect errors
|
|
set_fact:
|
|
has_errors: "{{ nsc_return.results
|
|
| sum(attribute='stderr_lines', start=[])
|
|
| select('search', '(ERROR)')
|
|
| list | length | int > 0 }}"
|
|
|
|
- name: Detect warnings
|
|
set_fact:
|
|
has_warnings: "{{ nsc_return.results
|
|
| sum(attribute='stderr_lines', start=[])
|
|
| select('search', '(WARNING)')
|
|
| list | length | int > 0 }}"
|
|
|
|
- name: Create output
|
|
set_fact:
|
|
output_msg: "{{ nsc_return.results
|
|
| sum(attribute='stderr_lines', start=[])
|
|
| select('search', '(ERROR|WARNING)')
|
|
| list }}"
|
|
|
|
- name: Output warning
|
|
warn: msg="{{ output_msg | join('\n') }}"
|
|
when: has_warnings and not has_errors
|
|
|
|
- name: Fail
|
|
fail: msg="{{ output_msg | join('\n') }}"
|
|
when: has_errors
|