robertdebock / ansible-role-rsyslog

Install and configure rsyslog on your system.
https://robertdebock.nl/
Apache License 2.0
37 stars 40 forks source link

Allow overriding rsyslog_packages #32

Closed ct-sce closed 2 years ago

ct-sce commented 2 years ago

name: Allow overriding rsyslog_packages about: Allow overriding rsyslog_packages


Describe the change Allow overriding rsyslog_packages Exemple install rsyslog-gnutls or any other output or protocol support plugin

robertdebock commented 2 years ago

Thanks for the input!

If the packages differ per distribution, I think it would be nice to make a map in vars/main.yml and select packages based on the ansible_os_family (or ansible_distribution) and the "feature" like "gnutls". Something like this:

defaults/main.yml

# Set rsyslog_feature to "default" or "gnutls".
rsyslog_feature: default

vars/main.yml

_rsyslog_packages:
  RedHat:
    default:
      - x
    gnutls:
      - x
      - y
   Debian
    default:
      - z
    gnutls:
      - z
      - x

rsyslog_packages: "{{ _rsyslog_packages[ansible_os_family][rsyslog_feature] }}"

I think you are more familiar with rsyslog, so please let me know if my remarks make any sense.

ct-sce commented 2 years ago

rsyslog packages seems to be identical between distributions so maybe we can do

rsyslog_features:
  - gnutls
  - elastisearch

and add a task

- apt:
    name: "rsyslog-{{ item }}"
  loop: "{{ rsyslog_features }}"

this way we can install every feature we want to add

robertdebock commented 2 years ago

That's good proposal:

Please modify the PR a bit to your proposed solution.

Regards, Robert de Bock.

ct-sce commented 2 years ago

@robertdebock the PR is now updated with the proposal

Regards, Seb