๐Ÿ“— Ansible playbooks and roles for building an idempotent, interconnected and scalable infrastructure
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
ansible-playbooks/roles/workstation/tasks/win_ntp.yml

34 lines
891 B

- name: check if there is an entry for W32Time service
win_reg_stat:
path: HKLM:\SYSTEM\CurrentControlSet\Services\W32Time
register: w32time_exists
- name: fail if W32Time is missing
fail:
msg: W32Time registry key is missing, aborting
when: w32time_exists.exists == false
- name: ensure NTP is enabled
win_regedit:
path: HKLM:\SYSTEM\CurrentControlSet\Services\W32Time\TimeProviders\NtpClient
name: Enabled
type: dword
data: 1
- name: ensure NTP client is set to NTP mode
win_regedit:
path: HKLM:\SYSTEM\CurrentControlSet\Services\W32Time\Parameters
name: Type
type: string
data: NTP
- name: set NTP server address
win_regedit:
path: HKLM:\SYSTEM\CurrentControlSet\Services\W32Time\Parameters
name: NtpServer
type: string
data: "{{ services.ntp.hostname if services.ntp is mapping else 'ru.pool.ntp.org' }},0x8"