Merge "Fix molecule job"

This commit is contained in:
Zuul 2021-10-21 14:15:18 +00:00 committed by Gerrit Code Review
commit 0b8d481254
4 changed files with 107 additions and 2 deletions

View File

@ -438,6 +438,11 @@ collect_log_types:
- openstack - openstack
- container - container
# This set sova to use the specified json file instead of downloading from
# internet. Right now it is used by molecule, only set this if you do not want
# to use the official sova-config file.
# sova_config_file: "/path/to/sova/json/file
# InfluxDB module settings # InfluxDB module settings
influxdb_only_successful_tasks: true influxdb_only_successful_tasks: true
influxdb_measurement: test influxdb_measurement: test

View File

@ -3,6 +3,8 @@
hosts: all hosts: all
tasks: tasks:
- name: Include collect_logs - name: Include collect_logs
vars:
sova_config_file: "{{ ansible_user_dir }}/workspace/logs/sova_config.json"
include_role: include_role:
name: collect_logs name: collect_logs
tasks_from: sova.yml tasks_from: sova.yml

View File

@ -15,3 +15,91 @@
No valid host was found. There are not enough hosts No valid host was found. There are not enough hosts
dest: '{{ ansible_user_dir }}/workspace/logs/quickstart_install.log' dest: '{{ ansible_user_dir }}/workspace/logs/quickstart_install.log'
mode: 0644 mode: 0644
- name: Create a sample sova config file
copy:
content: |
{
"patterns": {
"bmc": [
{
"id": "Introspection_failed_cannot_get_IP_address",
"logstash": "",
"msg": "Introspection failed, cannot get IP address",
"pattern": "Introspection_failed_cannot_get_IP_address",
"tag": "infra"
}
],
"console": [
{
"id": "Not_enough_hosts",
"logstash": "",
"msg": "No valid host was found.",
"pattern": "Not_enough_hosts",
"tag": "info"
}
],
"errors": [
{
"id": "Buildah_pull_image_failed",
"logstash": "",
"msg": "Buildah pull image failed",
"pattern": "Buildah_pull_image_failed",
"tag": "info"
}
],
"ironic-conductor": [
{
"id": "Ironic_deployment_timeout",
"logstash": "",
"msg": "Ironic deployment timeout.",
"pattern": "Ironic_deployment_timeout",
"tag": "info"
}
],
"logstash": [
{
"id": "Ping_timeout_when_deploying_OC",
"logstash": "",
"msg": "Ping timeout when deploying OC.",
"pattern": "Ping_timeout_when_deploying_OC",
"tag": "infra"
}
],
"registry_log": [
{
"id": "Invalid_checksum_format",
"logstash": "",
"msg": "Invalid checksum format.",
"pattern": "Invalid_checksum_format",
"tag": "infra"
}
],
"selinux": [
{
"id": "selinux_denials_found",
"logstash": "",
"msg": "selinux denials found",
"pattern": "selinux_denials_found",
"tag": "code"
}
],
"syslog": [
{
"id": "service_FAIL",
"logstash": "",
"msg": "service FAIL",
"pattern": "service_FAIL",
"tag": "command_exe"
}
]
},
"regexes": [
{
"name": "Not_enough_hosts",
"regex": "No\\ valid\\ host\\ was\\ found\\.\\ There\\ are\\ not\\ enough\\ hosts"
}
]
}
dest: '{{ ansible_user_dir }}/workspace/logs/sova_config.json'
mode: 0644

View File

@ -9,10 +9,20 @@
retries: 3 # to avoid accidental failures due to networking or rate limiting retries: 3 # to avoid accidental failures due to networking or rate limiting
delay: 60 delay: 60
register: pattern_config register: pattern_config
when: sova_config_file is not defined
- name: Load sova patterns from local file
command: cat "{{ sova_config_file }}"
register: sova_config_file_output
when: sova_config_file is defined
- name: Set sova_config json content
set_fact:
sova_config: "{{ (sova_config_file is defined) | ternary((sova_config_file_output.stdout | from_json), pattern_config.json) }}"
- name: Run sova task - name: Run sova task
sova: sova:
config: "{{ pattern_config.json }}" config: "{{ sova_config }}"
files: files:
console: "{{ ansible_user_dir }}/workspace/logs/quickstart_install.log" console: "{{ ansible_user_dir }}/workspace/logs/quickstart_install.log"
errors: "/var/log/errors.txt" errors: "/var/log/errors.txt"
@ -25,7 +35,7 @@
- name: Run sova task (denials) - name: Run sova task (denials)
sova: sova:
config: "{{ pattern_config.json }}" config: "{{ sova_config }}"
files: files:
selinux: "/var/log/extra/denials.txt" selinux: "/var/log/extra/denials.txt"
result: "{{ ansible_user_dir }}/workspace/logs/selinux_denials.log" result: "{{ ansible_user_dir }}/workspace/logs/selinux_denials.log"