--- # Copyright 2021 Red Hat, Inc. # All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations # under the License. - name: "Common Verify tasks" hosts: all tasks: - name: Check for files in conf output dir find: paths: "{{ collectd_conf_output_dir }}" patterns: '*.conf' register: plugins failed_when: - plugins.files | length == 0 - name: "Check for collectd.conf" stat: path: "{{ collectd_conf_output_dir }}/../collectd.conf" register: conf failed_when: - not conf.stat.exists - name: "Check what plugins were enabled." command: | ls {{ collectd_conf_output_dir }} register: plugins changed_when: false failed_when: > ( plugins.stdout_lines | length < 1 ) or ( 'logfile.conf' not in plugins.stdout_lines ) - name: "Debug -- list of plugins, one per line" debug: var: plugins.stdout_lines - name: "(Re)start collectd service" block: - name: "Kill running collectd process" command: pkill -e -c collectd ignore_errors: true - name: "Start collectd" command: /usr/sbin/collectd -C /etc/collectd.conf - name: "Get logfile path" shell: | set -o pipefail grep "File" {{ collectd_conf_output_dir }}/logfile.conf | awk '{ print $NF }' register: logfile_path changed_when: false - name: "Make sure there is a directory for the logfile to live in since collectd doesn't seem to create this by default" stat: path: "{{ logfile_path.stdout | regex_replace('\"', '') | dirname }}" register: logfile_stat failed_when: - not logfile_stat.stat.exists - name: "Make sure the logfile is created" stat: path: "{{ logfile_path.stdout | regex_replace('\"', '') }}" register: logfile_stat failed_when: - not logfile_stat.stat.exists - hosts: localhost tasks: - name: "Run the collectd test from STF functional-tests" include_role: name: functional_tests tasks_from: test_collectd vars: collectd_container_name: 'collectd-test' container_bin: "{{ lookup('env', 'CONTAINER_BIN') | default('podman', True) }}"