Merge "Fix haproxy access to rsyslogd on Noble"

This commit is contained in:
Zuul 2025-02-13 22:41:03 +00:00 committed by Gerrit Code Review
commit 883024ced8
2 changed files with 21 additions and 0 deletions

View File

@ -22,6 +22,20 @@
that:
- haproxy_config_template is defined
- name: Fix rsyslog apparmor profile on Noble and newer
when: ansible_distribution_version is version('24.04', '>=')
block:
- name: Edit rsyslogd apparmor profile
lineinfile:
path: /etc/apparmor.d/usr.sbin.rsyslogd
regexp: '^profile rsyslogd /usr/sbin/rsyslogd {'
line: 'profile rsyslogd /usr/sbin/rsyslogd flags=(attach_disconnected) {'
register: profile_update
- name: Reload rsyslogd apparmor profile
command: apparmor_parser -r /etc/apparmor.d/usr.sbin.rsyslogd
when: profile_update.changed
- name: Write rsyslog file
copy:
src: rsyslog.d/49-haproxy.conf

View File

@ -32,3 +32,10 @@ def test_haproxy_statsd_running(host):
out = json.loads(cmd.stdout)
assert out[0]["State"]["Status"] == "running"
assert out[0]["RestartCount"] == 0
def test_haproxy_logging(host):
# rsyslog is configured to add a unix socket at this path
assert host.file('/var/lib/haproxy/dev/log').is_socket
# Haproxy logs to syslog via the above socket which produces
# this logfile
assert host.file('/var/log/haproxy.log').is_file