community.windows
community.windows copied to clipboard
win_ntp module required to configure NTP
SUMMARY
Currently there is no ntp module to configure NTP client. Its good to have a win_ntp module that can take multiple NTP server IP/FQDN and configure in the windows system.
ISSUE TYPE
- Feature Idea
COMPONENT NAME
win_ntp
ADDITIONAL INFORMATION
Currently only win_timezone module is available related to timezone change. But its having no option to configure the NTP as well. Hence either enhance this module with ntp configuration or make a new module win_ntp
for ntp configuration.
- I am using the following option to use the win_shell module to push the powershell commands which is working fine:
- name: NTP Client Configuration
win_shell: |
w32tm /config /manualpeerlist:"{{ ntp_server_01 }}" /syncfromflags:MANUAL
w32tm /config /manualpeerlist:"{{ ntp_server_02 }}" /syncfromflags:MANUAL
Stop-Service w32time
Start-Service w32time
- The new module allow atleast 2 NTP servers to add to the windows guest.
Since there are so many additional settings besides just the name or address of an NTP server, I would imagine that if there were to be such a module, it would allow configuration of all pertinent NTP settings: https://docs.microsoft.com/en-us/windows-server/networking/windows-time-service/windows-time-service-tools-and-settings#reference-windows-time-service-registry-entries.
I currently achieve this will a role containing a dozen or so plays using win_regedit; this allows it to be idempotent and only restarts the service if there is a change to this (or any of the other) keys.
- name: "[W32Time Parameters] Configure NTP Server Name"
win_regedit:
path: HKLM:\SYSTEM\CurrentControlSet\Services\W32Time\Parameters
name: 'NtpServer'
data: 'ntp.domain.com,0x8'
type: string
notify: restart w32time service
Since there are so many additional settings besides just the name or address of an NTP server, I would imagine that if there were to be such a module, it would allow configuration of all pertinent NTP settings: https://docs.microsoft.com/en-us/windows-server/networking/windows-time-service/windows-time-service-tools-and-settings#reference-windows-time-service-registry-entries.
I currently achieve this will a role containing a dozen or so plays using win_regedit; this allows it to be idempotent and only restarts the service if there is a change to this (or any of the other) keys.
- name: "[W32Time Parameters] Configure NTP Server Name" win_regedit: path: HKLM:\SYSTEM\CurrentControlSet\Services\W32Time\Parameters name: 'NtpServer' data: 'ntp.domain.com,0x8' type: string notify: restart w32time service
If no specific NTP module then I will prefer to use the win_shell module where its simple to implement and can add multiple entries easily. Using minimal use of win_regedit is good.
Hello @Udayendu @mwtrigg,
@sakar97 and I have forked the branch and started working on it and posting this for your solicit feedback and comments and to make sure no one else is already working on it.
Hello @Udayendu @mwtrigg,
@sakar97 and I have forked the branch and started working on it and posting this for your solicit feedback and comments and to make sure no one else is already working on it.
I think that would ne nice. Once done, let me know.