2021-01-25 18:50:37 +00:00
|
|
|
---
|
2021-07-01 17:44:41 +00:00
|
|
|
- name: Check if rtc is loaded
|
|
|
|
stat:
|
|
|
|
path: /dev/rtc
|
|
|
|
register: rtc_file
|
|
|
|
|
2021-01-25 18:50:37 +00:00
|
|
|
- become: yes
|
2021-07-01 17:44:41 +00:00
|
|
|
when: rtc_file.stat.exists == False
|
2021-01-25 18:50:37 +00:00
|
|
|
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
|