break: keepalived_vrrp_instances variable is now a hash

This commit is contained in:
Adrien Waksberg 2021-11-05 10:12:10 +01:00
parent e2bee4e950
commit 81dc07a29c
5 changed files with 8 additions and 7 deletions

View file

@ -12,6 +12,7 @@ Which is based on [Keep A Changelog](http://keepachangelog.com/)
### Changed ### Changed
- keepalived_vrrp_scripts variable is now a hash - keepalived_vrrp_scripts variable is now a hash
- keepalived_vrrp_instances variable is now a hash
### Fixed ### Fixed

View file

@ -19,7 +19,7 @@ Install and configure Keepalived
| keepalived_mail_from | str | no | keepalived@test.local | from header for notification mail | | keepalived_mail_from | str | no | keepalived@test.local | from header for notification mail |
| keepalived_smtp_server | str | no | localhost | the smtp server | | keepalived_smtp_server | str | no | localhost | the smtp server |
| keepalived_notification_mails | array | no | | the mail addresses to notify | | keepalived_notification_mails | array | no | | the mail addresses to notify |
| keepalived_vrrp_instances | array | no | | the vrrp instances | | keepalived_vrrp_instances | hash | no | | the vrrp instances |
| keepalived_vrrp_scripts | hash | no | | the vrrp check scripts | | keepalived_vrrp_scripts | hash | no | | the vrrp check scripts |
| keepalived_track_files | hash | no | | the track files | | keepalived_track_files | hash | no | | the track files |
@ -27,7 +27,7 @@ Install and configure Keepalived
| Name | Type | Required | Default | Comment | | Name | Type | Required | Default | Comment |
|---------------------|-------|----------|---------|----------------------------------------------| |---------------------|-------|----------|---------|----------------------------------------------|
| name | str | yes | | the instance name | | key | str | yes | | the instance name |
| state | str | yes | | Initial state, MASTER or BACKUP | | state | str | yes | | Initial state, MASTER or BACKUP |
| interface | str | yes | | interface for inside_network, bound by vrrp | | interface | str | yes | | interface for inside_network, bound by vrrp |
| virtual_router_id | int | yes | | arbitrary unique number from 1 to 255 | | virtual_router_id | int | yes | | arbitrary unique number from 1 to 255 |
@ -42,7 +42,7 @@ Install and configure Keepalived
Example: Example:
``` ```
- name: vip_ngninx vip_ngninx:
state: master state: master
interface: eth0 interface: eth0
virtual_router_id: 5 virtual_router_id: 5

View file

@ -2,6 +2,6 @@
keepalived_mail_from: keepalived@test.local keepalived_mail_from: keepalived@test.local
keepalived_smtp_server: localhost keepalived_smtp_server: localhost
keepalived_notification_mails: [] keepalived_notification_mails: []
keepalived_vrrp_instances: [] keepalived_vrrp_instances: {}
keepalived_vrrp_scripts: {} keepalived_vrrp_scripts: {}
keepalived_track_files: {} keepalived_track_files: {}

View file

@ -15,7 +15,7 @@
file: /tmp/master file: /tmp/master
weight: 42 weight: 42
keepalived_vrrp_instances: keepalived_vrrp_instances:
- name: test test:
state: master state: master
interface: eth0 interface: eth0
virtual_router_id: 5 virtual_router_id: 5

View file

@ -26,9 +26,9 @@ track_file {{ track_file_name }} {
weight {{ track_file.weight|default(1) }} weight {{ track_file.weight|default(1) }}
} }
{% endfor %} {% endfor %}
{% for vrrp_instance in keepalived_vrrp_instances %} {% for vrrp_instance_name, vrrp_instance in keepalived_vrrp_instances.items() %}
vrrp_instance {{ vrrp_instance.name }} { vrrp_instance {{ vrrp_instance_name }} {
state {{ vrrp_instance.state|upper }} state {{ vrrp_instance.state|upper }}
interface {{ vrrp_instance.interface }} interface {{ vrrp_instance.interface }}
virtual_router_id {{ vrrp_instance.virtual_router_id }} virtual_router_id {{ vrrp_instance.virtual_router_id }}