官术网_书友最值得收藏!

Ensuring that NTP is installed, configured, and running

To make sure NTP is present, we use the yum module:

- name: Ensure NTP is installed 
  yum: 
    name: ntp 
    state: present 
  become: True

Now that we know that NTP is installed, we should ensure that the server is using the timezone that we want. To do so, we will create a symbolic link in /etc/localtime that will point to the wanted zoneinfo file:

- name: Ensure the timezone is set to UTC 
  file: 
    src: /usr/share/zoneinfo/GMT 
    dest: /etc/localtime 
    state: link 
  become: True 

As you can see, we have used the file module, specifying that it needs to be a link (state: link).

To complete the NTP configuration, we need to start the ntpd service and ensure that it will run at every consequent boot:

- name: Ensure the NTP service is running and enabled 
  service: 
    name: ntpd 
    state: started 
    enabled: True 
  become: True 
主站蜘蛛池模板: 竹溪县| 本溪| 日喀则市| 延寿县| 沿河| 尼木县| 得荣县| 新余市| 铜山县| 新闻| 阳江市| 安吉县| 斗六市| 宁河县| 广水市| 成安县| 南昌县| 太白县| 柳州市| 万源市| 泽库县| 仪征市| 高唐县| 凤翔县| 民丰县| 桦南县| 平和县| 重庆市| 潍坊市| 岐山县| 白银市| 乌鲁木齐县| 盘锦市| 苏尼特左旗| 江源县| 宁城县| 河北区| 万盛区| 鹰潭市| 迁西县| 山西省|