61 lines
2.2 KiB
YAML
61 lines
2.2 KiB
YAML
---
|
|
# Copyright 2015, Rackspace US, Inc.
|
|
#
|
|
# 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: Playbook for role testing
|
|
hosts: localhost
|
|
connection: local
|
|
become: true
|
|
roles:
|
|
- role: "rsyslog_server"
|
|
post_tasks:
|
|
- name: check rsyslog is running
|
|
shell: ps auxf | grep -v grep | grep rsyslog
|
|
changed_when: false
|
|
- name: Open rsyslog.conf
|
|
slurp:
|
|
src: "/etc/rsyslog.conf"
|
|
register: rsyslog_conf
|
|
- name: Check os_aggregate_storage exists
|
|
stat:
|
|
path: /etc/logrotate.d/os_aggregate_storage
|
|
register: os_aggregate_storage
|
|
- name: Check role functions
|
|
assert:
|
|
that:
|
|
- "'template(name=\"DDF' in (rsyslog_conf.content | b64decode)"
|
|
- "os_aggregate_storage.stat.exists"
|
|
- name: Stat rsyslog pid file
|
|
stat:
|
|
path: /var/run/{{rsyslog_pid_name}}
|
|
register: stat_rsyslog_pid
|
|
- name: Stat /etc/rsyslog.d/50-default.conf
|
|
stat:
|
|
path: /etc/rsyslog.d/50-default.conf
|
|
register: stat_50_default_conf
|
|
- name: Stat /etc/rsyslog.conf
|
|
stat:
|
|
path: /etc/rsyslog.conf
|
|
register: stat_rsyslog_conf
|
|
- name: Ensure configuration changed have been applied (rsyslog conf test)
|
|
assert:
|
|
that:
|
|
- "stat_rsyslog_pid.stat.mtime > stat_rsyslog_conf.stat.mtime"
|
|
msg: "/etc/rsyslog.conf was updated without restarting rsyslogd. Configuration changes have not been applied."
|
|
- name: Ensuring configuration changes have been applied (default conf test)
|
|
assert:
|
|
that:
|
|
- "stat_rsyslog_pid.stat.mtime > stat_50_default_conf.stat.mtime"
|
|
msg: "/etc/rsyslog.d/50-default.conf was updated without restarting rsyslogd. Configuration changes have not been applied."
|