diff --git a/README.md b/README.md index f6b7817..66fc85a 100644 --- a/README.md +++ b/README.md @@ -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 | diff --git a/defaults/main.yml b/defaults/main.yml index 66c036f..9e29d3f 100644 --- a/defaults/main.yml +++ b/defaults/main.yml @@ -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 @@ -50,7 +50,6 @@ alertmanager_receivers: [] # - name: slack # slack_configs: # - send_resolved: true -# api_url: $slack_api_url # channel: '#alerts' alertmanager_inhibit_rules: [] diff --git a/molecule/alternative/playbook.yml b/molecule/alternative/playbook.yml index 569c68e..f87c8ba 100644 --- a/molecule/alternative/playbook.yml +++ b/molecule/alternative/playbook.yml @@ -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'] diff --git a/molecule/default/playbook.yml b/molecule/default/playbook.yml index 15a668b..c896377 100644 --- a/molecule/default/playbook.yml +++ b/molecule/default/playbook.yml @@ -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'] diff --git a/templates/alertmanager.yml.j2 b/templates/alertmanager.yml.j2 index 036df6a..9b194f9 100644 --- a/templates/alertmanager.yml.j2 +++ b/templates/alertmanager.yml.j2 @@ -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 %}