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

ntp: add config to filter and set ntp interfaces #11066

Merged
merged 2 commits into from
Apr 25, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions roles/kubernetes/preinstall/defaults/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,13 @@ ntp_servers:
ntp_restrict:
- "127.0.0.1"
- "::1"
# Specify whether to filter interfaces
Copy link
Member

Choose a reason for hiding this comment

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

HI @Pavan-Gunda

Because there is only one variable that needs to be config, so

# Some comments
# Uncomment `ntp_interfaces` if enable xxxx
# ntp_interfaces: 
#   - ignore wildcard
#   - isten xxx

Which Can be easier for the code.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thank you 👍

I made the change now and pushed the code :)

ntp_filter_interface: false
# Specify the interfaces
# Only takes effect when ntp_filter_interface is true
# ntp_interfaces:
# - ignore wildcard
# - listen xxx
# The NTP driftfile path
# Only takes effect when ntp_manage_config is true.
ntp_driftfile: /var/lib/ntp/ntp.drift
Expand Down
7 changes: 7 additions & 0 deletions roles/kubernetes/preinstall/templates/ntp.conf.j2
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,13 @@ restrict -6 default kod notrap nomodify nopeer noquery limited
restrict {{ item }}
{% endfor %}

# Needed for filtering interfaces
{% if ntp_filter_interface %}
{% for item in ntp_interfaces %}
interface {{ item }}
{% endfor %}
{% endif %}

Copy link
Member

Choose a reason for hiding this comment

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

# Some comments
{% for item in ntp_interfaces %}
interface {{ item }}
{% endfor %}

# Needed for adding pool entries
restrict source notrap nomodify noquery

Expand Down