2018-11-04 02:38:22 +00:00
# Specific to Raspberry Pi
2018-02-13 02:04:25 +00:00
2021-07-28 02:36:07 +00:00
- 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)
2018-02-13 02:04:25 +00:00
template :
src : 92 -rtc-i2c.rules
dest : /etc/udev/rules.d/92-rtc-i2c.rules
2021-07-28 02:36:07 +00:00
#owner: root
#group: root
#mode: 0644
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)
2020-03-15 03:30:45 +00:00
- 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
2018-02-13 02:04:25 +00:00
lineinfile :
2018-11-04 02:38:22 +00:00
path : /boot/config.txt
2018-02-13 02:04:25 +00:00
line : "dtoverlay=i2c-rtc,{{ rtc_id }}=on"
state : present
2020-03-15 03:30:45 +00:00
when : rtc_id is defined and rtc_id != "none" and is_raspbian
2017-05-27 18:09:50 +00:00
2020-03-15 03:30:45 +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
2020-03-15 03:30:45 +00:00
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
2020-04-17 11:43:45 +00:00
#- 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
2020-03-15 11:14:54 +00:00
2021-07-31 22:01:17 +00:00
2021-07-27 21:47:52 +00:00
- name: '2021-07-27 : SEE ALSO ~4 networking packages LATER installed by https://github.com/iiab/iiab/blob/master/roles/2-common/tasks/packages.yml'
2021-07-27 18:54:20 +00:00
meta : noop
- name: '2021-07-27 : SEE ALSO 4-5 networking packages LATER installed by https://github.com/iiab/iiab/blob/master/roles/2-common/tasks/network.yml'
meta : noop
2021-07-27 21:47:52 +00:00
# 2021-07-27 explanation from @jvonau: The 3 BELOW (iw, rfkill, wireless-tools)
2022-03-15 14:24:30 +00:00
# are provided by RasPiOS. Ubuntu|Debian on the other hand are hit or miss:
2021-07-27 21:47:52 +00:00
# desktops might have some/all 3 preinstalled, while servers tend not to have
# these present at all, but are needed to be installed if you want to take full
# advantage of WiFi on Ubuntu and friends -- but it's only enforced on RPi
# hardware where we know in advance of the likelihood of WiFi being present.
2022-03-15 14:24:30 +00:00
# 2022-03-15: This section is effectively now useless on RasPiOS (but apparently
# serves a purpose on Ubuntu on RPi, where it installs dphys-swapfile and
# fake-hwclock). Still: @jvonau's above explanation of other OS's / other HW
# suggest this code should possibly move in future, to helps others too?
- name: 'Install packages : dphys-swapfile, fake-hwclock, iw, rfkill, wireless-tools'
2020-03-15 06:27:45 +00:00
package :
name :
2022-03-15 14:24:30 +00:00
- dphys-swapfile # 2021-03-15 : For Ubuntu on RPi? RasPiOS installs this regardless -- autogenerate and use a swap file
- fake-hwclock # 2021-03-15 : For Ubuntu on RPi? RasPiOS installs this regardless -- save/restore system clock on machines without working RTC hardware
- iw # 2021-07-27 : RasPiOS installs this regardless -- configure Linux wireless devices -- hard dependence for ap0 creation, SEE https://github.com/iiab/iiab/blob/master/roles/network/templates/hostapd/iiab-clone-wifi.service.j2
- rfkill # 2021-07-27 : RasPiOS installs this regardless -- enable & disable wireless devices
- wireless-tools # 2021-07-27 : RasPiOS installs this regardless -- manipulate Linux Wireless Extensions
2020-03-15 06:27:45 +00:00
state : present
2021-07-31 22:01:17 +00:00
2020-03-19 21:32:11 +00:00
- name : Increase swap file size (to CONF_SWAPSIZE={{ pi_swap_file_size }} in /etc/dphys-swapfile) as kalite pip download fails
2018-02-13 02:04:25 +00:00
lineinfile :
2018-11-04 02:38:22 +00:00
path : /etc/dphys-swapfile
2018-02-13 02:04:25 +00:00
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
2020-03-19 21:32:11 +00:00
- name : Restart swap service "dphys-swapfile"
2018-11-04 02:38:22 +00:00
#command: /etc/init.d/dphys-swapfile restart
2021-07-30 08:01:12 +00:00
systemd : # Had been...a rare/legacy service that was NOT systemd
2018-11-04 02:38:22 +00:00
name : dphys-swapfile
state : restarted