Enable HAProxy Stats Web UI

This patch enables the HAProxy webstats for all the configures
backends and frontends.

A password entry is added to user_secrets.yml for the webstats
password.

It also adds variables for port number, username and password
which can be overridden in user_variables.yml appropriately.

Change-Id: Iec866ad124bec6fb0b8524a966adf64e22422035
Closes-Bug: #1446432
This commit is contained in:
george paraskevas 2015-08-19 17:10:38 +03:00 committed by Jesse Pretorius
parent 13585f0b32
commit 79e55616aa
4 changed files with 25 additions and 3 deletions

View File

@ -85,3 +85,6 @@ swift_dispersion_password:
### Once the swift cluster has been setup DO NOT change these hash values!
swift_hash_path_suffix:
swift_hash_path_prefix:
## haproxy stats password
haproxy_stats_password:

View File

@ -43,6 +43,13 @@ haproxy_rise: 3
haproxy_fall: 3
haproxy_interval: 12000
## Haproxy Stats
haproxy_stats_enabled: False
haproxy_stats_bind_address: 127.0.0.1
haproxy_stats_port: 1936
haproxy_username: admin
haproxy_stats_password: secrete
# Default haproxy backup nodes to empty list so this doesn't have to be
# defined for each service.
haproxy_backup_nodes: []

View File

@ -14,11 +14,11 @@
# limitations under the License.
- name: Drop base haproxy config
copy:
template:
src: "{{ item }}"
dest: "/etc/haproxy/{{ item }}"
dest: "/etc/haproxy/haproxy.cfg"
with_items:
- haproxy.cfg
- haproxy.cfg.j2
notify: Restart haproxy
tags:
- haproxy-base-config

View File

@ -1,3 +1,5 @@
# {{ ansible_managed }}
global
log 127.0.0.1 local0
log 127.0.0.1 local1 notice
@ -18,3 +20,13 @@ defaults
timeout connect 10s
timeout server 50s
maxconn 4096
{% if haproxy_stats_enabled | bool %}
listen stats {{ haproxy_stats_bind_address }}:{{ haproxy_stats_port }}
mode http
stats enable
stats hide-version
stats realm Haproxy\ Statistics
stats uri /
stats auth {{ haproxy_username }}:{{ haproxy_stats_password }}
{% endif %}