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

win_ntp module required to configure NTP #114

Open
Udayendu opened this issue Jul 16, 2020 · 5 comments
Open

win_ntp module required to configure NTP #114

Udayendu opened this issue Jul 16, 2020 · 5 comments

Comments

@Udayendu
Copy link

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.

@Udayendu
Copy link
Author

  • 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.

@mwtrigg
Copy link

mwtrigg commented Jul 28, 2020

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

@Udayendu
Copy link
Author

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.

@suyeb786
Copy link

suyeb786 commented Sep 9, 2020

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.

@Udayendu
Copy link
Author

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants