robertdebock / ansible-role-rsyslog

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

rsyslog_receiver boolean behavior is unintuitive #28

Closed bajzekm closed 3 years ago

bajzekm commented 3 years ago

https://github.com/robertdebock/ansible-role-rsyslog/blob/fadc2a2dcd601e80e1f5afbf05727e50201c1c97/defaults/main.yml#L6

https://github.com/robertdebock/ansible-role-rsyslog/blob/fadc2a2dcd601e80e1f5afbf05727e50201c1c97/templates/advanced_rsyslog.conf.j2#L31

Describe the bug

By default, rsyslog_receiver is undefined (because it's commented out in defaults/main.yml) and its value is ignored if it is set, since all references to it (in templates/advanced_rsyslog.conf.j2, templates/legacy_rsyslog.conf.j2, etc.) only check whether it's defined ("{{ '' if rsyslog_receiver is defined else '#' }}", etc.).

If defined, it does need to be a boolean (because of the checks in tasks/assert.yml), but the role's behavior is unintuitive, since setting it to no does configure the server to receive logs (just like setting it to yes).

Proposed fix