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

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 
主站蜘蛛池模板: 霍山县| 香港| 温州市| 合江县| 鞍山市| 九台市| 宿迁市| 厦门市| 商都县| 潜江市| 湘乡市| 宜良县| 左云县| 车险| 叙永县| 铜鼓县| 卫辉市| 贵定县| 塔河县| 会东县| 长垣县| 华安县| 筠连县| 安平县| 嵊泗县| 宜丰县| 湟源县| 那曲县| 塔城市| 榆林市| 舞阳县| 秦皇岛市| 闻喜县| 海原县| 蒙山县| 石台县| 扎囊县| 金寨县| 丰原市| 绥德县| 长海县|