1
0
Fork 0
mirror of https://github.com/iiab/iiab.git synced 2025-02-13 03:32:12 +00:00
iiab/roles/1-prep/tasks/raspberry_pi.yml

51 lines
2.2 KiB
YAML
Raw Normal View History

2018-11-04 02:38:22 +00:00
# Specific to Raspberry Pi
- name: Install udev rule /etc/udev/rules.d/92-rtc-i2c.rules from template, to transfer hwclock to system clock at dev creation, if rtc_id is defined and rtc_id != "none" (root:root, 0644 by default)
template:
src: 92-rtc-i2c.rules
dest: /etc/udev/rules.d/92-rtc-i2c.rules
2017-05-27 18:09:50 +00:00
when: rtc_id is defined and rtc_id != "none"
# RTC requires a change to the device tree (and reboot)
- name: Enable i2c-rtc device (with "dtoverlay=i2c-rtc,{{ rtc_id }}=on" in /boot/config.txt, requires reboot!) if rtc_id is defined and rtc_id != "none" and is_raspbian
lineinfile:
2018-11-04 02:38:22 +00:00
path: /boot/config.txt
line: "dtoverlay=i2c-rtc,{{ rtc_id }}=on"
state: present
when: rtc_id is defined and rtc_id != "none" and is_raspbian
2017-05-27 18:09:50 +00:00
- name: Enable i2c-rtc device (with "dtoverlay=i2c-rtc,{{ rtc_id }}=on" in /boot/firmware/config.txt, requires reboot!) if rtc_id is defined and rtc_id != "none" and is_ubuntu
lineinfile:
2020-03-15 06:54:57 +00:00
path: /boot/firmware/usercfg.txt
line: "dtoverlay=i2c-rtc,{{ rtc_id }}=on"
state: present
2021-07-27 19:30:38 +00:00
when: rtc_id is defined and rtc_id != "none" and is_ubuntu # CLARIF: Ubuntu runs increasingly well on RPi hardware, starting in 2020 especially
2017-05-27 18:09:50 +00:00
2021-07-27 18:54:20 +00:00
- name: 'Install packages: fake-hwclock, dphys-swapfile'
package:
name:
- fake-hwclock # 2021-03-15: Missing on Ubuntu etc. RasPiOS installs this regardless -- to save/restore system clock on machines w/o working RTC (above).
- dphys-swapfile # 2021-03-15: Missing on Ubuntu etc. RasPiOS installs this regardless -- to autogenerate and use a swap file (below).
state: present
- name: Increase swap file size (to CONF_SWAPSIZE={{ pi_swap_file_size }} in /etc/dphys-swapfile) as kalite pip download fails
lineinfile:
2018-11-04 02:38:22 +00:00
path: /etc/dphys-swapfile
regexp: "^CONF_SWAPSIZE"
2019-08-13 20:20:24 +00:00
line: "CONF_SWAPSIZE={{ pi_swap_file_size }}"
2017-05-27 18:09:50 +00:00
- name: Restart swap service "dphys-swapfile"
2018-11-04 02:38:22 +00:00
#command: /etc/init.d/dphys-swapfile restart
systemd: # Had been...a rare/legacy service that was NOT systemd
2018-11-04 02:38:22 +00:00
name: dphys-swapfile
state: restarted
#- name: Enable bluetooth in /boot/firmware/syscfg.txt on Ubuntu (needs reboot)
# lineinfile:
# path: /boot/firmware/syscfg.txt
# regexp: '^include*'
# line: 'include btcfg.txt'
# when: is_ubuntu