Skip to content

Commit 899fedf

Browse files
committed
Rename keepalived_notification_emails variable
Signed-off-by: Norman Ziegner <[email protected]>
1 parent 1e6a189 commit 899fedf

File tree

5 files changed

+22
-7
lines changed

5 files changed

+22
-7
lines changed

molecule/keepalived/molecule.yml

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,9 +35,10 @@ 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-
38+
keepalived_notification_email: "[email protected]"
39+
# keepalived_notification_emails:
40+
# - "root@localhost"
41+
4142
verifier:
4243
name: "ansible"
4344
scenario:

roles/keepalived/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,7 @@ keepalived_pid_file_path: "/run/keepalived/keepalived.pid"
156156
List of email accounts that will receive notification mails:
157157

158158
```yaml
159-
keepalived_notification_email:
159+
keepalived_notification_emails:
160160
- 'root@localhost'
161161
```
162162

roles/keepalived/defaults/main.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ keepalived_pid_file_path: "/run/keepalived/keepalived.pid"
4545

4646

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

roles/keepalived/tasks/main.yml

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,20 @@
1313
fail_msg: "Some mandatory variables are not set."
1414
success_msg: "All mandatory variables are set."
1515

16+
- name: "Variable keepalived_notification_email is deprecated"
17+
when: "keepalived_notification_email | default('') | length > 0"
18+
block:
19+
20+
- name: "Set keepalived_notification_emails variable"
21+
ansible.builtin.set_fact:
22+
keepalived_notification_emails: ["{{ keepalived_notification_email }}"]
23+
24+
- name: "Show deprecation warning"
25+
ansible.builtin.debug:
26+
msg:
27+
- "The variable keepalived_notification_email is deprecated and will be removed in the next major release."
28+
- "Please use list variable 'keepalived_notification_emails' instead."
29+
1630
- name: "Install dependencies for Keepalived."
1731
become: true
1832
ansible.builtin.package:

roles/keepalived/templates/keepalived.conf.j2

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,9 @@ global_defs {
1111
{% if keepalived_set_script_security_flag %}
1212
enable_script_security
1313
{% endif %}
14-
{% if keepalived_notification_email | default([]) | length > 0 %}
14+
{% if keepalived_notification_emails | default([]) | length > 0 %}
1515
notification_email {
16-
{% for email in keepalived_notification_email %}
16+
{% for email in keepalived_notification_emails %}
1717
{{ email }}
1818
{% endfor %}
1919
}

0 commit comments

Comments
 (0)