Added *stats* listen type.
diff --git a/README.rst b/README.rst
index ab083c8..265ec7c 100644
--- a/README.rst
+++ b/README.rst
@@ -4,8 +4,44 @@
The Reliable, High Performance TCP/HTTP Load Balancer.
-Sample pillar
-=============
+
+Sample pillars
+==============
+
+Simple admin listener
+
+.. code-block:: yaml
+
+ haproxy:
+ proxy:
+ enabled: True
+ listen:
+ admin_page:
+ type: admin
+ binds:
+ - address: 0.0.0.0
+ port: 8801
+ user: fsdfdsfds
+ password: dsfdsf
+
+
+Simple stats listener
+
+.. code-block:: yaml
+
+ haproxy:
+ proxy:
+ enabled: True
+ listen:
+ admin_page:
+ type: stats
+ binds:
+ - address: 0.0.0.0
+ port: 8801
+
+
+
+Sample pillar with admin
.. code-block:: yaml
@@ -13,6 +49,7 @@
proxy:
enabled: True
mode: http/tcp
+ logging: syslog
max_connections: 1024
connect_timeout: 5000
client_timeout: 50000
@@ -31,8 +68,8 @@
port: 8443
params: 'maxconn 256'
+
Sample pillar with custom logging
-=================================
.. code-block:: yaml
diff --git a/haproxy/files/haproxy.cfg b/haproxy/files/haproxy.cfg
index 424a79d..3ef3ce8 100644
--- a/haproxy/files/haproxy.cfg
+++ b/haproxy/files/haproxy.cfg
@@ -39,7 +39,7 @@
timeout server 1m
timeout check 10s
-{%- if proxy.listen.admin_page is defined %}
+{%- if proxy.listen.admin_page is defined and proxy.listen.admin_page.user is defined %}
userlist STATSUSERS
group admin users admin
@@ -133,8 +133,10 @@
mode http
stats enable
stats uri /
+ {%- if listen.user is defined %}
stats auth {{ listen.user }}:{{ listen.password }}
{%- endif %}
+ {%- endif %}
{%- if listen.type == 'admin' %}
mode http
acl AuthOkay_ReadOnly http_auth(STATSUSERS)