Skip to content

Commit

Permalink
Merge pull request #25 from Oefenweb/add-ability-to-enable-admin-inte…
Browse files Browse the repository at this point in the history
…rface

Add ability to enable admin interface
  • Loading branch information
tersmitten authored Sep 7, 2016
2 parents a5b08f0 + 5780a1e commit 14f051a
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 7 deletions.
15 changes: 11 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -87,8 +87,9 @@ Set up (the latest version of) [HAProxy](http://www.haproxy.org/) in Ubuntu syst
* `haproxy_listen.{n}.stats`: [optional]: Stats declarations
* `haproxy_listen.{n}.stats.enable`: [required]: Enables statistics reporting with default settings
* `haproxy_listen.{n}.stats.uri`: [optional, default `/`]: Define the URI prefix to access statistics
* `haproxy_listen.{n}.stats.hide_version`: [optional]: Hide version reporting
* `haproxy_listen.{n}.stats.options`: [optional]: List of boolean stats options (e.g. `hide-version`, `show-node`, `show-desc`, `show-legends`)
* `haproxy_listen.{n}.stats.refresh`: [optional]: Defined the refresh delay, specified in seconds (e.g. `5s`)
* `haproxy_listen.{n}.stats.admin`: [optional]: Define / enable admin part of web interface with conditional attached
* `haproxy_listen.{n}.stats.auth`: [optional]: Auth declarations
* `haproxy_listen.{n}.stats.auth.{n}.user`: [required]: A user name to grant access to
* `haproxy_listen.{n}.stats.auth.{n}.passwd`: [required]: The cleartext password associated to this user
Expand Down Expand Up @@ -200,7 +201,10 @@ None
stats:
enable: true
uri: /
hide_version: true
options:
- hide-version
- show-node
admin: if LOCALHOST
refresh: 5s
auth:
- user: admin
Expand All @@ -218,7 +222,7 @@ None
default_backend: webservers
- name: https
description: Front-end for all HTTPS traffic
bind:
bind:
- listen: "{{ ansible_eth0['ipv4']['address'] }}:443"
param:
- ssl
Expand Down Expand Up @@ -314,8 +318,11 @@ None
stats:
enable: true
uri: /
hide_version: true
options:
- hide-version
- show-desc
refresh: 5s
admin: if TRUE
auth:
- user: admin
passwd: 'NqXgKWQ9f9Et'
Expand Down
9 changes: 6 additions & 3 deletions templates/etc/haproxy/listen.cfg.j2
Original file line number Diff line number Diff line change
Expand Up @@ -47,12 +47,15 @@ listen {{ listen.name }}
{% if listen.stats.enable is defined and listen.stats.enable | bool == true %}
stats enable
stats uri {{ listen.stats.uri | default('/') }}
{% if listen.stats.hide_version is defined and listen.stats.hide_version | bool == true %}
stats hide-version
{% endif %}
{% if listen.stats.refresh is defined %}
stats refresh {{ listen.stats.refresh }}
{% endif %}
{% if listen.stats.admin is defined %}
stats admin {{ listen.stats.admin }}
{% endif %}
{% for option in listen.stats.options | default([]) %}
stats {{ option }}
{% endfor %}
{% for auth in listen.stats.auth | default([]) %}
stats auth {{ auth.user }}:{{ auth.passwd }}

Expand Down

0 comments on commit 14f051a

Please sign in to comment.