Compare commits
2 Commits
205b780ace
...
607a9374db
Author | SHA1 | Date | |
---|---|---|---|
607a9374db | |||
e6060ff9bc |
1
roles/i2c-clock/files/etc/modules-load.d/rtc-ds1307.conf
Normal file
1
roles/i2c-clock/files/etc/modules-load.d/rtc-ds1307.conf
Normal file
@ -0,0 +1 @@
|
|||||||
|
rtc-ds1307
|
20
roles/i2c-clock/files/etc/systemd/system/rtc-i2c.service
Normal file
20
roles/i2c-clock/files/etc/systemd/system/rtc-i2c.service
Normal file
@ -0,0 +1,20 @@
|
|||||||
|
[Unit]
|
||||||
|
ConditionCapability=CAP_SYS_TIME
|
||||||
|
ConditionVirtualization=!container
|
||||||
|
DefaultDependencies=no
|
||||||
|
Wants=dev-rtc_i2c.device
|
||||||
|
After=dev-rtc_i2c.device
|
||||||
|
Before=systemd-timesyncd.service ntpd.service chrony.service
|
||||||
|
|
||||||
|
[Service]
|
||||||
|
Type=oneshot
|
||||||
|
CapabilityBoundingSet=CAP_SYS_TIME
|
||||||
|
PrivateTmp=yes
|
||||||
|
ProtectSystem=full
|
||||||
|
ProtectHome=yes
|
||||||
|
DeviceAllow=/dev/rtc_i2c rw
|
||||||
|
DevicePolicy=closed
|
||||||
|
ExecStart=/usr/bin/echo ds1307 0x68 > /sys/class/i2c-adapter/i2c-1/new_device && /sbin/hwclock --s
|
||||||
|
|
||||||
|
[Install]
|
||||||
|
WantedBy=time-sync.target
|
6
roles/i2c-clock/files/etc/udev/rules.d/55-rtc-i2c.rules
Normal file
6
roles/i2c-clock/files/etc/udev/rules.d/55-rtc-i2c.rules
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
#/lib/udev/rules.d/50-udev-default.rules:SUBSYSTEM=="rtc", ATTR{hctosys}=="1", SYMLINK+="rtc"
|
||||||
|
#/lib/udev/rules.d/50-udev-default.rules:SUBSYSTEM=="rtc", KERNEL=="rtc0", SYMLINK+="rtc", OPTIONS+="link_priority=-100"
|
||||||
|
|
||||||
|
# I2C RTC, when added and not the source of the sys clock (kernel), is used ;
|
||||||
|
# separate name to ensure rtc-i2c.service will not be run on anything else
|
||||||
|
ACTION=="add", SUBSYSTEMS=="i2c", SUBSYSTEM=="rtc", KERNEL=="rtc0", ATTR{hctosys}=="0", SYMLINK+="rtc_i2c", TAG+="systemd"
|
25
roles/i2c-clock/tasks/install.yml
Normal file
25
roles/i2c-clock/tasks/install.yml
Normal file
@ -0,0 +1,25 @@
|
|||||||
|
---
|
||||||
|
- become: yes
|
||||||
|
block:
|
||||||
|
- name: install i2c-tools
|
||||||
|
become: yes
|
||||||
|
apt:
|
||||||
|
update_cache: yes
|
||||||
|
pkg:
|
||||||
|
- i2c-tools
|
||||||
|
|
||||||
|
- name: enable automatic module load
|
||||||
|
copy:
|
||||||
|
src: etc/modules-load.d/rtc-ds1307.conf
|
||||||
|
dest: /etc/modules-load.d/rtc-ds1307.conf
|
||||||
|
|
||||||
|
- name: add systemd service
|
||||||
|
copy:
|
||||||
|
src: etc/systemd/system/rtc-i2c.service
|
||||||
|
dest: /etc/systemd/system/rtc-i2c.service
|
||||||
|
|
||||||
|
- name: enable systemd service
|
||||||
|
systemd:
|
||||||
|
name: rtc-i2c.service
|
||||||
|
enabled: yes
|
||||||
|
state: started
|
6
roles/i2c-clock/tasks/main.yml
Normal file
6
roles/i2c-clock/tasks/main.yml
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
---
|
||||||
|
- import_tasks: install.yml
|
||||||
|
|
||||||
|
- import_tasks: set-time.yml
|
||||||
|
|
||||||
|
- import_tasks: remove-fake-clock.yml
|
8
roles/i2c-clock/tasks/remove-fake-clock.yml
Normal file
8
roles/i2c-clock/tasks/remove-fake-clock.yml
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
---
|
||||||
|
- name: uninstall fakehw
|
||||||
|
become: yes
|
||||||
|
apt:
|
||||||
|
update_cache: yes
|
||||||
|
state: absent
|
||||||
|
pkg:
|
||||||
|
- fake-hwclock
|
16
roles/i2c-clock/tasks/set-time.yml
Normal file
16
roles/i2c-clock/tasks/set-time.yml
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
---
|
||||||
|
- become: yes
|
||||||
|
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
|
@ -52,7 +52,7 @@
|
|||||||
- https://github.com/jneilliii/OctoPrint-PrusaSlicerThumbnails/archive/master.zip
|
- https://github.com/jneilliii/OctoPrint-PrusaSlicerThumbnails/archive/master.zip
|
||||||
- https://github.com/juniorRubyist/OctoPrint-OctoFlat/archive/master.zip
|
- https://github.com/juniorRubyist/OctoPrint-OctoFlat/archive/master.zip
|
||||||
- https://github.com/kanocz/octopi_eta_override/archive/master.zip
|
- https://github.com/kanocz/octopi_eta_override/archive/master.zip
|
||||||
- https://github.com/OllisGit/OctoPrint-FilamentManager/releases/latest/download/master.zip
|
- https://github.com/OllisGit/OctoPrint-SpoolManager/releases/latest/download/master.zip
|
||||||
- https://github.com/OllisGit/OctoPrint-DeleteAfterPrint/releases/latest/download/master.zip
|
- https://github.com/OllisGit/OctoPrint-DeleteAfterPrint/releases/latest/download/master.zip
|
||||||
# - https://github.com/OllisGit/OctoPrint-PrintJobHistory/releases/latest/download/master.zip
|
# - https://github.com/OllisGit/OctoPrint-PrintJobHistory/releases/latest/download/master.zip
|
||||||
- https://github.com/paukstelis/OctoPrint-Cancelobject/archive/master.zip
|
- https://github.com/paukstelis/OctoPrint-Cancelobject/archive/master.zip
|
||||||
|
@ -9,8 +9,8 @@ HOSTS=(
|
|||||||
OUTLET_IP=192.168.60.14
|
OUTLET_IP=192.168.60.14
|
||||||
|
|
||||||
PING_TIMEOUT=5
|
PING_TIMEOUT=5
|
||||||
SOFT_WAIT_TIME=30
|
SOFT_WAIT_TIME=60
|
||||||
DHCP_WAIT_TIME=30
|
DHCP_WAIT_TIME=60
|
||||||
MODEM_RESET_WAIT_TIME=60
|
MODEM_RESET_WAIT_TIME=60
|
||||||
|
|
||||||
PING="/bin/ping -c 1 -W ${PING_TIMEOUT} -w ${PING_TIMEOUT}"
|
PING="/bin/ping -c 1 -W ${PING_TIMEOUT} -w ${PING_TIMEOUT}"
|
||||||
|
Loading…
Reference in New Issue
Block a user