Skip to content

Commit 54c4e17

Browse files
committed
Make keepalived_notification_email a list
Signed-off-by: Norman Ziegner <[email protected]>
1 parent e79578c commit 54c4e17

File tree

4 files changed

+13
-5
lines changed

4 files changed

+13
-5
lines changed

molecule/keepalived/molecule.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,9 @@ provisioner:
3535
- "172.17.0.3"
3636
- "172.17.0.4"
3737
keepalived_virtual_ip_address: "172.17.0.20"
38+
keepalived_notification_email:
39+
- "root@localhost"
40+
3841
verifier:
3942
name: "ansible"
4043
scenario:

roles/keepalived/README.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -153,10 +153,11 @@ keepalived_pid_file_path: "/run/keepalived/keepalived.pid"
153153

154154
#### Configure notification email address
155155

156-
Configure recipient of notification emails:
156+
List of email accounts that will receive notification mails:
157157

158158
```yaml
159-
keepalived_notification_email: 'name@localhost'
159+
keepalived_notification_email:
160+
- 'root@localhost'
160161
```
161162

162163
#### Configure notification sender

roles/keepalived/defaults/main.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,8 +44,8 @@ keepalived_service_file_path: "/etc/systemd/system/keepalived.service"
4444
keepalived_pid_file_path: "/run/keepalived/keepalived.pid"
4545

4646

47-
# Configure notification email address
48-
keepalived_notification_email: "name@localhost"
47+
# Configure email accounts that will receive notification mails
48+
keepalived_notification_email: ["root@localhost"]
4949
# Configure notification sender
5050
keepalived_notification_email_from: "keepalived@localhost"
5151
# Configure SMTP Server

roles/keepalived/templates/keepalived.conf.j2

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,13 @@ global_defs {
1111
{% if keepalived_set_script_security_flag %}
1212
enable_script_security
1313
{% endif %}
14+
{% if keepalived_notification_email | default([]) | length > 0 %}
1415
notification_email {
15-
{{ keepalived_notification_email }}
16+
{% for email in keepalived_notification_email %}
17+
{{ email }}
18+
{% endfor %}
1619
}
20+
{% endif %}
1721
notification_email_from {{ keepalived_notification_email_from }}
1822
smtp_server {{ keepalived_smtp_server }}
1923
smtp_connect_timeout 30

0 commit comments

Comments
 (0)