Skip to content

Commit 5c29906

Browse files
committed
Add optional extra arguments to the stats socket
1 parent e4e6b28 commit 5c29906

3 files changed

Lines changed: 4 additions & 2 deletions

File tree

README.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ Currently, only a handful of options can be set using the pillar:
3535

3636
- Global
3737

38-
+ stats: enable stats, curently only via a unix socket which can be set to a path with custom permissions
38+
+ stats: enable stats, currently only via a unix socket which can be set to a path with custom permissions and optional extra bind arguments
3939
+ user: sets the user haproxy shall run as
4040
+ group: sets the group haproxy shall run as
4141
+ chroot: allows you to turn on chroot and set a directory

haproxy/templates/haproxy.jinja

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ global
4040
daemon
4141
{%- endif %}
4242
{%- if salt['pillar.get']('haproxy:global:stats:enable', 'no') == True %}
43-
stats socket {{ salt['pillar.get']('haproxy:global:stats:socketpath', '/tmp/ha_stats.sock') }} mode {{ salt['pillar.get']('haproxy:global:stats:mode', '660') }} level {{ salt['pillar.get']('haproxy:global:stats:level', 'operator') }}
43+
stats socket {{ salt['pillar.get']('haproxy:global:stats:socketpath', '/tmp/ha_stats.sock') }} mode {{ salt['pillar.get']('haproxy:global:stats:mode', '660') }} level {{ salt['pillar.get']('haproxy:global:stats:level', 'operator') }}{% if 'extra' in salt['pillar.get']('haproxy:global:stats', {}) %} {{ salt['pillar.get']('haproxy:global:stats:extra') }}{% endif %}
4444
{%- endif %}
4545
{%- if 'maxconn' in salt['pillar.get']('haproxy:global', {}) %}
4646
maxconn {{ salt['pillar.get']('haproxy:global:maxconn') }}

pillar.example

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,8 @@ haproxy:
2222
socketpath: /var/lib/haproxy/stats
2323
mode: 660
2424
level: admin
25+
# Optional extra bind parameter, for example to set the owner/group on the socket file
26+
extra: user haproxy group haproxy
2527
ssl-default-bind-ciphers: "ECDHE-RSA-AES128-GCM-SHA256:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-RSA-AES128-SHA256:ECDHE-RSA-AES256-SHA384"
2628
ssl-default-bind-options: "no-sslv3 no-tlsv10 no-tlsv11"
2729

0 commit comments

Comments
 (0)