Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add unixsocket support for webinterface #63

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,10 @@ Role Variables
* `monit_webinterface_enabled`: Enable monit web interface. Defaults to `true`.
* `monit_webinterface_bind`: IP address to bind web interface. Defaults to `0.0.0.0` (listen for external requests).
* `monit_webinterface_port`: Port for web interface. Defaults to `2812`.
* `monit_webinterface_socket_path`: Path to the socket file. If set this, use the unix socket instead of TCP for web interface. Defaults to undefined.
* `monit_webinterface_socket_owner`: Owner of the socket file. Defaults to undefined.
* `monit_webinterface_socket_group`: Owner group of the socket file. Defaults to undefined.
* `monit_webinterface_socket_mode`: Permission of the socket file. Defaults to undefined.
* `monit_webinterface_rw_group`: Define group of users allowed to read and write on web interface. It is only applied when defined and is empty by default.
* `monit_webinterface_r_group`: Define group of users allowed to read on web interface. It is only applied when defined and is empty by default.
* `monit_webinterface_acl_rules`: List of ACL rules for the web interface, such as "localhost" or "hauk:password". It is only applied when defined and is empty by default. You should probably define at least one for the httpd service to start.
Expand Down
17 changes: 15 additions & 2 deletions templates/webinterface.j2
Original file line number Diff line number Diff line change
@@ -1,8 +1,21 @@
# {{ ansible_managed }}
{% if monit_webinterface_enabled %}
set httpd
port {{ monit_webinterface_port }}
use address {{ monit_webinterface_bind }}
{% if monit_webinterface_socket_path is not defined %}
port {{ monit_webinterface_port }}
use address {{ monit_webinterface_bind }}
{% else %}
unixsocket {{ monit_webinterface_socket_path }}
{% if monit_webinterface_socket_owner is defined %}
uid {{ monit_webinterface_socket_owner }}
{% endif %}
{% if monit_webinterface_socket_group is defined %}
gid {{ monit_webinterface_socket_group }}
{% endif %}
{% if monit_webinterface_socket_mode is defined %}
permission {{ monit_webinterface_socket_mode }}
{% endif %}
{% endif %}
{% if monit_webinterface_acl_rules is defined %}
{% for rule in monit_webinterface_acl_rules %}
allow {{ rule }}
Expand Down