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

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 
主站蜘蛛池模板: 北碚区| 普陀区| 安西县| 唐山市| 长泰县| 黎城县| 务川| 永嘉县| 长治市| 香格里拉县| 庄浪县| 丹阳市| 合水县| 云和县| 万州区| 禄劝| 梁平县| 永吉县| 德江县| 霍山县| 离岛区| 四平市| 淅川县| 博客| 太仓市| 旺苍县| 汽车| 如皋市| 城口县| 赤峰市| 武平县| 盐城市| 敦化市| 思南县| 同心县| 特克斯县| 延吉市| 寻甸| 乡城县| 锦屏县| 千阳县|