manala.rsyslog

#######################################################################################################

:exclamation: DEPRECATION :exclamation:

This repository and its associated role are no longer in use. Please use the Manala Ansible Collection instead.

For information on how to use it, visit the collection repository.

#######################################################################################################

Ansible Role: Rsyslog Build Status

:exclamation: If you find any issues, please report them here and submit Pull Requests to the main Ansible Role repository :exclamation:

This role is responsible for setting up Rsyslog.

It is part of the Manala Ansible stack but can also be used independently.

Requirements

None.

Dependencies

None.

Installation

Ansible 2+

To install with ansible galaxy command line:

ansible-galaxy install manala.rsyslog

To install using an ansible galaxy requirements file:

- src: manala.rsyslog

Role Handlers

Name Type Description
rsyslog restart Service Restarts the rsyslog service

Role Variables

Name Default Type Description
manala_rsyslog_install_packages ~ Array Packages needed for installation
manala_rsyslog_install_packages_default ['rsyslog'] Array Default packages that will be installed
manala_rsyslog_config_template 'config/_default.j2' String Path for the main configuration template
manala_rsyslog_config ~ Array/String Configuration settings
manala_rsyslog_configs_exclusive false Array Exclusive settings for additional configs
manala_rsyslog_configs_dir '/etc/rsyslog.d' String Path for additional configuration files
manala_rsyslog_configs_defaults {} Array Default settings for additional configs
manala_rsyslog_configs [] Array Additional configuration settings

Configuration example

Content-based:

manala_rsyslog_config: |
  $FileOwner root
  $FileGroup adm
  $FileCreateMode 0640
  $DirCreateMode 0755
  $Umask 0022

Template-based:

manala_rsyslog_config_template: my/rsyslog.conf.j2

Dict's array parameters based (deprecated):

manala_rsyslog_config_template: config/default.prod.j2
manala_rsyslog_config:
  - $ModLoad imklog: false
  - $ModLoad immark: true
  - |
    *.=info;*.=notice;*.=warn;\
        auth,authpriv.none;\
        cron,daemon.none;\
        mail,news.none    -/var/log/messages

Configs

manala_rsyslog_configs allows you to define Rsyslog configuration files using templates or raw content.

You can specify a state (present|absent|ignore).

manala_rsyslog_configs:
  # Config based
  - file: config.conf
    config:
      foo.*: -/var/log/foo.log
      bar.*: -/var/log/bar.log
  # Content based
  - file: content.conf
    config: |
      foo.* -/var/log/foo.log
      bar.* -/var/log/bar.log
  # Template based (filename based on template)
  - template: rsyslog/bar.conf.j2
    config:
      foo: bar
  # Template based (force filename)
  - file: baz.conf
    template: rsyslog/bar.conf.j2
    config:
      foo: bar
  # Dicts array template based (deprecated)
  - file: foo.conf
    template: configs/rules.prod.j2
    config:
      - auth,authpriv.*           /var/log/auth.log
      - '*.*;auth,authpriv.none   -/var/log/syslog'
      - daemon.*                  -/var/log/daemon.log
      - kern.*                    -/var/log/kern.log
      - mail.*                    -/var/log/mail.log
      - user.*                    -/var/log/user.log
  # Ensure config is absent
  - file: absent.conf
    state: absent # Default is "present"
  # Ignore config
  - file: ignore.conf
    state: ignore
  # Flatten configs
  - "{{ my_custom_configs_array }}"

manala_rsyslog_configs_exclusive allows cleaning up existing Rsyslog configuration files in the directory defined by manala_rsyslog_configs_dir. This ensures that no old or manually created files affect the current configuration.

manala_rsyslog_configs_exclusive: true

Example playbook

- hosts: all
  roles:
    - role: manala.rsyslog

License

MIT

Author information

Manala (http://www.manala.io/)

Informazioni sul progetto

Install and configure rsyslog

Installa
ansible-galaxy install manala.rsyslog
Licenza
Unknown
Download
21.4k
Proprietario
Manala is an open source project supported by the french web agency ELAO providing advanced ansible roles for website's infrastructures and far more.