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

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 
主站蜘蛛池模板: 甘孜| 乌拉特后旗| 玉林市| 峨山| 卓尼县| 聂拉木县| 明光市| 沁水县| 普宁市| 金华市| 平利县| 固始县| 伊金霍洛旗| 宁河县| 永德县| 合肥市| 乌兰县| 大余县| 昭觉县| 曲沃县| 南康市| 河津市| 菏泽市| 昌乐县| 汨罗市| 名山县| 靖西县| 仙桃市| 德保县| 南安市| 吉林省| 成安县| 亚东县| 永宁县| 光山县| 运城市| 鄂托克前旗| 安国市| 宁乡县| 珲春市| 海宁市|