adamus1red.ansible_role_ntp
Ansible 角色:NTP
在 Linux 上安装 NTP。
需求
无。
角色变量
可用变量如下所示,及其默认值(请参见 defaults/main.yml
):
ntp_enabled: true
是否启动 ntpd 服务并在系统启动时启用它。在许多运行在容器内的虚拟机(如 OpenVZ 或 VirtualBox)上,建议不要运行 NTP 守护程序,因为主机本身应该为所有子虚拟机同步时间。
ntp_timezone: Etc/UTC
设置服务器的时区。
ntp_manage_config: false
设置为 true 以允许该角色管理 NTP 配置文件(/etc/ntp.conf
)。
ntp_area: ''
设置要使用的 NTP 池区域。默认值为无,这意味着使用全球池。
ntp_servers:
- "0{{ '.' + ntp_area if ntp_area else '' }}.pool.ntp.org iburst"
- "1{{ '.' + ntp_area if ntp_area else '' }}.pool.ntp.org iburst"
- "2{{ '.' + ntp_area if ntp_area else '' }}.pool.ntp.org iburst"
- "3{{ '.' + ntp_area if ntp_area else '' }}.pool.ntp.org iburst"
指定要使用的 NTP 服务器。只有当您允许该角色管理 NTP 配置,将 ntp_manage_config
设置为 True
时,才会生效。
ntp_restrict:
- "127.0.0.1"
- "::1"
默认情况下,仅限制 NTP 访问这些主机;即环回地址。
依赖项
无。
示例剧本
- hosts: all
roles:
- geerlingguy.ntp
在 vars/main.yml
中:
ntp_timezone: America/Chicago
许可协议
MIT / BSD
作者信息
该角色由 Jeff Geerling 于 2014 年创建,他是 Ansible for DevOps 的作者。