ntp_vm1.yml

 avatar
unknown
yaml
a year ago
758 B
18
Indexable
---

- hosts:
  - vm1
  tasks:
  - name: "Install NTP-client"
    apt:
       pkg: [ "ntpdate", "tzdata" ]
    become: yes
  - name: "Add NTP-client to crontab"
    cron:
       name: "NTP-Client"
       hour: "*/1"
       job: "/usr/sbin/ntpdate pool.ntp.org"
       user: root
    become: yes
  - stat:
       path: /etc/localtime
    register: localtime
  - name: If /etc/localtime not symlink - delete this
    file:
       path: "/etc/localtime"
       state: absent
    when: localtime.stat.islnk is defined and localtime.stat.islnk == False
    become: yes
  - name: Set Timezone to Europe/Moscow
    file:
       dest: "/etc/localtime"
       src: "/usr/share/zoneinfo/Europe/Moscow"
       state: link
    become: yes
Editor is loading...
Leave a Comment