ntp_vm1.yml

 avatar
unknown
yaml
a year ago
859 B
25
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
  - debug:
       msg: "islnk isn't defined (path doesn't exist)"
    when: localtime.stat.islnk is not defined
  - debug:
       msg: "islnk is defined (path must exist)"
    when: localtime.stat.islnk is defined

  - debug:
       msg: "Path exists and is a symlink"
    when: localtime.stat.islnk is defined and localtime.stat.islnk

  - debug:
      msg: "Path exists and isn't a symlink"
    when: localtime.stat.islnk is defined and localtime.stat.islnk == False
Editor is loading...
Leave a Comment