diff --git a/CHANGELOG.md b/CHANGELOG.md index f0047c0..d829976 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -12,6 +12,7 @@ Which is based on [Keep A Changelog](http://keepachangelog.com/) ### Changed - keepalived_vrrp_scripts variable is now a hash +- keepalived_vrrp_instances variable is now a hash ### Fixed diff --git a/README.md b/README.md index 4f7f66b..73eaa72 100644 --- a/README.md +++ b/README.md @@ -19,7 +19,7 @@ Install and configure Keepalived | keepalived_mail_from | str | no | keepalived@test.local | from header for notification mail | | keepalived_smtp_server | str | no | localhost | the smtp server | | 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_track_files | hash | no | | the track files | @@ -27,7 +27,7 @@ Install and configure Keepalived | 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 | | interface | str | yes | | interface for inside_network, bound by vrrp | | virtual_router_id | int | yes | | arbitrary unique number from 1 to 255 | @@ -42,7 +42,7 @@ Install and configure Keepalived Example: ``` -- name: vip_ngninx +vip_ngninx: state: master interface: eth0 virtual_router_id: 5 diff --git a/defaults/main.yml b/defaults/main.yml index 503b8b6..1e2cf4f 100644 --- a/defaults/main.yml +++ b/defaults/main.yml @@ -2,6 +2,6 @@ keepalived_mail_from: keepalived@test.local keepalived_smtp_server: localhost keepalived_notification_mails: [] -keepalived_vrrp_instances: [] +keepalived_vrrp_instances: {} keepalived_vrrp_scripts: {} keepalived_track_files: {} diff --git a/molecule/default/converge.yml b/molecule/default/converge.yml index 893bf1c..9672945 100644 --- a/molecule/default/converge.yml +++ b/molecule/default/converge.yml @@ -15,7 +15,7 @@ file: /tmp/master weight: 42 keepalived_vrrp_instances: - - name: test + test: state: master interface: eth0 virtual_router_id: 5 diff --git a/templates/keepalived.conf.j2 b/templates/keepalived.conf.j2 index 77b49d6..36e86f3 100644 --- a/templates/keepalived.conf.j2 +++ b/templates/keepalived.conf.j2 @@ -26,9 +26,9 @@ track_file {{ track_file_name }} { weight {{ track_file.weight|default(1) }} } {% 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 }} interface {{ vrrp_instance.interface }} virtual_router_id {{ vrrp_instance.virtual_router_id }}