/ansible-role-rsyslog

Install and configure rsyslog on your system.

Primary LanguageJinjaApache License 2.0Apache-2.0

Install and configure rsyslog on your system.

GitHub GitLab Quality Downloads Version
github gitlab quality downloads Version

This example is taken from molecule/resources/converge.yml and is tested on each push, pull request and release.

---
- name: Converge
  hosts: all
  become: yes
  gather_facts: yes

  roles:
    - role: robertdebock.rsyslog

The machine needs to be prepared in CI this is done using molecule/resources/prepare.yml:

---
- name: Prepare
  hosts: all
  become: yes
  gather_facts: no

  roles:
    - role: robertdebock.bootstrap

Also see a full explanation and example on how to use these roles.

These variables are set in defaults/main.yml:

---
# defaults file for rsyslog

# To configure a server to reveice logs, set rsyslog_receiver to yes.
# Not setting this value will not configure the server tor receive logs.
# rsyslog_receiver: yes

# To forward logs to another server, set rsyslog_remote to the hostname or
# the ipaddress of the receiving rsyslog server.
# Not setting this variable will not forward logs.
# rsyslog_remote: server1.example.com

# If rsylog_remote is set, sets the "selector" pattern for determining which
# messages to send to the remote server.  Default "*.*" sends everything.
# See `man rsyslog.conf`.
rsyslog_remote_selector: "*.*"

# If rsylog_remote is set, use TCP if yes. UDP if no.
rsyslog_remote_tcp: yes

# If rsylog_remote is set, destination port to use.
rsyslog_remote_port: 514

# Set the mode for new directories; only available in legacy template.
rsyslog_dircreatemode: "0700"

# Set the mode for new files; only available in legacy template.
rsyslog_filecreatemode: "0644"

# Set the mods enabled
rsyslog_mods:
  - imuxsock
  - imjournal

# Configure rsyslog minimally (may be in conflict with custom configuration files)
rsyslog_deploy_default_config: yes

# Use the (obsolete) legacy, pre-v6 configuration file format, or the more
# modern # 'advanced' configuration file format available in v6 and up. The
# default is to use the 'legacy' format to not change config files for
# existing users of this role out of the blue.
# More information on the different formats on the rsyslog website:
# https://www.rsyslog.com/doc/v8-stable/configuration/conf_formats.html
rsyslog_config_file_format: legacy

# The rule conf to name to add to /etc/rsyslog.d/
# rsyslog_forward_rule_name: <to fill>

# Configure the rsyslog package to be `present`, or set to `latest` to install
# the latest available version.
rsyslog_package_state: present

# if set to false (legacy default to remain compatible to sysklogd), the domain
# part from a name that is within the same domain as the receiving system is
# stripped. If set to on, full names are always used.
rsyslog_preservefqdn: false

The following roles are used to prepare a system. You may choose to prepare your system in another way, I have tested these roles as well.

Requirement GitHub GitLab
robertdebock.bootstrap Build Status GitHub Build Status GitLab

This role is a part of many compatible roles. Have a look at the documentation of these roles for further information.

Here is an overview of related roles: dependencies

This role has been tested on these container images:

container tags
alpine all
amazon Candidate
el 8
debian buster, bullseye
fedora all
opensuse all
ubuntu focal, bionic

The minimum version of Ansible required is 2.10, tests have been done to:

  • The previous version.
  • The current version.
  • The development version.

Some variarations of the build matrix do not work. These are the variations and reasons why the build won't work:

variation reason
archlinux/base target not found: rsyslog

If you find issues, please register them in GitHub

Apache-2.0

I'd like to thank everybody that made contributions to this repository. It motivates me, improves the code and is just fun to collaborate.

Robert de Bock

Please consider sponsoring me.