Skip to content

Commit

Permalink
ntp: add config to filter and set ntp interfaces (#11066)
Browse files Browse the repository at this point in the history
* ntp: add config to set which interface ntp should listen

* Fixed config to only have one variable
  • Loading branch information
Pavan-Gunda committed Apr 25, 2024
1 parent cd7d11f commit 538deff
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 0 deletions.
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
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 %}

# Needed for adding pool entries
restrict source notrap nomodify noquery

Expand Down

0 comments on commit 538deff

Please sign in to comment.