Skip to content

Commit

Permalink
pushgateway extra parameters
Browse files Browse the repository at this point in the history
Allow passing in additional parameters for the pushgateway binary
* pushgateway_web_external_url - useful when running behind a reverse
  proxy
* pushgateway_cli_extra_flags - additional extra flags for
  flexibility
  • Loading branch information
weakcamel committed Mar 22, 2024
1 parent c72059f commit a0b982e
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 0 deletions.
7 changes: 7 additions & 0 deletions roles/pushgateway/defaults/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,13 @@ pushgateway_skip_install: false
pushgateway_web_listen_address: "0.0.0.0:9091"
pushgateway_web_telemetry_path: "/metrics"

# External address on which pushgateway is available.
# Useful when behind reverse proxy, e.g.: https://example.org/pushgateway
pushgateway_web_external_url: ""

# Optional extra flags to be passed to pushgateway binary
pushgateway_cli_extra_flags: []

pushgateway_tls_server_config: {}

pushgateway_http_server_config: {}
Expand Down
11 changes: 11 additions & 0 deletions roles/pushgateway/templates/pushgateway.service.j2
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,17 @@ ExecStart={{ pushgateway_binary_install_dir }}/pushgateway \
{% endfor %}
{% else %}
'--web.listen-address={{ pushgateway_web_listen_address }}' \
{% endif %}
{% if pushgateway_web_external_url %}
--web.external-url="{{ pushgateway_web_external_url }}" \
{% endif %}
{% if pushgateway_cli_extra_flags and
pushgateway_cli_extra_flags is iterable and
pushgateway_cli_extra_flags is not mapping and
pushgateway_cli_extra_flags is not string %}
{% for extra_flag in pushgateway_cli_extra_flags %}
'{{ extra_flag }}' \
{% endfor %}
{% endif %}
'--web.telemetry-path={{ pushgateway_web_telemetry_path }}'

Expand Down

0 comments on commit a0b982e

Please sign in to comment.