Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for accept/no_accept for instances. #176

Closed
wants to merge 1 commit into from

Conversation

naphta
Copy link

@naphta naphta commented May 25, 2021

Coming to this role wanting to implement the keepalived configuration offered by nginx plus and they have accept inside that configuration. Had a quick dig into the manpage and thought this should suffice.

Copy link
Owner

@evrardjp evrardjp left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A few suggestions. Can you try those?

@@ -93,6 +93,13 @@ vrrp_instance {{ name }} {
{% if instance.dont_track_primary is defined and instance.dont_track_primary | bool %}
dont_track_primary # Override VRRP RFC dont_track_primary default
{% endif %}
{% if instance.accept is defined and instance.accept | bool %}
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
{% if instance.accept is defined and instance.accept | bool %}
{% if instance.accept is defined %}

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This way if the user doesn't define accept (the default), there is no change in the config file.
And if someone writes instance.accept false, would write no_accept appropriately.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've not tested the alternative (nor do I have an objection to it) but I'd have thought that my if which is checking if accept is defined and a boolean wouldn't pass in the case of accept: , thus not writing out accept or no_accept to the file.

@@ -93,6 +93,13 @@ vrrp_instance {{ name }} {
{% if instance.dont_track_primary is defined and instance.dont_track_primary | bool %}
dont_track_primary # Override VRRP RFC dont_track_primary default
{% endif %}
{% if instance.accept is defined and instance.accept | bool %}
{% if instance.accept %}
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
{% if instance.accept %}
{% if instance.accept | bool %}

@evrardjp evrardjp added the no-answer No answer from original author for two weeks or more. Used to expire stale issues or PR. label Aug 2, 2021
Kariton added a commit to Kariton/ansible-keepalived that referenced this pull request Jun 9, 2022
Kariton added a commit to Kariton/ansible-keepalived that referenced this pull request Jun 16, 2022
@evrardjp evrardjp closed this in ac0119d Jul 12, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
no-answer No answer from original author for two weeks or more. Used to expire stale issues or PR.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants