Skip to content

Commit d416209

Browse files
authored
Merge pull request #5 from cloudalchemy/superq/channels
Add support for pre-set IRC channels
2 parents e6813f3 + 4131180 commit d416209

File tree

4 files changed

+9
-2
lines changed

4 files changed

+9
-2
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ All variables which can be overridden are stored in [defaults/main.yml](defaults
3131
| `alertmanager_irc_relay_irc_realname` | "" | The realname to connect with. |
3232
| `alertmanager_irc_relay_notice_once_per_alert_group` | "yes" | Send only one notice when webhook data is received. |
3333
| `alertmanager_irc_relay_notice_template` | "Alert {{ .Labels.alertname }} on {{ .Labels.instance }} is {{ .Status }}" | The formatting is based on golang's text/template. |
34+
| `alertmanager_irc_relay_channels` | "[]" | A list of channels to join at startup. |
3435

3536
## Example
3637

defaults/main.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,3 +15,5 @@ alertmanager_irc_relay_irc_realname: ""
1515

1616
alertmanager_irc_relay_notice_once_per_alert_group: "yes"
1717
alertmanager_irc_relay_notice_template: "{% raw %}Alert {{ .Labels.alertname }} on {{ .Labels.instance }} is {{ .Status }}{% endraw %}"
18+
19+
alertmanager_irc_relay_channels: []

molecule/alternative/playbook.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,3 +8,5 @@
88
alertmanager_irc_relay_system_group: "root"
99
alertmanager_irc_relay_http_host: "127.0.0.1"
1010
alertmanager_irc_relay_http_port: 7000
11+
alertmanager_irc_relay_channels:
12+
- name: "#test-channel"

templates/alertmanager-irc-relay-config.yml.j2

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,10 @@ irc_realname: {{ alertmanager_irc_relay_irc_realname | quote}}
2222
# Note: If an alert is sent to a non # pre-joined channel the bot will join
2323
# that channel anyway before sending the notice. Of course this cannot work
2424
# with password-protected channels.
25-
# irc_channels:
26-
# - name: "#fosdem"
25+
{% if alertmanager_irc_relay_channels != [] %}
26+
irc_channels:
27+
{{ alertmanager_irc_relay_channels | to_nice_yaml }}
28+
{% endif %}
2729

2830
# Define how IRC messages should be sent.
2931
#

0 commit comments

Comments
 (0)