Files
ansible-worker/files/ansible-playbooks/setntptime.yml
ansible user 110301f862 first commit
2025-10-22 14:11:49 +02:00

40 lines
869 B
YAML

---
- name: Simple script to show current version
hosts: all
gather_facts: no
tasks:
- name: get the date
ansible.builtin.raw: |
set -e
PATH=/sbin:/usr/sbin:/bin:/usr/bin:$PATH
date
register: date_out
changed_when: true
- name: show the current date
ansible.builtin.debug:
msg: "{{ date_out.stdout | trim }}"
- name: use sntp -S to set system time
ansible.builtin.raw: |
set -e
PATH=/sbin:/usr/sbin:/bin:/usr/bin:$PATH
sntp -S time.ikeja.co.za
changed_when: true
- name: get the date
ansible.builtin.raw: |
set -e
PATH=/sbin:/usr/sbin:/bin:/usr/bin:$PATH
date
register: date_out
changed_when: true
- name: show the current date
ansible.builtin.debug:
msg: "{{ date_out.stdout | trim }}"