Skip to content
This repository has been archived by the owner on Mar 6, 2023. It is now read-only.

Commit

Permalink
New alertmanager upstream release and template improvements (#62)
Browse files Browse the repository at this point in the history
[patch]
  • Loading branch information
cloudalchemybot authored and paulfantom committed Mar 4, 2019
1 parent d2d12a3 commit 857a5e5
Show file tree
Hide file tree
Showing 5 changed files with 26 additions and 28 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ All variables which can be overridden are stored in [defaults/main.yml](defaults

| Name | Default Value | Description |
| -------------- | ------------- | -----------------------------------|
| `alertmanager_version` | 0.15.2 | Alermanager package version |
| `alertmanager_version` | 0.16.1 | Alertmanager package version |
| `alertmanager_listen_address` | '0.0.0.0:9093' | Address on which alertmanager will be listening |
| `alertmanager_external_url` | 'http://localhost:9093/' | External address on which alertmanager is available. Useful when behind reverse proxy. Ex. example.org/alertmanager |
| `alertmanager_config_dir` | /etc/alertmanager | Path to directory with alertmanager configuration |
Expand Down
3 changes: 1 addition & 2 deletions defaults/main.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
alertmanager_version: 0.15.3
alertmanager_version: 0.16.1

alertmanager_config_dir: /etc/alertmanager
alertmanager_db_dir: /var/lib/alertmanager
Expand Down Expand Up @@ -50,7 +50,6 @@ alertmanager_receivers: []
# - name: slack
# slack_configs:
# - send_resolved: true
# api_url: $slack_api_url
# channel: '#alerts'

alertmanager_inhibit_rules: []
Expand Down
2 changes: 1 addition & 1 deletion molecule/alternative/playbook.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
- name: slack
slack_configs:
- send_resolved: true
api_url: $slack_api_url
api_url: 'https://hooks.slack.com/services/T00000000/B00000000/XXXXXXXXXXXXXXXXXXXXXXXX'
channel: '#alerts'
alertmanager_route:
group_by: ['alertname', 'cluster', 'service']
Expand Down
1 change: 0 additions & 1 deletion molecule/default/playbook.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
- name: slack
slack_configs:
- send_resolved: true
api_url: $slack_api_url
channel: '#alerts'
alertmanager_route:
group_by: ['alertname', 'cluster', 'service']
Expand Down
46 changes: 23 additions & 23 deletions templates/alertmanager.yml.j2
Original file line number Diff line number Diff line change
@@ -1,50 +1,50 @@
{{ ansible_managed | comment }}

global:
resolve_timeout: {{ alertmanager_resolve_timeout }}
resolve_timeout: {{ alertmanager_resolve_timeout | quote}}
{% for key, value in alertmanager_smtp.items() %}
smtp_{{ key }}: {{ value }}
smtp_{{ key }}: {{ value | quote }}
{% endfor %}
{% if alertmanager_slack_api_url != '' %}
slack_api_url: {{ alertmanager_slack_api_url }}
{% if alertmanager_slack_api_url | length %}
slack_api_url: {{ alertmanager_slack_api_url | quote }}
{% endif %}
{% if alertmanager_pagerduty_url != '' %}
pagerduty_url: {{ alertmanager_pagerduty_url }}
{% if alertmanager_pagerduty_url | length %}
pagerduty_url: {{ alertmanager_pagerduty_url | quote }}
{% endif %}
{% if alertmanager_opsgenie_api_key != '' %}
opsgenie_api_key: {{ alertmanager_opsgenie_api_key }}
{% if alertmanager_opsgenie_api_key | length %}
opsgenie_api_key: {{ alertmanager_opsgenie_api_key | quote }}
{% endif %}
{% if alertmanager_opsgenie_api_url != '' %}
opsgenie_api_url: {{ alertmanager_opsgenie_api_url }}
{% if alertmanager_opsgenie_api_url | length %}
opsgenie_api_url: {{ alertmanager_opsgenie_api_url | quote }}
{% endif %}
{% if alertmanager_hipchat_api_url != '' %}
hipchat_api_url: {{ alertmanager_hipchat_api_url }}
{% if alertmanager_hipchat_api_url | length %}
hipchat_api_url: {{ alertmanager_hipchat_api_url | quote }}
{% endif %}
{% if alertmanager_hipchat_auth_token != '' %}
hipchat_auth_token: {{ alertmanager_hipchat_auth_token }}
{% if alertmanager_hipchat_auth_token | length %}
hipchat_auth_token: {{ alertmanager_hipchat_auth_token | quote }}
{% endif %}
{% if alertmanager_wechat_url != '' %}
wechat_api_url: {{ alertmanager_wechat_url }}
{% if alertmanager_wechat_url | length %}
wechat_api_url: {{ alertmanager_wechat_url | quote }}
{% endif %}
{% if alertmanager_wechat_secret != '' %}
wechat_api_secret: {{ alertmanager_wechat_secret }}
{% if alertmanager_wechat_secret | length %}
wechat_api_secret: {{ alertmanager_wechat_secret | quote }}
{% endif %}
{% if alertmanager_wechat_corp_id != '' %}
wechat_api_corp_id: {{ alertmanager_wechat_corp_id }}
{% if alertmanager_wechat_corp_id | length %}
wechat_api_corp_id: {{ alertmanager_wechat_corp_id | quote }}
{% endif %}
templates:
- '/etc/alertmanager/templates/*.tmpl'
{% if alertmanager_receivers != [] %}
{% if alertmanager_receivers | length %}
receivers:
{{ alertmanager_receivers | to_nice_yaml(indent=2) }}
{% endif %}
{% if alertmanager_inhibit_rules != [] %}
{% if alertmanager_inhibit_rules | length %}
inhibit_rules:
{{ alertmanager_inhibit_rules | to_nice_yaml(indent=2) }}
{% endif %}
route:
{{ alertmanager_route | to_nice_yaml(indent=2) | indent(2, False) }}
{% if alertmanager_child_routes != [] %}
{% if alertmanager_child_routes | length %}
routes:
{{ alertmanager_child_routes | to_nice_yaml(indent=2) | indent(2, False) }}
{% endif %}

0 comments on commit 857a5e5

Please sign in to comment.