ansible/roles/i2c-clock/tasks/set-time.yml
2021-07-01 19:59:40 +02:00

22 lines
440 B
YAML

---
- name: Check if rtc is loaded
stat:
path: /dev/rtc
register: rtc_file
- become: yes
when: rtc_file.stat.exists == False
block:
- name: load hwclock
shell:
cmd: |
modprobe rtc-ds1307
echo ds1307 0x68 > /sys/class/i2c-adapter/i2c-1/new_device
- name: update time
shell:
cmd: |
hwclock -w
- name: read time
shell:
cmd: |
hwclock -r