File tree Expand file tree Collapse file tree 6 files changed +36
-10
lines changed Expand file tree Collapse file tree 6 files changed +36
-10
lines changed Original file line number Diff line number Diff line change 77
88- name : " Converge"
99 hosts : " all"
10- vars :
11- keepalived_unicast_peers :
12- - " 172.17.0.3"
13- - " 172.17.0.4"
14- keepalived_virtual_ip_address : " 172.17.0.20"
1510 tasks :
1611 - name : " Include keepalived role"
1712 ansible.builtin.include_role :
Original file line number Diff line number Diff line change @@ -27,6 +27,18 @@ provisioner:
2727 check : " converge.yml"
2828 converge : " converge.yml"
2929 verify : " verify.yml"
30+ inventory :
31+ hosts :
32+ all :
33+ vars :
34+ keepalived_unicast_peers :
35+ - " 172.17.0.3"
36+ - " 172.17.0.4"
37+ keepalived_virtual_ip_address : " 172.17.0.20"
38+ keepalived_notification_email :
" [email protected] " 39+ # keepalived_notification_emails:
40+ # - "root@localhost"
41+ 3042verifier :
3143 name : " ansible"
3244scenario :
Original file line number Diff line number Diff 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_emails:
160+ - 'root@localhost'
160161` ` `
161162
162163# ### Configure notification sender
Original file line number Diff line number Diff line change @@ -44,8 +44,8 @@ keepalived_service_file_path: "/etc/systemd/system/keepalived.service"
4444keepalived_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_emails : ["root @localhost"]
4949# Configure notification sender
5050keepalived_notification_email_from : " keepalived@localhost"
5151# Configure SMTP Server
Original file line number Diff line number Diff line change 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 :
Original file line number Diff line number Diff line change @@ -11,12 +11,16 @@ global_defs {
1111{% if keepalived_set_script_security_flag %}
1212 enable_script_security
1313{% endif %}
14+ {% if keepalived_notification_emails | default ([]) | length > 0 %}
1415 notification_email {
15- {{ keepalived_notification_email }}
16+ {% for email in keepalived_notification_emails %}
17+ {{ email }}
18+ {% endfor %}
1619 }
1720 notification_email_from {{ keepalived_notification_email_from }}
1821 smtp_server {{ keepalived_smtp_server }}
1922 smtp_connect_timeout 30
23+ {% endif %}
2024{% if keepalived_router_id is defined %}
2125 router_id {{ keepalived_router_id }}
2226{% endif %}
You can’t perform that action at this time.
0 commit comments