openstack-ansible/playbooks/roles/rsyslog_server/tasks/rsyslog_server_post_install.yml
Major Hayden 424377ff17 Enabling log compression by default
Most of the logs are compressed already based on configurations in
/etc/logrotate.d, but this patch ensures that the remaining logs are
compressed during the rotation process.

Closes-Bug: 1493981

Change-Id: If11c6d3a292b3621c00a8d0b775274a8096eaa66
2015-09-10 06:27:03 +00:00

62 lines
1.5 KiB
YAML

---
# Copyright 2014, 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: Stop rsyslog
service:
name: "rsyslog"
state: "stopped"
failed_when: false
tags:
- rsyslog-config
- name: Rsyslog basic setup
template:
src: "{{ item.src }}"
dest: "{{ item.dest }}"
owner: "root"
group: "root"
with_items:
- { src: "rsyslog.conf.j2", dest: "/etc/rsyslog.conf" }
- { src: "os_aggregate_storage.j2", dest: "/etc/logrotate.d/os_aggregate_storage" }
tags:
- rsyslog-config
- name: Rsyslog defaults setup
copy:
src: "{{ item.src }}"
dest: "{{ item.dest }}"
owner: "root"
group: "root"
with_items:
- { src: "50-default.conf", dest: "/etc/rsyslog.d/50-default.conf" }
tags:
- rsyslog-config
- name: Configure logrotate to compress logs by default
lineinfile:
dest: /etc/logrotate.conf
regexp: "^#compress"
line: "compress"
backrefs: yes
tags:
- rsyslog-config
- name: Start rsyslog
service:
name: "rsyslog"
state: "started"
tags:
- rsyslog-config