Skip to content

Commit

Permalink
Merge pull request #5 from mvdriel/update-template-specific-configura…
Browse files Browse the repository at this point in the history
…tion-files

Added support for settings before and directives after rules
  • Loading branch information
tersmitten committed Dec 1, 2015
2 parents c473d75 + 0032e7d commit c60e533
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 2 deletions.
12 changes: 12 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ None
* `rsyslog_rsyslog_d_files.key`: The name of the rsyslog configuration file (e.g `50-default`)
* `rsyslog_rsyslog_d_files.key.state` [default: `present`]: State
* `rsyslog_rsyslog_d_files.key.validate` [default: `true`]: Whether this configuration should be validated before it is applied
* `rsyslog_rsyslog_d_files.key.settings` [default: `[]`]: Settings declarations
* `rsyslog_rsyslog_d_files.key.rules` [default: `{}`]: Rule declarations
* `rsyslog_rsyslog_d_files.key.rules.{n}.rule` [required]: Rule declaration
* `rsyslog_rsyslog_d_files.key.rules.{n}.logpath` [required]: Path of the log file
Expand Down Expand Up @@ -65,6 +66,17 @@ None
- rule: ':msg,contains,"[UFW "'
logpath: '/var/log/ufw.log'
postfix: "{{ rsyslog_rsyslog_d_presets_postfix }}"
49-haproxy:
settings:
# Create an additional socket in haproxy's chroot in order to allow logging via
# /dev/log to chroot'ed HAProxy processes
- '$AddUnixListenSocket /var/lib/haproxy/dev/log'
rules:
# Send HAProxy messages to a dedicated logfile
- rule: ':programname, startswith, "haproxy"'
logpath: '/var/log/haproxy.log'
directives:
- '&~'
```
#### License
Expand Down
2 changes: 1 addition & 1 deletion defaults/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ rsyslog_rsyslog_d_presets_50_default:

rsyslog_rsyslog_d_presets_postfix:
validate: false
directives:
settings:
# Create an additional socket in postfix's chroot in order not to break
# mail logging when rsyslog is restarted. If the directory is missing,
# rsyslog will silently skip creating the socket.
Expand Down
6 changes: 5 additions & 1 deletion templates/etc/rsyslog.d/rsyslog.conf.j2
Original file line number Diff line number Diff line change
@@ -1,9 +1,13 @@
# {{ ansible_managed }}

{% for item in item.value.directives | default([]) %}
{% for item in item.value.settings | default([]) %}
{{ item }}
{% endfor %}

{% for item in item.value.rules | default([]) %}
{{ item.rule }} {{ item.logpath }}
{% endfor %}

{% for item in item.value.directives | default([]) %}
{{ item }}
{% endfor %}

0 comments on commit c60e533

Please sign in to comment.