使用 RHEL 系统角色
安装 RHEL 系统角色软件包,并创建符合以下条件的 playbook
/home/greg/ansible/timesync.yml
:
在 所有受管节点
上运行
使用 timesync
角色
配置该角色,以使用当前有效的 NTP 提供商
配置该角色,以使用时间服务器 172.25.254.254
配置该角色,以启用 iburst
参数
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28
| [greg@control ansible]$ cat /usr/share/doc/rhel-system-roles/timesync/example-timesync-playbook.yml [greg@control ansible]$ vim /home/greg/ansible/timesync.yml --- - name: 使用 RHEL 系统角色(OLD) hosts: all vars: timesync_ntp_servers: - hostname: 172.25.254.254 iburst: yes roles: - rhel-system-roles.timesync [greg@control ansible]$ ansible-playbook timesync.yml [greg@control ansible]$ ansible all -a 'chronyc sources -v' node5 | CHANGED | rc=0 >> 210 Number of sources = 1
.-- Source mode '^' = server, '=' = peer, '#' = local clock. / .- Source state '*' = current synced, '+' = combined , '-' = not combined, | / '?' = unreachable, 'x' = time may be in error, '~' = time too variable. || .- xxxx [ yyyy ] +/- zzzz || Reachability register (octal) -. | xxxx = adjusted offset, || Log2(Polling interval) --. | | yyyy = measured offset, || \ | | zzzz = estimated error. || | | \ MS Name/IP address Stratum Poll Reach LastRx Last sample =============================================================================== ^* classroom.example.com 8 6 17 4 -82us[ -184us] +/- 751us ...
|