Переглянути джерело

Initial commit to add all files

tags/v0.9.0
Niels Abspoel 10 роки тому
джерело
коміт
38808d6221
9 змінених файлів з 207 додано та 0 видалено
  1. +14
    -0
      LICENSE
  2. +23
    -0
      README.rst
  3. +29
    -0
      logrotate/config.sls
  4. +38
    -0
      logrotate/files/Arch/logrotate.conf
  5. +32
    -0
      logrotate/files/Debian/logrotate.conf
  6. +35
    -0
      logrotate/files/RedHat/logrotate.conf
  7. +9
    -0
      logrotate/init.sls
  8. +26
    -0
      logrotate/map.jinja
  9. +1
    -0
      pillar.example

+ 14
- 0
LICENSE Переглянути файл

@@ -0,0 +1,14 @@
Copyright (c) 2013-2014 Salt Stack Formulas

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.


+ 23
- 0
README.rst Переглянути файл

@@ -0,0 +1,23 @@
logrotate
=========
Install and configure logrotate on a machine.

.. note::
See the full `Salt Formulas installation and usage instructions
<http://docs.saltstack.com/en/latest/topics/development/conventions/formulas.html>`_.

Available states
================

.. contents::
:local:

``logrotate``
-------------

Installs the ``logrotate`` package and service/timer/cron.

``logrotate.config``
--------------------

Manages logrotate config and include dir.

+ 29
- 0
logrotate/config.sls Переглянути файл

@@ -0,0 +1,29 @@
{% from "logrotate/map.jinja" import logrotate with context %}

include:
- logrotate

logrotate_directory:
file.directory:
- name: {{ logrotate.include_dir }}
- user: {{ salt['pillar.get']('logrotate:config:user', logrotate.user) }}
- group: {{ salt['pillar.get']('logrotate:config:group', logrotate.group) }}
- mode: 755
- makedirs: True
- require:
- pkg: logrotate

logrotate_config:
file.managed:
- name: {{ logrotate.conf_file }}
- source: salt://logrotate/files/{{ salt['grains.get']('os_family') }}/logrotate.conf
- template: jinja
- user: {{ salt['pillar.get']('logrotate:config:user', logrotate.user) }}
- group: {{ salt['pillar.get']('logrotate:config:group', logrotate.group) }}
- mode: {{ salt['pillar.get']('logrotate:config:mode', '644') }}
- require:
- pkg: logrotate
- watch_in:
- service: {{ logrotate.service }}



+ 38
- 0
logrotate/files/Arch/logrotate.conf Переглянути файл

@@ -0,0 +1,38 @@
# see "man logrotate" for details
# rotate log files weekly
weekly

# keep 4 weeks worth of backlogs
rotate 4

# restrict maximum size of log files
#size 20M

# create new (empty) log files after rotating old ones
create

# uncomment this if you want your log files compressed
#compress

# Logs are moved into directory for rotation
# olddir /var/log/archive

# Ignore pacman saved files
tabooext + .pacorig .pacnew .pacsave

# Arch packages drop log rotation information into this directory
include /etc/logrotate.d

/var/log/wtmp {
monthly
create 0664 root utmp
minsize 1M
rotate 1
}

/var/log/btmp {
missingok
monthly
create 0600 root utmp
rotate 1
}

+ 32
- 0
logrotate/files/Debian/logrotate.conf Переглянути файл

@@ -0,0 +1,32 @@
# see "man logrotate" for details
# rotate log files weekly
weekly

# keep 4 weeks worth of backlogs
rotate 4

# create new (empty) log files after rotating old ones
create

# uncomment this if you want your log files compressed
#compress

# packages drop log rotation information into this directory
include /etc/logrotate.d

# no packages own wtmp, or btmp -- we'll rotate them here
/var/log/wtmp {
missingok
monthly
create 0664 root utmp
rotate 1
}

/var/log/btmp {
missingok
monthly
create 0660 root utmp
rotate 1
}

# system-specific logs may be configured here

+ 35
- 0
logrotate/files/RedHat/logrotate.conf Переглянути файл

@@ -0,0 +1,35 @@
# see "man logrotate" for details
# rotate log files weekly
weekly

# keep 4 weeks worth of backlogs
rotate 4

# create new (empty) log files after rotating old ones
create

# use date as a suffix of the rotated file
dateext

# uncomment this if you want your log files compressed
#compress

# RPM packages drop log rotation information into this directory
include /etc/logrotate.d

# no packages own wtmp and btmp -- we'll rotate them here
/var/log/wtmp {
monthly
create 0664 root utmp
minsize 1M
rotate 1
}

/var/log/btmp {
missingok
monthly
create 0600 root utmp
rotate 1
}

# system-specific logs may be also be configured here.

+ 9
- 0
logrotate/init.sls Переглянути файл

@@ -0,0 +1,9 @@
{% from "logrotate/map.jinja" import logrotate with context %}

logrotate:
pkg.installed:
- name: {{ logrotate.pkg|json }}
service.running:
- name: {{ logrotate.service }}
- enable: True
- reload: True

+ 26
- 0
logrotate/map.jinja Переглянути файл

@@ -0,0 +1,26 @@
{% set logrotate = salt['grains.filter_by']({
'RedHat': {
'pkg' : 'logrotate',
'service' : 'crond',
'conf_file' : '/etc/logrotate.conf',
'include_dir' : '/etc/logrotate.d',
'user' : 'root',
'group' : 'root',
},
'Arch': {
'pkg' : 'logrotate',
'service' : 'logrotate.timer',
'conf_file' : '/etc/logrotate.conf',
'include_dir' : '/etc/logrotate.d',
'user' : 'root',
'group' : 'root',
},
'Debian': {
'pkg' : 'logrotate',
'service' : 'crond',
'conf_file' : '/etc/logrotate.conf',
'include_dir' : '/etc/logrotate.d',
'user' : 'root',
'group' : 'root',
},
}, merge=salt['pillar.get']('logrotate:lookup')) %}

+ 1
- 0
pillar.example Переглянути файл

@@ -0,0 +1 @@
none at the moment

Завантаження…
Відмінити
Зберегти