From 240caf5ff964f3416b07ac4361cc281fee8ac9d6 Mon Sep 17 00:00:00 2001 From: nicomiguelino Date: Mon, 23 Oct 2023 11:08:14 -0700 Subject: [PATCH 01/49] fix: Add temporary code for testing the installer script. --- bin/install.sh | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/bin/install.sh b/bin/install.sh index 9a5f50014..b041e0b5c 100755 --- a/bin/install.sh +++ b/bin/install.sh @@ -184,6 +184,11 @@ sudo pip install cryptography==38.0.2 sudo pip install "$ANSIBLE_VERSION" +# nico start - todo: remove after testing +export REPOSITORY='https://github.com/nicomiguelino/Anthias.git' +export BRANCH=${CUSTOM_BRANCH} +# nico end + sudo -u ${USER} ansible localhost \ -m git \ -a "repo=$REPOSITORY dest=/home/${USER}/screenly version=$BRANCH force=no" @@ -191,6 +196,12 @@ cd /home/${USER}/screenly/ansible sudo -E -u ${USER} ansible-playbook site.yml "${EXTRA_ARGS[@]}" +# nico start - todo: remove after testing +if [[ ! -z "$EARLY_EXIT" ]]; then + exit 0 +fi +# nico end + # Pull down and install containers sudo -u ${USER} /home/${USER}/screenly/bin/upgrade_containers.sh From 75063e03ce43772d5a6f97859aaec081d7d095bf Mon Sep 17 00:00:00 2001 From: nicomiguelino Date: Mon, 23 Oct 2023 11:19:00 -0700 Subject: [PATCH 02/49] fix: Try not installing the `cryptography` installer. --- bin/install.sh | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/bin/install.sh b/bin/install.sh index b041e0b5c..c77e5a44f 100755 --- a/bin/install.sh +++ b/bin/install.sh @@ -180,7 +180,9 @@ fi # @TODO # Remove me later. Cryptography 38.0.3 won't build at the moment. # See https://github.com/screenly/anthias/issues/1654 -sudo pip install cryptography==38.0.2 +# nico start - todo: run this on Bullseye, but not on Bookworm +# sudo pip install cryptography==38.0.2 +# nico end sudo pip install "$ANSIBLE_VERSION" From 25bcf5e3abed8c82014c2c4f3f0eec70cce773e6 Mon Sep 17 00:00:00 2001 From: nicomiguelino Date: Mon, 23 Oct 2023 12:22:10 -0700 Subject: [PATCH 03/49] fix: Use the `--break-system-packages` flag as a workaround. --- bin/install.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/bin/install.sh b/bin/install.sh index c77e5a44f..9d12792c1 100755 --- a/bin/install.sh +++ b/bin/install.sh @@ -181,10 +181,10 @@ fi # Remove me later. Cryptography 38.0.3 won't build at the moment. # See https://github.com/screenly/anthias/issues/1654 # nico start - todo: run this on Bullseye, but not on Bookworm -# sudo pip install cryptography==38.0.2 +sudo pip install cryptography==38.0.2 --break-system-packages # nico end -sudo pip install "$ANSIBLE_VERSION" +sudo pip install "$ANSIBLE_VERSION" --break-system-packages # nico start - todo: remove after testing export REPOSITORY='https://github.com/nicomiguelino/Anthias.git' From 6f7672c0fef095c8daf8c6d6d85c79d94bdb5509 Mon Sep 17 00:00:00 2001 From: nicomiguelino Date: Mon, 23 Oct 2023 12:40:01 -0700 Subject: [PATCH 04/49] fix: Use the `--break-system-packages` flag in Ansible script. --- ansible/roles/system/tasks/main.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/ansible/roles/system/tasks/main.yml b/ansible/roles/system/tasks/main.yml index 7640ac0ae..c4dbef336 100644 --- a/ansible/roles/system/tasks/main.yml +++ b/ansible/roles/system/tasks/main.yml @@ -268,6 +268,7 @@ ansible.builtin.pip: name: supervisor state: absent + extra_args: --break-system-packages - name: Copy in rc.local ansible.builtin.copy: From c3d4adb4711873ef0fdb5ac290f3899944f9a305 Mon Sep 17 00:00:00 2001 From: nicomiguelino Date: Mon, 23 Oct 2023 15:39:40 -0700 Subject: [PATCH 05/49] fix: Use the `--break-system-packages` flag in Ansible script. --- ansible/roles/screenly/tasks/main.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ansible/roles/screenly/tasks/main.yml b/ansible/roles/screenly/tasks/main.yml index 6124eb3cc..04c9486c7 100644 --- a/ansible/roles/screenly/tasks/main.yml +++ b/ansible/roles/screenly/tasks/main.yml @@ -29,7 +29,7 @@ - name: Install pip dependencies ansible.builtin.pip: requirements: "/home/{{ lookup('env', 'USER') }}/screenly/requirements/requirements.host.txt" - extra_args: "--no-cache-dir --upgrade" + extra_args: "--no-cache-dir --upgrade --break-system-packages" - name: Remove screenly_utils.sh ansible.builtin.file: From a43cddf339185e1969e540c7513fe4b703352a19 Mon Sep 17 00:00:00 2001 From: nicomiguelino Date: Tue, 24 Oct 2023 10:01:10 -0700 Subject: [PATCH 06/49] fix: Check if the service `dhcpcd` exists before disabling it. --- ansible/roles/network/tasks/main.yml | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/ansible/roles/network/tasks/main.yml b/ansible/roles/network/tasks/main.yml index 1e2988d00..c63a5e2d3 100644 --- a/ansible/roles/network/tasks/main.yml +++ b/ansible/roles/network/tasks/main.yml @@ -82,6 +82,13 @@ ansible.builtin.command: cp -f /var/lib/polkit-1/localauthority/10-vendor.d/org.freedesktop.NetworkManager.pkla /etc/polkit-1/localauthority/50-local.d when: manage_network|bool +# nico start - new task for checking if the service exists +- name: Check if the dhcpcd service exists + ansible.builtin.shell: systemctl list-units --type=service | grep 'dhcpcd' + register: dhcpcd_service_exists + ignore_errors: true +# nico end + - name: Disable dhcpcd ansible.builtin.systemd: state: stopped @@ -90,6 +97,9 @@ when: - ansible_distribution_major_version|int >= 9 - manage_network|bool + # nico start - todo: remove this condition if it's not working + - dhcpcd_service_exists.rc == 0 + # nico end - name: Activate NetworkManager ansible.builtin.systemd: From a6301f7d6e55fbcb2a02920bd28788e27bf7fe01 Mon Sep 17 00:00:00 2001 From: nicomiguelino Date: Tue, 24 Oct 2023 12:02:08 -0700 Subject: [PATCH 07/49] fix: Install other plymouth dependencies. --- ansible/roles/splashscreen/tasks/main.yml | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/ansible/roles/splashscreen/tasks/main.yml b/ansible/roles/splashscreen/tasks/main.yml index 95e6fb39f..388c3fe4d 100644 --- a/ansible/roles/splashscreen/tasks/main.yml +++ b/ansible/roles/splashscreen/tasks/main.yml @@ -44,7 +44,12 @@ - name: Installs dependencies (not Jessie) ansible.builtin.apt: - name: plymouth + name: + - plymouth + # nico start + - plymouth-themes + - plymouth-label + # nico end when: ansible_distribution_major_version|int > 7 - name: Copies plymouth theme From f4b0d7e4d5664aeaa8645fe9238d8828cd48d34c Mon Sep 17 00:00:00 2001 From: nicomiguelino Date: Tue, 24 Oct 2023 13:19:09 -0700 Subject: [PATCH 08/49] workaround: Comment out all `splashscreen` tasks in the meantime. --- ansible/roles/splashscreen/tasks/main.yml | 2 +- ansible/site.yml | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/ansible/roles/splashscreen/tasks/main.yml b/ansible/roles/splashscreen/tasks/main.yml index 388c3fe4d..1c9e40544 100644 --- a/ansible/roles/splashscreen/tasks/main.yml +++ b/ansible/roles/splashscreen/tasks/main.yml @@ -38,7 +38,7 @@ - /etc/init.d/asplashscreen when: ansible_distribution_major_version|int > 7 -- name: Disable asplashscreen +- name: Disable splashscreen ansible.builtin.command: update-rc.d asplashscreen remove when: ansible_distribution_major_version|int > 7 diff --git a/ansible/site.yml b/ansible/site.yml index 1e542f959..fd373b883 100644 --- a/ansible/site.yml +++ b/ansible/site.yml @@ -11,5 +11,7 @@ - system - screenly - network - - splashscreen + # nico start - todo: uncomment when ready + # - splashscreen + # nico end - tools From 7b9a5a4dceb3d3264f85554e871dfd7bad67cb23 Mon Sep 17 00:00:00 2001 From: nicomiguelino Date: Tue, 24 Oct 2023 21:14:51 -0700 Subject: [PATCH 09/49] style: Remove personal comments. --- ansible/roles/network/tasks/main.yml | 4 ---- ansible/roles/splashscreen/tasks/main.yml | 2 -- ansible/site.yml | 4 +--- bin/install.sh | 11 +---------- 4 files changed, 2 insertions(+), 19 deletions(-) diff --git a/ansible/roles/network/tasks/main.yml b/ansible/roles/network/tasks/main.yml index c63a5e2d3..94c5ed719 100644 --- a/ansible/roles/network/tasks/main.yml +++ b/ansible/roles/network/tasks/main.yml @@ -82,12 +82,10 @@ ansible.builtin.command: cp -f /var/lib/polkit-1/localauthority/10-vendor.d/org.freedesktop.NetworkManager.pkla /etc/polkit-1/localauthority/50-local.d when: manage_network|bool -# nico start - new task for checking if the service exists - name: Check if the dhcpcd service exists ansible.builtin.shell: systemctl list-units --type=service | grep 'dhcpcd' register: dhcpcd_service_exists ignore_errors: true -# nico end - name: Disable dhcpcd ansible.builtin.systemd: @@ -97,9 +95,7 @@ when: - ansible_distribution_major_version|int >= 9 - manage_network|bool - # nico start - todo: remove this condition if it's not working - dhcpcd_service_exists.rc == 0 - # nico end - name: Activate NetworkManager ansible.builtin.systemd: diff --git a/ansible/roles/splashscreen/tasks/main.yml b/ansible/roles/splashscreen/tasks/main.yml index 1c9e40544..fe280db7d 100644 --- a/ansible/roles/splashscreen/tasks/main.yml +++ b/ansible/roles/splashscreen/tasks/main.yml @@ -46,10 +46,8 @@ ansible.builtin.apt: name: - plymouth - # nico start - plymouth-themes - plymouth-label - # nico end when: ansible_distribution_major_version|int > 7 - name: Copies plymouth theme diff --git a/ansible/site.yml b/ansible/site.yml index fd373b883..1e542f959 100644 --- a/ansible/site.yml +++ b/ansible/site.yml @@ -11,7 +11,5 @@ - system - screenly - network - # nico start - todo: uncomment when ready - # - splashscreen - # nico end + - splashscreen - tools diff --git a/bin/install.sh b/bin/install.sh index 9d12792c1..8fe34c412 100755 --- a/bin/install.sh +++ b/bin/install.sh @@ -180,16 +180,13 @@ fi # @TODO # Remove me later. Cryptography 38.0.3 won't build at the moment. # See https://github.com/screenly/anthias/issues/1654 -# nico start - todo: run this on Bullseye, but not on Bookworm sudo pip install cryptography==38.0.2 --break-system-packages -# nico end sudo pip install "$ANSIBLE_VERSION" --break-system-packages -# nico start - todo: remove after testing +# @TODO: Remove two lines below after testing. export REPOSITORY='https://github.com/nicomiguelino/Anthias.git' export BRANCH=${CUSTOM_BRANCH} -# nico end sudo -u ${USER} ansible localhost \ -m git \ @@ -198,12 +195,6 @@ cd /home/${USER}/screenly/ansible sudo -E -u ${USER} ansible-playbook site.yml "${EXTRA_ARGS[@]}" -# nico start - todo: remove after testing -if [[ ! -z "$EARLY_EXIT" ]]; then - exit 0 -fi -# nico end - # Pull down and install containers sudo -u ${USER} /home/${USER}/screenly/bin/upgrade_containers.sh From ca04fd6010c51cf2e3cc5ec56387061ee2c33597 Mon Sep 17 00:00:00 2001 From: nicomiguelino Date: Wed, 25 Oct 2023 09:23:55 -0700 Subject: [PATCH 10/49] workaround: Comment out the `splashscreen` first. --- ansible/site.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ansible/site.yml b/ansible/site.yml index 1e542f959..0aeef45ad 100644 --- a/ansible/site.yml +++ b/ansible/site.yml @@ -11,5 +11,5 @@ - system - screenly - network - - splashscreen + # - splashscreen # TODO NICO: Uncomment later. - tools From afad3e6ec350ff23e7c871904dbc41c9c764f9f6 Mon Sep 17 00:00:00 2001 From: nicomiguelino Date: Wed, 25 Oct 2023 10:53:02 -0700 Subject: [PATCH 11/49] fix: Uncomment the `splashscreen` role. --- ansible/site.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ansible/site.yml b/ansible/site.yml index 0aeef45ad..1e542f959 100644 --- a/ansible/site.yml +++ b/ansible/site.yml @@ -11,5 +11,5 @@ - system - screenly - network - # - splashscreen # TODO NICO: Uncomment later. + - splashscreen - tools From d63e206becbf65cf3a39661ba8d09d9fe9a60147 Mon Sep 17 00:00:00 2001 From: nicomiguelino Date: Wed, 25 Oct 2023 16:51:10 -0700 Subject: [PATCH 12/49] workaround: Disable all but the `system` Ansible role. --- ansible/site.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/ansible/site.yml b/ansible/site.yml index 1e542f959..bbbdde8d3 100644 --- a/ansible/site.yml +++ b/ansible/site.yml @@ -9,7 +9,7 @@ roles: - system - - screenly - - network - - splashscreen - - tools + # - screenly + # - network + # - splashscreen + # - tools From e2e0454cfa01d67a06b5c87501cf03252143381a Mon Sep 17 00:00:00 2001 From: nicomiguelino Date: Wed, 25 Oct 2023 17:57:12 -0700 Subject: [PATCH 13/49] Workaround: Disable the `system` Ansible role as well. - Let's see what happens. --- ansible/site.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ansible/site.yml b/ansible/site.yml index bbbdde8d3..e32a5f565 100644 --- a/ansible/site.yml +++ b/ansible/site.yml @@ -8,7 +8,7 @@ device_type: "{{ lookup('env', 'DEVICE_TYPE') }}" roles: - - system + # - system # - screenly # - network # - splashscreen From be965e21123c8eb46cd36672a7e2853b20c5dc0b Mon Sep 17 00:00:00 2001 From: nicomiguelino Date: Wed, 25 Oct 2023 20:30:38 -0700 Subject: [PATCH 14/49] debug: Comment out most of the tasks inside the `system` set. --- ansible/roles/system/tasks/main.yml | 543 ++++++++++++++-------------- ansible/site.yml | 2 +- 2 files changed, 273 insertions(+), 272 deletions(-) diff --git a/ansible/roles/system/tasks/main.yml b/ansible/roles/system/tasks/main.yml index c4dbef336..f7e05e2f7 100644 --- a/ansible/roles/system/tasks/main.yml +++ b/ansible/roles/system/tasks/main.yml @@ -22,274 +22,275 @@ tags: - touches_boot_partition -- name: Add gpu_mem_256 in config.txt if it doesn't exist - ansible.builtin.lineinfile: - path: /boot/config.txt - line: gpu_mem_256=96 - when: config_txt.stdout.find('gpu_mem_256') == -1 - tags: - - touches_boot_partition - -- name: Add gpu_mem_512 in config.txt if it doesn't exist - ansible.builtin.lineinfile: - path: /boot/config.txt - line: gpu_mem_512=128 - when: config_txt.stdout.find('gpu_mem_512') == -1 - tags: - - touches_boot_partition - -- name: Add gpu_mem_1024 in config.txt if it doesn't exist - ansible.builtin.lineinfile: - path: /boot/config.txt - line: gpu_mem_1024=196 - when: config_txt.stdout.find('gpu_mem_1024') == -1 - tags: - - touches_boot_partition - -- name: Comment out the original dtoverlay config. - ansible.builtin.replace: - dest: /boot/config.txt - regexp: ^(dtoverlay=vc4-kms-v3d)$ - replace: '#\1' - -- name: Add FKMS config for Pi 4. - ansible.builtin.lineinfile: - path: /boot/config.txt - insertafter: '^\[pi4\]$' - line: dtoverlay=vc4-fkms-v3d - -- name: Backup kernel boot args - ansible.builtin.copy: - src: /boot/cmdline.txt - dest: /boot/cmdline.txt.orig - owner: root - group: root - mode: 0755 - force: false - tags: - - touches_boot_partition - -- name: Notice for cmdline.txt.orig file - ansible.builtin.debug: - msg: "Use cmdline.txt.orig for boot parameters (don't remove this file)" - -- name: Copy cmdline.txt.orig to cmdline.txt - ansible.builtin.copy: - src: /boot/cmdline.txt.orig - dest: /boot/cmdline.txt - owner: root - group: root - mode: 0755 - force: true - when: config_txt.stdout.find('NOOBS') == -1 - tags: - - touches_boot_partition - -- name: For splash screen using Plymouth - ansible.builtin.replace: - dest: /boot/cmdline.txt - regexp: (^(?!$)((?!splash).)*$) - replace: \1 splash - when: ansible_distribution_major_version|int >= 7 - -- name: Remove blinking cursor - ansible.builtin.replace: - dest: /boot/cmdline.txt - regexp: (^(?!$)((?!vt.global_cursor_default=0).)*$) - replace: \1 vt.global_cursor_default=0 - when: ansible_distribution_major_version|int >= 7 - tags: - - touches_boot_partition - -- name: Plymouth ignore serial consoles - ansible.builtin.replace: - dest: /boot/cmdline.txt - regexp: (^(?!$)((?!plymouth.ignore-serial-consoles).)*$) - replace: \1 plymouth.ignore-serial-consoles - when: ansible_distribution_major_version|int >= 7 - tags: - - touches_boot_partition - -- name: Use Systemd as init and quiet boot process - ansible.builtin.replace: - dest: /boot/cmdline.txt - regexp: (^(?!$)((?!quiet init=/lib/systemd/systemd).)*$) - replace: \1 quiet init=/lib/systemd/systemd - tags: - - touches_boot_partition - -- name: Set ethN/wlanN names for interfaces - ansible.builtin.replace: - dest: /boot/cmdline.txt - regexp: (^(?!$)((?!net\.ifnames=0).)*$) - replace: \1 net.ifnames=0 - tags: - - touches_boot_partition - -- name: Set cgroup_enable required by containerd for OOM - ansible.builtin.replace: - dest: /boot/cmdline.txt - regexp: (^(?!$)((?!cgroup_enable=memory).)*$) - replace: \1 cgroup_enable=memory - when: ansible_distribution_major_version|int >= 7 - tags: - - touches_boot_partition - -- name: Set cgroup_memory required by containerd for OOM - ansible.builtin.replace: - dest: /boot/cmdline.txt - regexp: (^(?!$)((?!cgroup_memory=1).)*$) - replace: \1 cgroup_memory=1 - when: ansible_distribution_major_version|int >= 7 - tags: - - touches_boot_partition - -# Sometimes in some packages there are no necessary files. -# They are required to install pip dependencies. -# In this case we need to reinstall the packages. -- name: Check if cdefs.h exists - ansible.builtin.stat: - path: /usr/include/arm-linux-gnueabihf/sys/cdefs.h - register: cdefs - -- name: Set fact for cdefs - ansible.builtin.set_fact: - cdefs_exist: "{{ cdefs.stat.exists }}" - -- name: Remove libc6-dev - ansible.builtin.apt: - name: libc6-dev - state: absent - when: not cdefs_exist - -- name: Install libc6-dev - ansible.builtin.apt: - name: libc6-dev - state: present - update_cache: true - when: not cdefs_exist - -- name: Install Screenly dependencies - ansible.builtin.apt: - name: - - rpi-update - - bc - - python3 - - python3-redis - state: present - -- name: Remove deprecated apt dependencies - ansible.builtin.apt: - name: - - dphys-swapfile - - lightdm - - lightdm-gtk-greeter - - matchbox - - nginx-common - - nginx-light - - pix-plym-splash - - rabbitmq-server - - redis-server - - supervisor - - uzbl - - x11-xserver-utils - - xserver-xorg - state: absent - -- name: Make sure distro package of Docker is absent - ansible.builtin.apt: - name: - - docker - - docker-engine - - docker.io - - containerd - - runc - - docker-compose - state: absent - -- name: Add docker apt key - ansible.builtin.apt_key: - url: https://download.docker.com/linux/raspbian/gpg - state: present - -- name: Get raspbian name - ansible.builtin.command: lsb_release -cs - register: raspbian_name - changed_when: false - -- name: Add Docker repo - ansible.builtin.lineinfile: - path: /etc/apt/sources.list.d/docker.list - create: true - line: "deb [arch=armhf] https://download.docker.com/linux/debian {{ raspbian_name.stdout }} stable" - state: present - owner: root - group: root - mode: 0644 - -- name: Install Docker - ansible.builtin.apt: - name: - - docker-ce:armhf - - docker-ce-cli:armhf - - docker-compose-plugin:armhf - update_cache: true - install_recommends: false - -- name: Add user to docker group - ansible.builtin.user: - name: "{{ lookup('env', 'USER') }}" - group: "{{ lookup('env', 'USER') }}" - groups: - - docker - - adm - - sudo - - video - - plugdev - - users - - input - - netdev - - gpio - - dialout - -- name: Perform system upgrade - ansible.builtin.apt: - upgrade: dist - tags: - - system-upgrade - -- name: Clean up unused packages - ansible.builtin.apt: - autoremove: true - tags: - - system-upgrade - -- name: Remove deprecated pip dependencies - ansible.builtin.pip: - name: supervisor - state: absent - extra_args: --break-system-packages - -- name: Copy in rc.local - ansible.builtin.copy: - src: rc.local - dest: /etc/rc.local - mode: 0755 - owner: root - group: root - -- name: Copy in 01_nodoc - ansible.builtin.copy: - src: 01_nodoc - dest: /etc/dpkg/dpkg.cfg.d/01_nodoc - mode: 0644 - owner: root - group: root - -- name: Disable swap - ansible.builtin.command: /sbin/swapoff --all removes=/var/swap - -- name: Remove swapfile from disk - ansible.builtin.file: - path: /var/swap - state: absent +# TODO NICO: Uncomment the rest of this file gradually. +# - name: Add gpu_mem_256 in config.txt if it doesn't exist +# ansible.builtin.lineinfile: +# path: /boot/config.txt +# line: gpu_mem_256=96 +# when: config_txt.stdout.find('gpu_mem_256') == -1 +# tags: +# - touches_boot_partition + +# - name: Add gpu_mem_512 in config.txt if it doesn't exist +# ansible.builtin.lineinfile: +# path: /boot/config.txt +# line: gpu_mem_512=128 +# when: config_txt.stdout.find('gpu_mem_512') == -1 +# tags: +# - touches_boot_partition + +# - name: Add gpu_mem_1024 in config.txt if it doesn't exist +# ansible.builtin.lineinfile: +# path: /boot/config.txt +# line: gpu_mem_1024=196 +# when: config_txt.stdout.find('gpu_mem_1024') == -1 +# tags: +# - touches_boot_partition + +# - name: Comment out the original dtoverlay config. +# ansible.builtin.replace: +# dest: /boot/config.txt +# regexp: ^(dtoverlay=vc4-kms-v3d)$ +# replace: '#\1' + +# - name: Add FKMS config for Pi 4. +# ansible.builtin.lineinfile: +# path: /boot/config.txt +# insertafter: '^\[pi4\]$' +# line: dtoverlay=vc4-fkms-v3d + +# - name: Backup kernel boot args +# ansible.builtin.copy: +# src: /boot/cmdline.txt +# dest: /boot/cmdline.txt.orig +# owner: root +# group: root +# mode: 0755 +# force: false +# tags: +# - touches_boot_partition + +# - name: Notice for cmdline.txt.orig file +# ansible.builtin.debug: +# msg: "Use cmdline.txt.orig for boot parameters (don't remove this file)" + +# - name: Copy cmdline.txt.orig to cmdline.txt +# ansible.builtin.copy: +# src: /boot/cmdline.txt.orig +# dest: /boot/cmdline.txt +# owner: root +# group: root +# mode: 0755 +# force: true +# when: config_txt.stdout.find('NOOBS') == -1 +# tags: +# - touches_boot_partition + +# - name: For splash screen using Plymouth +# ansible.builtin.replace: +# dest: /boot/cmdline.txt +# regexp: (^(?!$)((?!splash).)*$) +# replace: \1 splash +# when: ansible_distribution_major_version|int >= 7 + +# - name: Remove blinking cursor +# ansible.builtin.replace: +# dest: /boot/cmdline.txt +# regexp: (^(?!$)((?!vt.global_cursor_default=0).)*$) +# replace: \1 vt.global_cursor_default=0 +# when: ansible_distribution_major_version|int >= 7 +# tags: +# - touches_boot_partition + +# - name: Plymouth ignore serial consoles +# ansible.builtin.replace: +# dest: /boot/cmdline.txt +# regexp: (^(?!$)((?!plymouth.ignore-serial-consoles).)*$) +# replace: \1 plymouth.ignore-serial-consoles +# when: ansible_distribution_major_version|int >= 7 +# tags: +# - touches_boot_partition + +# - name: Use Systemd as init and quiet boot process +# ansible.builtin.replace: +# dest: /boot/cmdline.txt +# regexp: (^(?!$)((?!quiet init=/lib/systemd/systemd).)*$) +# replace: \1 quiet init=/lib/systemd/systemd +# tags: +# - touches_boot_partition + +# - name: Set ethN/wlanN names for interfaces +# ansible.builtin.replace: +# dest: /boot/cmdline.txt +# regexp: (^(?!$)((?!net\.ifnames=0).)*$) +# replace: \1 net.ifnames=0 +# tags: +# - touches_boot_partition + +# - name: Set cgroup_enable required by containerd for OOM +# ansible.builtin.replace: +# dest: /boot/cmdline.txt +# regexp: (^(?!$)((?!cgroup_enable=memory).)*$) +# replace: \1 cgroup_enable=memory +# when: ansible_distribution_major_version|int >= 7 +# tags: +# - touches_boot_partition + +# - name: Set cgroup_memory required by containerd for OOM +# ansible.builtin.replace: +# dest: /boot/cmdline.txt +# regexp: (^(?!$)((?!cgroup_memory=1).)*$) +# replace: \1 cgroup_memory=1 +# when: ansible_distribution_major_version|int >= 7 +# tags: +# - touches_boot_partition + +# # Sometimes in some packages there are no necessary files. +# # They are required to install pip dependencies. +# # In this case we need to reinstall the packages. +# - name: Check if cdefs.h exists +# ansible.builtin.stat: +# path: /usr/include/arm-linux-gnueabihf/sys/cdefs.h +# register: cdefs + +# - name: Set fact for cdefs +# ansible.builtin.set_fact: +# cdefs_exist: "{{ cdefs.stat.exists }}" + +# - name: Remove libc6-dev +# ansible.builtin.apt: +# name: libc6-dev +# state: absent +# when: not cdefs_exist + +# - name: Install libc6-dev +# ansible.builtin.apt: +# name: libc6-dev +# state: present +# update_cache: true +# when: not cdefs_exist + +# - name: Install Screenly dependencies +# ansible.builtin.apt: +# name: +# - rpi-update +# - bc +# - python3 +# - python3-redis +# state: present + +# - name: Remove deprecated apt dependencies +# ansible.builtin.apt: +# name: +# - dphys-swapfile +# - lightdm +# - lightdm-gtk-greeter +# - matchbox +# - nginx-common +# - nginx-light +# - pix-plym-splash +# - rabbitmq-server +# - redis-server +# - supervisor +# - uzbl +# - x11-xserver-utils +# - xserver-xorg +# state: absent + +# - name: Make sure distro package of Docker is absent +# ansible.builtin.apt: +# name: +# - docker +# - docker-engine +# - docker.io +# - containerd +# - runc +# - docker-compose +# state: absent + +# - name: Add docker apt key +# ansible.builtin.apt_key: +# url: https://download.docker.com/linux/raspbian/gpg +# state: present + +# - name: Get raspbian name +# ansible.builtin.command: lsb_release -cs +# register: raspbian_name +# changed_when: false + +# - name: Add Docker repo +# ansible.builtin.lineinfile: +# path: /etc/apt/sources.list.d/docker.list +# create: true +# line: "deb [arch=armhf] https://download.docker.com/linux/debian {{ raspbian_name.stdout }} stable" +# state: present +# owner: root +# group: root +# mode: 0644 + +# - name: Install Docker +# ansible.builtin.apt: +# name: +# - docker-ce:armhf +# - docker-ce-cli:armhf +# - docker-compose-plugin:armhf +# update_cache: true +# install_recommends: false + +# - name: Add user to docker group +# ansible.builtin.user: +# name: "{{ lookup('env', 'USER') }}" +# group: "{{ lookup('env', 'USER') }}" +# groups: +# - docker +# - adm +# - sudo +# - video +# - plugdev +# - users +# - input +# - netdev +# - gpio +# - dialout + +# - name: Perform system upgrade +# ansible.builtin.apt: +# upgrade: dist +# tags: +# - system-upgrade + +# - name: Clean up unused packages +# ansible.builtin.apt: +# autoremove: true +# tags: +# - system-upgrade + +# - name: Remove deprecated pip dependencies +# ansible.builtin.pip: +# name: supervisor +# state: absent +# extra_args: --break-system-packages + +# - name: Copy in rc.local +# ansible.builtin.copy: +# src: rc.local +# dest: /etc/rc.local +# mode: 0755 +# owner: root +# group: root + +# - name: Copy in 01_nodoc +# ansible.builtin.copy: +# src: 01_nodoc +# dest: /etc/dpkg/dpkg.cfg.d/01_nodoc +# mode: 0644 +# owner: root +# group: root + +# - name: Disable swap +# ansible.builtin.command: /sbin/swapoff --all removes=/var/swap + +# - name: Remove swapfile from disk +# ansible.builtin.file: +# path: /var/swap +# state: absent diff --git a/ansible/site.yml b/ansible/site.yml index e32a5f565..bbbdde8d3 100644 --- a/ansible/site.yml +++ b/ansible/site.yml @@ -8,7 +8,7 @@ device_type: "{{ lookup('env', 'DEVICE_TYPE') }}" roles: - # - system + - system # - screenly # - network # - splashscreen From b76f420dca1d7aa5d40791aa077428589305eb89 Mon Sep 17 00:00:00 2001 From: nicomiguelino Date: Wed, 25 Oct 2023 20:48:47 -0700 Subject: [PATCH 15/49] debug: Uncomment a `system` task. --- ansible/roles/system/tasks/main.yml | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/ansible/roles/system/tasks/main.yml b/ansible/roles/system/tasks/main.yml index f7e05e2f7..c5e349c8d 100644 --- a/ansible/roles/system/tasks/main.yml +++ b/ansible/roles/system/tasks/main.yml @@ -22,15 +22,15 @@ tags: - touches_boot_partition -# TODO NICO: Uncomment the rest of this file gradually. -# - name: Add gpu_mem_256 in config.txt if it doesn't exist -# ansible.builtin.lineinfile: -# path: /boot/config.txt -# line: gpu_mem_256=96 -# when: config_txt.stdout.find('gpu_mem_256') == -1 -# tags: -# - touches_boot_partition +- name: Add gpu_mem_256 in config.txt if it doesn't exist + ansible.builtin.lineinfile: + path: /boot/config.txt + line: gpu_mem_256=96 + when: config_txt.stdout.find('gpu_mem_256') == -1 + tags: + - touches_boot_partition +# TODO NICO: Uncomment the rest of this file gradually. # - name: Add gpu_mem_512 in config.txt if it doesn't exist # ansible.builtin.lineinfile: # path: /boot/config.txt From bb4ee003d32445e059654b82978a11884fe88d59 Mon Sep 17 00:00:00 2001 From: nicomiguelino Date: Thu, 26 Oct 2023 09:16:06 -0700 Subject: [PATCH 16/49] debug: Uncomment out a few other `system` tasks. --- ansible/roles/system/tasks/main.yml | 50 ++++++++++++++--------------- 1 file changed, 25 insertions(+), 25 deletions(-) diff --git a/ansible/roles/system/tasks/main.yml b/ansible/roles/system/tasks/main.yml index c5e349c8d..3f3d2426b 100644 --- a/ansible/roles/system/tasks/main.yml +++ b/ansible/roles/system/tasks/main.yml @@ -30,35 +30,35 @@ tags: - touches_boot_partition -# TODO NICO: Uncomment the rest of this file gradually. -# - name: Add gpu_mem_512 in config.txt if it doesn't exist -# ansible.builtin.lineinfile: -# path: /boot/config.txt -# line: gpu_mem_512=128 -# when: config_txt.stdout.find('gpu_mem_512') == -1 -# tags: -# - touches_boot_partition +- name: Add gpu_mem_512 in config.txt if it doesn't exist + ansible.builtin.lineinfile: + path: /boot/config.txt + line: gpu_mem_512=128 + when: config_txt.stdout.find('gpu_mem_512') == -1 + tags: + - touches_boot_partition -# - name: Add gpu_mem_1024 in config.txt if it doesn't exist -# ansible.builtin.lineinfile: -# path: /boot/config.txt -# line: gpu_mem_1024=196 -# when: config_txt.stdout.find('gpu_mem_1024') == -1 -# tags: -# - touches_boot_partition +- name: Add gpu_mem_1024 in config.txt if it doesn't exist + ansible.builtin.lineinfile: + path: /boot/config.txt + line: gpu_mem_1024=196 + when: config_txt.stdout.find('gpu_mem_1024') == -1 + tags: + - touches_boot_partition -# - name: Comment out the original dtoverlay config. -# ansible.builtin.replace: -# dest: /boot/config.txt -# regexp: ^(dtoverlay=vc4-kms-v3d)$ -# replace: '#\1' +- name: Comment out the original dtoverlay config. + ansible.builtin.replace: + dest: /boot/config.txt + regexp: ^(dtoverlay=vc4-kms-v3d)$ + replace: '#\1' -# - name: Add FKMS config for Pi 4. -# ansible.builtin.lineinfile: -# path: /boot/config.txt -# insertafter: '^\[pi4\]$' -# line: dtoverlay=vc4-fkms-v3d +- name: Add FKMS config for Pi 4. + ansible.builtin.lineinfile: + path: /boot/config.txt + insertafter: '^\[pi4\]$' + line: dtoverlay=vc4-fkms-v3d +# TODO NICO: Uncomment the rest of this file gradually. # - name: Backup kernel boot args # ansible.builtin.copy: # src: /boot/cmdline.txt From 02f20876593f0cfb1d0e885e70001fd9d3cb63de Mon Sep 17 00:00:00 2001 From: nicomiguelino Date: Thu, 26 Oct 2023 09:45:44 -0700 Subject: [PATCH 17/49] ddebug: Uncomment some tasks. --- ansible/roles/system/tasks/main.yml | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/ansible/roles/system/tasks/main.yml b/ansible/roles/system/tasks/main.yml index 3f3d2426b..9f72b20ca 100644 --- a/ansible/roles/system/tasks/main.yml +++ b/ansible/roles/system/tasks/main.yml @@ -46,17 +46,17 @@ tags: - touches_boot_partition -- name: Comment out the original dtoverlay config. - ansible.builtin.replace: - dest: /boot/config.txt - regexp: ^(dtoverlay=vc4-kms-v3d)$ - replace: '#\1' +# - name: Comment out the original dtoverlay config. +# ansible.builtin.replace: +# dest: /boot/config.txt +# regexp: ^(dtoverlay=vc4-kms-v3d)$ +# replace: '#\1' -- name: Add FKMS config for Pi 4. - ansible.builtin.lineinfile: - path: /boot/config.txt - insertafter: '^\[pi4\]$' - line: dtoverlay=vc4-fkms-v3d +# - name: Add FKMS config for Pi 4. +# ansible.builtin.lineinfile: +# path: /boot/config.txt +# insertafter: '^\[pi4\]$' +# line: dtoverlay=vc4-fkms-v3d # TODO NICO: Uncomment the rest of this file gradually. # - name: Backup kernel boot args From 317443e6d451bd675bd418cbb9a5940ba84c89b0 Mon Sep 17 00:00:00 2001 From: nicomiguelino Date: Thu, 26 Oct 2023 10:18:41 -0700 Subject: [PATCH 18/49] debug: Uncomment a `system` task. --- ansible/roles/system/tasks/main.yml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/ansible/roles/system/tasks/main.yml b/ansible/roles/system/tasks/main.yml index 9f72b20ca..2cbd79dd6 100644 --- a/ansible/roles/system/tasks/main.yml +++ b/ansible/roles/system/tasks/main.yml @@ -46,11 +46,11 @@ tags: - touches_boot_partition -# - name: Comment out the original dtoverlay config. -# ansible.builtin.replace: -# dest: /boot/config.txt -# regexp: ^(dtoverlay=vc4-kms-v3d)$ -# replace: '#\1' +- name: Comment out the original dtoverlay config. + ansible.builtin.replace: + dest: /boot/config.txt + regexp: ^(dtoverlay=vc4-kms-v3d)$ + replace: '#\1' # - name: Add FKMS config for Pi 4. # ansible.builtin.lineinfile: From 993fdd9242cb4a78901cfe2f0751daa804aa4ca4 Mon Sep 17 00:00:00 2001 From: nicomiguelino Date: Thu, 26 Oct 2023 10:53:09 -0700 Subject: [PATCH 19/49] debug: Uncomment the part where FKMS is being enabled. --- ansible/roles/system/tasks/main.yml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/ansible/roles/system/tasks/main.yml b/ansible/roles/system/tasks/main.yml index 2cbd79dd6..3f3d2426b 100644 --- a/ansible/roles/system/tasks/main.yml +++ b/ansible/roles/system/tasks/main.yml @@ -52,11 +52,11 @@ regexp: ^(dtoverlay=vc4-kms-v3d)$ replace: '#\1' -# - name: Add FKMS config for Pi 4. -# ansible.builtin.lineinfile: -# path: /boot/config.txt -# insertafter: '^\[pi4\]$' -# line: dtoverlay=vc4-fkms-v3d +- name: Add FKMS config for Pi 4. + ansible.builtin.lineinfile: + path: /boot/config.txt + insertafter: '^\[pi4\]$' + line: dtoverlay=vc4-fkms-v3d # TODO NICO: Uncomment the rest of this file gradually. # - name: Backup kernel boot args From 95e82ae9176d2b79e1d0cc97864fdd77f27eb1ab Mon Sep 17 00:00:00 2001 From: nicomiguelino Date: Thu, 26 Oct 2023 11:18:29 -0700 Subject: [PATCH 20/49] debug: Uncomment out the previously-commented Ansible tasks. --- ansible/roles/system/tasks/main.yml | 471 ++++++++++++++-------------- ansible/site.yml | 8 +- 2 files changed, 239 insertions(+), 240 deletions(-) diff --git a/ansible/roles/system/tasks/main.yml b/ansible/roles/system/tasks/main.yml index 3f3d2426b..c4dbef336 100644 --- a/ansible/roles/system/tasks/main.yml +++ b/ansible/roles/system/tasks/main.yml @@ -58,239 +58,238 @@ insertafter: '^\[pi4\]$' line: dtoverlay=vc4-fkms-v3d -# TODO NICO: Uncomment the rest of this file gradually. -# - name: Backup kernel boot args -# ansible.builtin.copy: -# src: /boot/cmdline.txt -# dest: /boot/cmdline.txt.orig -# owner: root -# group: root -# mode: 0755 -# force: false -# tags: -# - touches_boot_partition - -# - name: Notice for cmdline.txt.orig file -# ansible.builtin.debug: -# msg: "Use cmdline.txt.orig for boot parameters (don't remove this file)" - -# - name: Copy cmdline.txt.orig to cmdline.txt -# ansible.builtin.copy: -# src: /boot/cmdline.txt.orig -# dest: /boot/cmdline.txt -# owner: root -# group: root -# mode: 0755 -# force: true -# when: config_txt.stdout.find('NOOBS') == -1 -# tags: -# - touches_boot_partition - -# - name: For splash screen using Plymouth -# ansible.builtin.replace: -# dest: /boot/cmdline.txt -# regexp: (^(?!$)((?!splash).)*$) -# replace: \1 splash -# when: ansible_distribution_major_version|int >= 7 - -# - name: Remove blinking cursor -# ansible.builtin.replace: -# dest: /boot/cmdline.txt -# regexp: (^(?!$)((?!vt.global_cursor_default=0).)*$) -# replace: \1 vt.global_cursor_default=0 -# when: ansible_distribution_major_version|int >= 7 -# tags: -# - touches_boot_partition - -# - name: Plymouth ignore serial consoles -# ansible.builtin.replace: -# dest: /boot/cmdline.txt -# regexp: (^(?!$)((?!plymouth.ignore-serial-consoles).)*$) -# replace: \1 plymouth.ignore-serial-consoles -# when: ansible_distribution_major_version|int >= 7 -# tags: -# - touches_boot_partition - -# - name: Use Systemd as init and quiet boot process -# ansible.builtin.replace: -# dest: /boot/cmdline.txt -# regexp: (^(?!$)((?!quiet init=/lib/systemd/systemd).)*$) -# replace: \1 quiet init=/lib/systemd/systemd -# tags: -# - touches_boot_partition - -# - name: Set ethN/wlanN names for interfaces -# ansible.builtin.replace: -# dest: /boot/cmdline.txt -# regexp: (^(?!$)((?!net\.ifnames=0).)*$) -# replace: \1 net.ifnames=0 -# tags: -# - touches_boot_partition - -# - name: Set cgroup_enable required by containerd for OOM -# ansible.builtin.replace: -# dest: /boot/cmdline.txt -# regexp: (^(?!$)((?!cgroup_enable=memory).)*$) -# replace: \1 cgroup_enable=memory -# when: ansible_distribution_major_version|int >= 7 -# tags: -# - touches_boot_partition - -# - name: Set cgroup_memory required by containerd for OOM -# ansible.builtin.replace: -# dest: /boot/cmdline.txt -# regexp: (^(?!$)((?!cgroup_memory=1).)*$) -# replace: \1 cgroup_memory=1 -# when: ansible_distribution_major_version|int >= 7 -# tags: -# - touches_boot_partition - -# # Sometimes in some packages there are no necessary files. -# # They are required to install pip dependencies. -# # In this case we need to reinstall the packages. -# - name: Check if cdefs.h exists -# ansible.builtin.stat: -# path: /usr/include/arm-linux-gnueabihf/sys/cdefs.h -# register: cdefs - -# - name: Set fact for cdefs -# ansible.builtin.set_fact: -# cdefs_exist: "{{ cdefs.stat.exists }}" - -# - name: Remove libc6-dev -# ansible.builtin.apt: -# name: libc6-dev -# state: absent -# when: not cdefs_exist - -# - name: Install libc6-dev -# ansible.builtin.apt: -# name: libc6-dev -# state: present -# update_cache: true -# when: not cdefs_exist - -# - name: Install Screenly dependencies -# ansible.builtin.apt: -# name: -# - rpi-update -# - bc -# - python3 -# - python3-redis -# state: present - -# - name: Remove deprecated apt dependencies -# ansible.builtin.apt: -# name: -# - dphys-swapfile -# - lightdm -# - lightdm-gtk-greeter -# - matchbox -# - nginx-common -# - nginx-light -# - pix-plym-splash -# - rabbitmq-server -# - redis-server -# - supervisor -# - uzbl -# - x11-xserver-utils -# - xserver-xorg -# state: absent - -# - name: Make sure distro package of Docker is absent -# ansible.builtin.apt: -# name: -# - docker -# - docker-engine -# - docker.io -# - containerd -# - runc -# - docker-compose -# state: absent - -# - name: Add docker apt key -# ansible.builtin.apt_key: -# url: https://download.docker.com/linux/raspbian/gpg -# state: present - -# - name: Get raspbian name -# ansible.builtin.command: lsb_release -cs -# register: raspbian_name -# changed_when: false - -# - name: Add Docker repo -# ansible.builtin.lineinfile: -# path: /etc/apt/sources.list.d/docker.list -# create: true -# line: "deb [arch=armhf] https://download.docker.com/linux/debian {{ raspbian_name.stdout }} stable" -# state: present -# owner: root -# group: root -# mode: 0644 - -# - name: Install Docker -# ansible.builtin.apt: -# name: -# - docker-ce:armhf -# - docker-ce-cli:armhf -# - docker-compose-plugin:armhf -# update_cache: true -# install_recommends: false - -# - name: Add user to docker group -# ansible.builtin.user: -# name: "{{ lookup('env', 'USER') }}" -# group: "{{ lookup('env', 'USER') }}" -# groups: -# - docker -# - adm -# - sudo -# - video -# - plugdev -# - users -# - input -# - netdev -# - gpio -# - dialout - -# - name: Perform system upgrade -# ansible.builtin.apt: -# upgrade: dist -# tags: -# - system-upgrade - -# - name: Clean up unused packages -# ansible.builtin.apt: -# autoremove: true -# tags: -# - system-upgrade - -# - name: Remove deprecated pip dependencies -# ansible.builtin.pip: -# name: supervisor -# state: absent -# extra_args: --break-system-packages - -# - name: Copy in rc.local -# ansible.builtin.copy: -# src: rc.local -# dest: /etc/rc.local -# mode: 0755 -# owner: root -# group: root - -# - name: Copy in 01_nodoc -# ansible.builtin.copy: -# src: 01_nodoc -# dest: /etc/dpkg/dpkg.cfg.d/01_nodoc -# mode: 0644 -# owner: root -# group: root - -# - name: Disable swap -# ansible.builtin.command: /sbin/swapoff --all removes=/var/swap - -# - name: Remove swapfile from disk -# ansible.builtin.file: -# path: /var/swap -# state: absent +- name: Backup kernel boot args + ansible.builtin.copy: + src: /boot/cmdline.txt + dest: /boot/cmdline.txt.orig + owner: root + group: root + mode: 0755 + force: false + tags: + - touches_boot_partition + +- name: Notice for cmdline.txt.orig file + ansible.builtin.debug: + msg: "Use cmdline.txt.orig for boot parameters (don't remove this file)" + +- name: Copy cmdline.txt.orig to cmdline.txt + ansible.builtin.copy: + src: /boot/cmdline.txt.orig + dest: /boot/cmdline.txt + owner: root + group: root + mode: 0755 + force: true + when: config_txt.stdout.find('NOOBS') == -1 + tags: + - touches_boot_partition + +- name: For splash screen using Plymouth + ansible.builtin.replace: + dest: /boot/cmdline.txt + regexp: (^(?!$)((?!splash).)*$) + replace: \1 splash + when: ansible_distribution_major_version|int >= 7 + +- name: Remove blinking cursor + ansible.builtin.replace: + dest: /boot/cmdline.txt + regexp: (^(?!$)((?!vt.global_cursor_default=0).)*$) + replace: \1 vt.global_cursor_default=0 + when: ansible_distribution_major_version|int >= 7 + tags: + - touches_boot_partition + +- name: Plymouth ignore serial consoles + ansible.builtin.replace: + dest: /boot/cmdline.txt + regexp: (^(?!$)((?!plymouth.ignore-serial-consoles).)*$) + replace: \1 plymouth.ignore-serial-consoles + when: ansible_distribution_major_version|int >= 7 + tags: + - touches_boot_partition + +- name: Use Systemd as init and quiet boot process + ansible.builtin.replace: + dest: /boot/cmdline.txt + regexp: (^(?!$)((?!quiet init=/lib/systemd/systemd).)*$) + replace: \1 quiet init=/lib/systemd/systemd + tags: + - touches_boot_partition + +- name: Set ethN/wlanN names for interfaces + ansible.builtin.replace: + dest: /boot/cmdline.txt + regexp: (^(?!$)((?!net\.ifnames=0).)*$) + replace: \1 net.ifnames=0 + tags: + - touches_boot_partition + +- name: Set cgroup_enable required by containerd for OOM + ansible.builtin.replace: + dest: /boot/cmdline.txt + regexp: (^(?!$)((?!cgroup_enable=memory).)*$) + replace: \1 cgroup_enable=memory + when: ansible_distribution_major_version|int >= 7 + tags: + - touches_boot_partition + +- name: Set cgroup_memory required by containerd for OOM + ansible.builtin.replace: + dest: /boot/cmdline.txt + regexp: (^(?!$)((?!cgroup_memory=1).)*$) + replace: \1 cgroup_memory=1 + when: ansible_distribution_major_version|int >= 7 + tags: + - touches_boot_partition + +# Sometimes in some packages there are no necessary files. +# They are required to install pip dependencies. +# In this case we need to reinstall the packages. +- name: Check if cdefs.h exists + ansible.builtin.stat: + path: /usr/include/arm-linux-gnueabihf/sys/cdefs.h + register: cdefs + +- name: Set fact for cdefs + ansible.builtin.set_fact: + cdefs_exist: "{{ cdefs.stat.exists }}" + +- name: Remove libc6-dev + ansible.builtin.apt: + name: libc6-dev + state: absent + when: not cdefs_exist + +- name: Install libc6-dev + ansible.builtin.apt: + name: libc6-dev + state: present + update_cache: true + when: not cdefs_exist + +- name: Install Screenly dependencies + ansible.builtin.apt: + name: + - rpi-update + - bc + - python3 + - python3-redis + state: present + +- name: Remove deprecated apt dependencies + ansible.builtin.apt: + name: + - dphys-swapfile + - lightdm + - lightdm-gtk-greeter + - matchbox + - nginx-common + - nginx-light + - pix-plym-splash + - rabbitmq-server + - redis-server + - supervisor + - uzbl + - x11-xserver-utils + - xserver-xorg + state: absent + +- name: Make sure distro package of Docker is absent + ansible.builtin.apt: + name: + - docker + - docker-engine + - docker.io + - containerd + - runc + - docker-compose + state: absent + +- name: Add docker apt key + ansible.builtin.apt_key: + url: https://download.docker.com/linux/raspbian/gpg + state: present + +- name: Get raspbian name + ansible.builtin.command: lsb_release -cs + register: raspbian_name + changed_when: false + +- name: Add Docker repo + ansible.builtin.lineinfile: + path: /etc/apt/sources.list.d/docker.list + create: true + line: "deb [arch=armhf] https://download.docker.com/linux/debian {{ raspbian_name.stdout }} stable" + state: present + owner: root + group: root + mode: 0644 + +- name: Install Docker + ansible.builtin.apt: + name: + - docker-ce:armhf + - docker-ce-cli:armhf + - docker-compose-plugin:armhf + update_cache: true + install_recommends: false + +- name: Add user to docker group + ansible.builtin.user: + name: "{{ lookup('env', 'USER') }}" + group: "{{ lookup('env', 'USER') }}" + groups: + - docker + - adm + - sudo + - video + - plugdev + - users + - input + - netdev + - gpio + - dialout + +- name: Perform system upgrade + ansible.builtin.apt: + upgrade: dist + tags: + - system-upgrade + +- name: Clean up unused packages + ansible.builtin.apt: + autoremove: true + tags: + - system-upgrade + +- name: Remove deprecated pip dependencies + ansible.builtin.pip: + name: supervisor + state: absent + extra_args: --break-system-packages + +- name: Copy in rc.local + ansible.builtin.copy: + src: rc.local + dest: /etc/rc.local + mode: 0755 + owner: root + group: root + +- name: Copy in 01_nodoc + ansible.builtin.copy: + src: 01_nodoc + dest: /etc/dpkg/dpkg.cfg.d/01_nodoc + mode: 0644 + owner: root + group: root + +- name: Disable swap + ansible.builtin.command: /sbin/swapoff --all removes=/var/swap + +- name: Remove swapfile from disk + ansible.builtin.file: + path: /var/swap + state: absent diff --git a/ansible/site.yml b/ansible/site.yml index bbbdde8d3..1e542f959 100644 --- a/ansible/site.yml +++ b/ansible/site.yml @@ -9,7 +9,7 @@ roles: - system - # - screenly - # - network - # - splashscreen - # - tools + - screenly + - network + - splashscreen + - tools From cbbeed6a5eea10f9d1501c6e6cf054bb6085b6ef Mon Sep 17 00:00:00 2001 From: nicomiguelino Date: Thu, 26 Oct 2023 11:20:23 -0700 Subject: [PATCH 21/49] debug: Comment out the part where FKMS is being enabled on Pi 4. --- ansible/roles/system/tasks/main.yml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/ansible/roles/system/tasks/main.yml b/ansible/roles/system/tasks/main.yml index c4dbef336..966df1b35 100644 --- a/ansible/roles/system/tasks/main.yml +++ b/ansible/roles/system/tasks/main.yml @@ -52,11 +52,11 @@ regexp: ^(dtoverlay=vc4-kms-v3d)$ replace: '#\1' -- name: Add FKMS config for Pi 4. - ansible.builtin.lineinfile: - path: /boot/config.txt - insertafter: '^\[pi4\]$' - line: dtoverlay=vc4-fkms-v3d +# - name: Add FKMS config for Pi 4. +# ansible.builtin.lineinfile: +# path: /boot/config.txt +# insertafter: '^\[pi4\]$' +# line: dtoverlay=vc4-fkms-v3d - name: Backup kernel boot args ansible.builtin.copy: From 1c8cd06e2ac848c243eedf774f62b621a4dcc36e Mon Sep 17 00:00:00 2001 From: nicomiguelino Date: Thu, 26 Oct 2023 12:35:41 -0700 Subject: [PATCH 22/49] style: Remove the commented-out FKMS step. --- ansible/roles/system/tasks/main.yml | 6 ------ 1 file changed, 6 deletions(-) diff --git a/ansible/roles/system/tasks/main.yml b/ansible/roles/system/tasks/main.yml index 966df1b35..a5cd2a14f 100644 --- a/ansible/roles/system/tasks/main.yml +++ b/ansible/roles/system/tasks/main.yml @@ -52,12 +52,6 @@ regexp: ^(dtoverlay=vc4-kms-v3d)$ replace: '#\1' -# - name: Add FKMS config for Pi 4. -# ansible.builtin.lineinfile: -# path: /boot/config.txt -# insertafter: '^\[pi4\]$' -# line: dtoverlay=vc4-fkms-v3d - - name: Backup kernel boot args ansible.builtin.copy: src: /boot/cmdline.txt From adb24275f4b5cab36b5cca3babad92292492b26e Mon Sep 17 00:00:00 2001 From: nicomiguelino Date: Thu, 26 Oct 2023 14:16:28 -0700 Subject: [PATCH 23/49] fix: Make the changes backwards-compatible --- ansible/roles/screenly/tasks/main.yml | 7 +++++++ ansible/roles/splashscreen/tasks/main.yml | 2 +- ansible/roles/system/tasks/main.yml | 11 ++++++++++- bin/install.sh | 12 ++++++++++-- 4 files changed, 28 insertions(+), 4 deletions(-) diff --git a/ansible/roles/screenly/tasks/main.yml b/ansible/roles/screenly/tasks/main.yml index 04c9486c7..5c7758ced 100644 --- a/ansible/roles/screenly/tasks/main.yml +++ b/ansible/roles/screenly/tasks/main.yml @@ -26,10 +26,17 @@ state: absent dest: "/home/{{ lookup('env', 'USER') }}/.screenly/screenly.conf" +- name: Install pip dependencies + ansible.builtin.pip: + requirements: "/home/{{ lookup('env', 'USER') }}/screenly/requirements/requirements.host.txt" + extra_args: "--no-cache-dir --upgrade" + when: ansible_distribution_major_version|int <= 11 + - name: Install pip dependencies ansible.builtin.pip: requirements: "/home/{{ lookup('env', 'USER') }}/screenly/requirements/requirements.host.txt" extra_args: "--no-cache-dir --upgrade --break-system-packages" + when: ansible_distribution_major_version|int >= 12 - name: Remove screenly_utils.sh ansible.builtin.file: diff --git a/ansible/roles/splashscreen/tasks/main.yml b/ansible/roles/splashscreen/tasks/main.yml index fe280db7d..d83c22cc2 100644 --- a/ansible/roles/splashscreen/tasks/main.yml +++ b/ansible/roles/splashscreen/tasks/main.yml @@ -38,7 +38,7 @@ - /etc/init.d/asplashscreen when: ansible_distribution_major_version|int > 7 -- name: Disable splashscreen +- name: Disable asplashscreen ansible.builtin.command: update-rc.d asplashscreen remove when: ansible_distribution_major_version|int > 7 diff --git a/ansible/roles/system/tasks/main.yml b/ansible/roles/system/tasks/main.yml index a5cd2a14f..c628f6bc6 100644 --- a/ansible/roles/system/tasks/main.yml +++ b/ansible/roles/system/tasks/main.yml @@ -258,11 +258,20 @@ tags: - system-upgrade -- name: Remove deprecated pip dependencies +- name: Remove deprecated pip dependencies (<= Debian 11) + ansible.builtin.pip: + name: supervisor + state: absent + when: + - ansible_distribution_major_version|int <= 11 + +- name: Remove deprecated pip dependencies (>= Debian 12) ansible.builtin.pip: name: supervisor state: absent extra_args: --break-system-packages + when: + - ansible_distribution_major_version|int >= 12 - name: Copy in rc.local ansible.builtin.copy: diff --git a/bin/install.sh b/bin/install.sh index 8fe34c412..0f3d00fc4 100755 --- a/bin/install.sh +++ b/bin/install.sh @@ -177,12 +177,20 @@ else ANSIBLE_VERSION=ansible==2.8.8 fi +RASPBIAN_VERSION=$(cat /etc/os-release | grep VERSION= | cut -d'=' -f2 | cut -d'"' -f2 | cut -d' ' -f1) +PIP_ARGS=() + +if [ "$RASPBIAN_VERSION" = "12" ]; then + PIP_ARGS+=("--break-system-packages") +else +fi + # @TODO # Remove me later. Cryptography 38.0.3 won't build at the moment. # See https://github.com/screenly/anthias/issues/1654 -sudo pip install cryptography==38.0.2 --break-system-packages +sudo pip install cryptography==38.0.2 "${PIP_ARGS[@]}" -sudo pip install "$ANSIBLE_VERSION" --break-system-packages +sudo pip install "$ANSIBLE_VERSION" "${PIP_ARGS[@]}" # @TODO: Remove two lines below after testing. export REPOSITORY='https://github.com/nicomiguelino/Anthias.git' From 98aaaee9088b8afef842ce848f0c5f751b4da09f Mon Sep 17 00:00:00 2001 From: nicomiguelino Date: Thu, 26 Oct 2023 14:35:03 -0700 Subject: [PATCH 24/49] fix: Fix syntax error in the install script. --- bin/install.sh | 1 - 1 file changed, 1 deletion(-) diff --git a/bin/install.sh b/bin/install.sh index 0f3d00fc4..dcb1fe38a 100755 --- a/bin/install.sh +++ b/bin/install.sh @@ -182,7 +182,6 @@ PIP_ARGS=() if [ "$RASPBIAN_VERSION" = "12" ]; then PIP_ARGS+=("--break-system-packages") -else fi # @TODO From d660e7b895d9cba4b86bf922867dd7bdd863fa7e Mon Sep 17 00:00:00 2001 From: nicomiguelino Date: Mon, 30 Oct 2023 10:32:53 -0700 Subject: [PATCH 25/49] style: Resolve Ansible `octal-values` errors. --- ansible/roles/network/tasks/main.yml | 2 +- ansible/roles/screenly/tasks/main.yml | 16 ++++++++-------- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/ansible/roles/network/tasks/main.yml b/ansible/roles/network/tasks/main.yml index 94c5ed719..7ee6dcd7d 100644 --- a/ansible/roles/network/tasks/main.yml +++ b/ansible/roles/network/tasks/main.yml @@ -12,7 +12,7 @@ ansible.builtin.template: src: "{{ item }}" dest: "/etc/systemd/system/{{ item }}" - mode: 0644 + mode: "0644" owner: root group: root with_items: "{{ network_systemd_units }}" diff --git a/ansible/roles/screenly/tasks/main.yml b/ansible/roles/screenly/tasks/main.yml index 5c7758ced..b7a147fc9 100644 --- a/ansible/roles/screenly/tasks/main.yml +++ b/ansible/roles/screenly/tasks/main.yml @@ -5,7 +5,7 @@ state: directory owner: "{{ lookup('env', 'USER') }}" group: "{{ lookup('env', 'USER') }}" - mode: 0755 + mode: "0755" with_items: - .screenly - .config @@ -15,7 +15,7 @@ ansible.builtin.copy: owner: "{{ lookup('env', 'USER') }}" group: "{{ lookup('env', 'USER') }}" - mode: 0644 + mode: "0644" src: default_assets.yml dest: "/home/{{ lookup('env', 'USER') }}/.screenly/default_assets.yml" force: true @@ -53,7 +53,7 @@ ansible.builtin.get_url: url: https://raw.githubusercontent.com/Screenly/screenly-ose/master/bin/install.sh dest: /usr/local/sbin/upgrade_screenly.sh - mode: 0700 + mode: "0700" owner: root group: root force: true @@ -62,7 +62,7 @@ ansible.builtin.copy: src: screenly_overrides dest: /etc/sudoers.d/screenly_overrides - mode: 0440 + mode: "0440" owner: root group: root @@ -70,7 +70,7 @@ ansible.builtin.copy: src: screenly_usb_assets.sh dest: /usr/local/bin/screenly_usb_assets.sh - mode: 0755 + mode: "0755" owner: root group: root @@ -78,7 +78,7 @@ ansible.builtin.copy: src: 50-autoplay.rules dest: /etc/udev/rules.d/50-autoplay.rules - mode: 0644 + mode: "0644" owner: root group: root @@ -86,7 +86,7 @@ ansible.builtin.copy: src: /lib/systemd/system/systemd-udevd.service dest: /etc/systemd/system/systemd-udevd.service - mode: 0644 + mode: "0644" owner: root group: root @@ -100,7 +100,7 @@ ansible.builtin.template: src: "{{ item }}" dest: "/etc/systemd/system/{{ item }}" - mode: 0644 + mode: "0644" owner: root group: root with_items: "{{ screenly_systemd_units }}" From 0eaa69a38fe6cd0b4816de2d0b7b235e1f545748 Mon Sep 17 00:00:00 2001 From: nicomiguelino Date: Mon, 30 Oct 2023 10:37:43 -0700 Subject: [PATCH 26/49] style: Resolve more Ansible `octal-values` errors. --- ansible/roles/splashscreen/tasks/main.yml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/ansible/roles/splashscreen/tasks/main.yml b/ansible/roles/splashscreen/tasks/main.yml index d83c22cc2..f8a07eeb8 100644 --- a/ansible/roles/splashscreen/tasks/main.yml +++ b/ansible/roles/splashscreen/tasks/main.yml @@ -10,7 +10,7 @@ ansible.builtin.copy: src: splashscreen.png dest: /etc/splashscreen.png - mode: 0644 + mode: "0644" owner: root group: root when: ansible_distribution_major_version|int <= 7 @@ -19,7 +19,7 @@ ansible.builtin.copy: src: asplashscreen dest: /etc/init.d/asplashscreen - mode: 0755 + mode: "0755" when: ansible_distribution_major_version|int <= 7 - name: Enables asplashscreen @@ -54,7 +54,7 @@ ansible.builtin.copy: src: "{{ item }}" dest: /usr/share/plymouth/themes/screenly/ - mode: 0644 + mode: "0644" owner: root group: root with_items: @@ -71,7 +71,7 @@ ansible.builtin.copy: src: plymouthd.default dest: /usr/share/plymouth/plymouthd.defaults - mode: 0644 + mode: "0644" owner: root group: root when: ansible_distribution_major_version|int > 7 @@ -80,7 +80,7 @@ ansible.builtin.copy: src: plymouthd.default dest: /etc/plymouth/plymouthd.conf - mode: 0644 + mode: "0644" owner: root group: root when: ansible_distribution_major_version|int > 7 From 28cc0b6c2a10b840261c9c300de916beaf525af1 Mon Sep 17 00:00:00 2001 From: nicomiguelino Date: Mon, 30 Oct 2023 10:42:05 -0700 Subject: [PATCH 27/49] style: Resolve remaining Ansible `octal-values` errors. --- ansible/roles/system/tasks/main.yml | 10 +++++----- ansible/roles/tools/tasks/main.yml | 2 +- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/ansible/roles/system/tasks/main.yml b/ansible/roles/system/tasks/main.yml index c628f6bc6..adac7e934 100644 --- a/ansible/roles/system/tasks/main.yml +++ b/ansible/roles/system/tasks/main.yml @@ -58,7 +58,7 @@ dest: /boot/cmdline.txt.orig owner: root group: root - mode: 0755 + mode: "0755" force: false tags: - touches_boot_partition @@ -73,7 +73,7 @@ dest: /boot/cmdline.txt owner: root group: root - mode: 0755 + mode: "0755" force: true when: config_txt.stdout.find('NOOBS') == -1 tags: @@ -219,7 +219,7 @@ state: present owner: root group: root - mode: 0644 + mode: "0644" - name: Install Docker ansible.builtin.apt: @@ -277,7 +277,7 @@ ansible.builtin.copy: src: rc.local dest: /etc/rc.local - mode: 0755 + mode: "0755" owner: root group: root @@ -285,7 +285,7 @@ ansible.builtin.copy: src: 01_nodoc dest: /etc/dpkg/dpkg.cfg.d/01_nodoc - mode: 0644 + mode: "0644" owner: root group: root diff --git a/ansible/roles/tools/tasks/main.yml b/ansible/roles/tools/tasks/main.yml index b1a807709..39193768b 100644 --- a/ansible/roles/tools/tasks/main.yml +++ b/ansible/roles/tools/tasks/main.yml @@ -3,6 +3,6 @@ ansible.builtin.copy: src: ngrok dest: /usr/local/bin/ - mode: 0755 + mode: "0755" owner: root group: root From 27792044bf15915ee8fc4a16437fee76010183e8 Mon Sep 17 00:00:00 2001 From: nicomiguelino Date: Mon, 30 Oct 2023 13:15:20 -0700 Subject: [PATCH 28/49] style: Fix a `no-changed-when` Ansible linting issue. --- ansible/roles/network/tasks/main.yml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/ansible/roles/network/tasks/main.yml b/ansible/roles/network/tasks/main.yml index 7ee6dcd7d..fadd4b56f 100644 --- a/ansible/roles/network/tasks/main.yml +++ b/ansible/roles/network/tasks/main.yml @@ -78,9 +78,15 @@ dest: /var/lib/polkit-1/localauthority/10-vendor.d/org.freedesktop.NetworkManager.pkla when: manage_network|bool +- name: Get stat of org.freedesktop.NetworkManager.pkla + ansible.builtin.stat: + path: /etc/polkit-1/localauthority/50-local.d/org.freedesktop.NetworkManager.pkla + register: nm_pkla_path + - name: Copy org.freedesktop.NetworkManager.pkla to 50-local.d ansible.builtin.command: cp -f /var/lib/polkit-1/localauthority/10-vendor.d/org.freedesktop.NetworkManager.pkla /etc/polkit-1/localauthority/50-local.d when: manage_network|bool + changed_when: not nm_pkla_path.stat.exists - name: Check if the dhcpcd service exists ansible.builtin.shell: systemctl list-units --type=service | grep 'dhcpcd' From ec477a657e8bb58b697834dbe1e4cf7b17927b1f Mon Sep 17 00:00:00 2001 From: nicomiguelino Date: Tue, 31 Oct 2023 09:20:24 -0700 Subject: [PATCH 29/49] fix: Remove an unnecessary Ansible task that causes linting errors. --- ansible/roles/network/tasks/main.yml | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/ansible/roles/network/tasks/main.yml b/ansible/roles/network/tasks/main.yml index fadd4b56f..14d487a3d 100644 --- a/ansible/roles/network/tasks/main.yml +++ b/ansible/roles/network/tasks/main.yml @@ -88,11 +88,6 @@ when: manage_network|bool changed_when: not nm_pkla_path.stat.exists -- name: Check if the dhcpcd service exists - ansible.builtin.shell: systemctl list-units --type=service | grep 'dhcpcd' - register: dhcpcd_service_exists - ignore_errors: true - - name: Disable dhcpcd ansible.builtin.systemd: state: stopped @@ -100,8 +95,8 @@ enabled: false when: - ansible_distribution_major_version|int >= 9 + - ansible_distribution_major_version|int <= 11 - manage_network|bool - - dhcpcd_service_exists.rc == 0 - name: Activate NetworkManager ansible.builtin.systemd: From 2b34b363fbd74ffc6f4a05875f257c32e762bd52 Mon Sep 17 00:00:00 2001 From: nicomiguelino Date: Tue, 31 Oct 2023 10:19:42 -0700 Subject: [PATCH 30/49] fix: Add a `changed_when` condition when disabling `asplashscreen`. --- ansible/roles/splashscreen/tasks/main.yml | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/ansible/roles/splashscreen/tasks/main.yml b/ansible/roles/splashscreen/tasks/main.yml index f8a07eeb8..117a44086 100644 --- a/ansible/roles/splashscreen/tasks/main.yml +++ b/ansible/roles/splashscreen/tasks/main.yml @@ -38,9 +38,16 @@ - /etc/init.d/asplashscreen when: ansible_distribution_major_version|int > 7 +- name: Get stat of asplashscreen + ansible.builtin.stat: + path: /etc/rcS.d/S01asplashscreen + register: asplashscreen_path + when: ansible_distribution_major_version|int > 7 + - name: Disable asplashscreen ansible.builtin.command: update-rc.d asplashscreen remove when: ansible_distribution_major_version|int > 7 + changed_when: asplashscreen_path.stat.exists - name: Installs dependencies (not Jessie) ansible.builtin.apt: From 7f9ad09d97ad26a04954b63abe2123ae5d03a885 Mon Sep 17 00:00:00 2001 From: nicomiguelino Date: Tue, 31 Oct 2023 10:35:08 -0700 Subject: [PATCH 31/49] fix: Fix the remaining Ansible linting error. --- ansible/roles/splashscreen/tasks/main.yml | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/ansible/roles/splashscreen/tasks/main.yml b/ansible/roles/splashscreen/tasks/main.yml index 117a44086..359ea16c0 100644 --- a/ansible/roles/splashscreen/tasks/main.yml +++ b/ansible/roles/splashscreen/tasks/main.yml @@ -70,9 +70,16 @@ - splashscreen.png when: ansible_distribution_major_version|int > 7 +- name: Get current plymouth theme + ansible.builtin.shell: plymouth-set-default-theme + register: plymouth_theme + changed_when: false + when: ansible_distribution_major_version|int > 7 + - name: Set splashscreen ansible.builtin.command: plymouth-set-default-theme -R screenly when: ansible_distribution_major_version|int > 7 + changed_when: plymouth_theme.stdout != "screenly" - name: Set plymouthd.default ansible.builtin.copy: From f3738fa214f9656c3dc936d0d45c69e6f35d3c93 Mon Sep 17 00:00:00 2001 From: nicomiguelino Date: Tue, 31 Oct 2023 10:38:19 -0700 Subject: [PATCH 32/49] fix: Use `ansible.builtin.command` instead of `ansible.builtin.shell`. --- ansible/roles/splashscreen/tasks/main.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ansible/roles/splashscreen/tasks/main.yml b/ansible/roles/splashscreen/tasks/main.yml index 359ea16c0..cd4658366 100644 --- a/ansible/roles/splashscreen/tasks/main.yml +++ b/ansible/roles/splashscreen/tasks/main.yml @@ -71,7 +71,7 @@ when: ansible_distribution_major_version|int > 7 - name: Get current plymouth theme - ansible.builtin.shell: plymouth-set-default-theme + ansible.builtin.command: plymouth-set-default-theme register: plymouth_theme changed_when: false when: ansible_distribution_major_version|int > 7 From fab412664f10522209da85f19e3748d1860df5e7 Mon Sep 17 00:00:00 2001 From: nicomiguelino Date: Wed, 1 Nov 2023 12:36:14 -0700 Subject: [PATCH 33/49] docs: Update compatibility-related info in the docs. --- README.md | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index b1185dd4f..724a0db40 100644 --- a/README.md +++ b/README.md @@ -9,10 +9,20 @@ Anthias is a digital signage platform for Raspberry Pi. Formerly known as Screenly OSE, it was rebranded to clear up the confusion between Screenly (the paid version) and Anthias. More details can be found in [this blog post](https://www.screenly.io/blog/2022/12/06/screenly-ose-now-called-anthias/). -Anthias works on all Raspberry Pi versions, including Raspberry Pi Zero, Raspberry Pi 3 Model B, and Raspberry Pi 4 Model B. - Want to help Anthias thrive? Support us using [GitHub Sponsor](https://github.com/sponsors/Screenly). +## Compatibility + +We've tested Anthias and is known to work on the following Raspberry Pi models: + +* Raspberry Pi 4 Model B - 32-bt and 64-bit Bullseye, 64-bit Bookworm +* Raspberry Pi 3 Model B+ - 32-bit and 64-bit Bullseye, 64-bit Bookworm +* Raspberry Pi 3 Model B - 64-bit Bookworm + +We're still fixing the installer so that it'll work with Raspberry Pi Zero and Raspberry Pi 2. +Should you encounter any issues, please file an issue either in this repository or in the +[forums](https://forums.screenly.io). + ## Star History [![Star History Chart](https://api.star-history.com/svg?repos=Screenly/Anthias&type=Date)](https://star-history.com/#Screenly/Anthias&Date) From 4ca9b7ce41b4b4eed5c37372268ea772713eb3da Mon Sep 17 00:00:00 2001 From: nicomiguelino Date: Tue, 7 Nov 2023 11:41:46 -0800 Subject: [PATCH 34/49] refactor: Use `lsb_release` instead of `cat`-ing `/etc/os-release`. --- bin/install.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bin/install.sh b/bin/install.sh index dcb1fe38a..c0fdebeda 100755 --- a/bin/install.sh +++ b/bin/install.sh @@ -177,7 +177,7 @@ else ANSIBLE_VERSION=ansible==2.8.8 fi -RASPBIAN_VERSION=$(cat /etc/os-release | grep VERSION= | cut -d'=' -f2 | cut -d'"' -f2 | cut -d' ' -f1) +RASPBIAN_VERSION=$(lsb_release -rs) PIP_ARGS=() if [ "$RASPBIAN_VERSION" = "12" ]; then From ed013ac154007798e8a24e98a436fb124ffb7169 Mon Sep 17 00:00:00 2001 From: nicomiguelino Date: Tue, 7 Nov 2023 22:02:37 -0800 Subject: [PATCH 35/49] fix: Remove the use of `--break-system-packages` in the installer. --- bin/install.sh | 62 +++++++++++++++++++++++++++++++++++++++----------- 1 file changed, 49 insertions(+), 13 deletions(-) diff --git a/bin/install.sh b/bin/install.sh index c0fdebeda..d6a4fa0f4 100755 --- a/bin/install.sh +++ b/bin/install.sh @@ -152,16 +152,37 @@ if [ ! -f /etc/locale.gen ]; then sudo locale-gen fi +# nico start - new code here +RASPBIAN_VERSION=$(lsb_release -rs) +APT_INSTALL_ARGS=( + "git" + "libffi-dev" + "libssl-dev" + "whois" +) + +if [ "$RASPBIAN_VERSION" = "12" ]; then + APT_INSTALL_ARGS+=("python3-full") +else + APT_INSTALL_ARGS+=("python3" "python3-dev" "python3-pip") +fi +# nico end + sudo sed -i 's/apt.screenlyapp.com/archive.raspbian.org/g' /etc/apt/sources.list sudo apt update -y -sudo apt-get install -y --no-install-recommends \ - git \ - libffi-dev \ - libssl-dev \ - python3 \ - python3-dev \ - python3-pip \ - whois +# nico start - old apt install code +# sudo apt-get install -y --no-install-recommends \ +# git \ +# libffi-dev \ +# libssl-dev \ +# python3 \ +# python3-dev \ +# python3-pip \ +# whois +# nico end +# nico start - new apt install code +sudo apt-get install -y --no-install-recommends "${APT_INSTALL_ARGS[@]}" +# nico end if [ "$NETWORK" == 'y' ]; then export MANAGE_NETWORK=true @@ -177,19 +198,34 @@ else ANSIBLE_VERSION=ansible==2.8.8 fi -RASPBIAN_VERSION=$(lsb_release -rs) PIP_ARGS=() +# nico start - old code +# if [ "$RASPBIAN_VERSION" = "12" ]; then +# PIP_ARGS+=("--break-system-packages") +# fi +# nico end + +# nico start - new code if [ "$RASPBIAN_VERSION" = "12" ]; then - PIP_ARGS+=("--break-system-packages") + # @TODO: Create a new virtual environment for Python 3. + python3 -m venv /home/${USER}/screenly/venv + source /home/${USER}/screenly/venv/bin/activate fi +# nico end # @TODO # Remove me later. Cryptography 38.0.3 won't build at the moment. # See https://github.com/screenly/anthias/issues/1654 -sudo pip install cryptography==38.0.2 "${PIP_ARGS[@]}" - -sudo pip install "$ANSIBLE_VERSION" "${PIP_ARGS[@]}" +# nico start - todo: choose only one +# sudo pip install cryptography==38.0.2 "${PIP_ARGS[@]}" +sudo pip install cryptography==38.0.2 +# nico end + +# nico start - todo: choose only one +# sudo pip install "$ANSIBLE_VERSION" "${PIP_ARGS[@]}" +sudo pip install "$ANSIBLE_VERSION" +# nico end # @TODO: Remove two lines below after testing. export REPOSITORY='https://github.com/nicomiguelino/Anthias.git' From 08b6698977b8292469f20c8bb23c77691ecb0a29 Mon Sep 17 00:00:00 2001 From: nicomiguelino Date: Tue, 7 Nov 2023 22:41:20 -0800 Subject: [PATCH 36/49] fix: Don't append `sudo` to `pip` for Bookworm. --- bin/install.sh | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/bin/install.sh b/bin/install.sh index d6a4fa0f4..f8efa69ae 100755 --- a/bin/install.sh +++ b/bin/install.sh @@ -211,6 +211,13 @@ if [ "$RASPBIAN_VERSION" = "12" ]; then # @TODO: Create a new virtual environment for Python 3. python3 -m venv /home/${USER}/screenly/venv source /home/${USER}/screenly/venv/bin/activate + + pip install cryptography==38.0.2 + pip install "$ANSIBLE_VERSION" +else + # todo nico: refactor this mess. + sudo pip install cryptography==38.0.2 + sudo pip install "$ANSIBLE_VERSION" fi # nico end @@ -219,12 +226,12 @@ fi # See https://github.com/screenly/anthias/issues/1654 # nico start - todo: choose only one # sudo pip install cryptography==38.0.2 "${PIP_ARGS[@]}" -sudo pip install cryptography==38.0.2 +# sudo pip install cryptography==38.0.2 # nico end # nico start - todo: choose only one # sudo pip install "$ANSIBLE_VERSION" "${PIP_ARGS[@]}" -sudo pip install "$ANSIBLE_VERSION" +# sudo pip install "$ANSIBLE_VERSION" # nico end # @TODO: Remove two lines below after testing. From 8fa62dd8d934c9f8aa5ed44def94637cfae9fd7d Mon Sep 17 00:00:00 2001 From: nicomiguelino Date: Wed, 8 Nov 2023 10:43:42 -0800 Subject: [PATCH 37/49] fix: Ensure `sudo` works well with activated `venv` environment. --- bin/install.sh | 18 +++++++----------- 1 file changed, 7 insertions(+), 11 deletions(-) diff --git a/bin/install.sh b/bin/install.sh index f8efa69ae..b206fe02c 100755 --- a/bin/install.sh +++ b/bin/install.sh @@ -207,17 +207,13 @@ PIP_ARGS=() # nico end # nico start - new code +SUDO_ARGS=() + if [ "$RASPBIAN_VERSION" = "12" ]; then - # @TODO: Create a new virtual environment for Python 3. python3 -m venv /home/${USER}/screenly/venv source /home/${USER}/screenly/venv/bin/activate - pip install cryptography==38.0.2 - pip install "$ANSIBLE_VERSION" -else - # todo nico: refactor this mess. - sudo pip install cryptography==38.0.2 - sudo pip install "$ANSIBLE_VERSION" + SUDO_ARGS+=("--preserve-env" "env" "PATH=$PATH") fi # nico end @@ -226,24 +222,24 @@ fi # See https://github.com/screenly/anthias/issues/1654 # nico start - todo: choose only one # sudo pip install cryptography==38.0.2 "${PIP_ARGS[@]}" -# sudo pip install cryptography==38.0.2 +sudo ${SUDO_ARGS[@]} pip install cryptography==38.0.2 # nico end # nico start - todo: choose only one # sudo pip install "$ANSIBLE_VERSION" "${PIP_ARGS[@]}" -# sudo pip install "$ANSIBLE_VERSION" +sudo ${SUDO_ARGS[@]} pip install "$ANSIBLE_VERSION" # nico end # @TODO: Remove two lines below after testing. export REPOSITORY='https://github.com/nicomiguelino/Anthias.git' export BRANCH=${CUSTOM_BRANCH} -sudo -u ${USER} ansible localhost \ +sudo -u ${USER} ${SUDO_ARGS[@]} ansible localhost \ -m git \ -a "repo=$REPOSITORY dest=/home/${USER}/screenly version=$BRANCH force=no" cd /home/${USER}/screenly/ansible -sudo -E -u ${USER} ansible-playbook site.yml "${EXTRA_ARGS[@]}" +sudo -E -u ${USER} ${SUDO_ARGS[@]} ansible-playbook site.yml "${EXTRA_ARGS[@]}" # Pull down and install containers sudo -u ${USER} /home/${USER}/screenly/bin/upgrade_containers.sh From 12206ea5461c282edab4b781949c0b8a8d88aa33 Mon Sep 17 00:00:00 2001 From: nicomiguelino Date: Wed, 8 Nov 2023 11:59:10 -0800 Subject: [PATCH 38/49] fix: Have `venv` create a new virtual env in other folder. --- bin/install.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/bin/install.sh b/bin/install.sh index b206fe02c..6d476fe3c 100755 --- a/bin/install.sh +++ b/bin/install.sh @@ -210,8 +210,8 @@ PIP_ARGS=() SUDO_ARGS=() if [ "$RASPBIAN_VERSION" = "12" ]; then - python3 -m venv /home/${USER}/screenly/venv - source /home/${USER}/screenly/venv/bin/activate + python3 -m venv /home/${USER}/installer_venv + source /home/${USER}/installer_env/bin/activate SUDO_ARGS+=("--preserve-env" "env" "PATH=$PATH") fi From 5252af9bade35b3357f991fc6c8a7f4add407bf4 Mon Sep 17 00:00:00 2001 From: nicomiguelino Date: Wed, 8 Nov 2023 12:04:17 -0800 Subject: [PATCH 39/49] fix: Resolve typo in `venv` path. --- bin/install.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bin/install.sh b/bin/install.sh index 6d476fe3c..570645e9e 100755 --- a/bin/install.sh +++ b/bin/install.sh @@ -211,7 +211,7 @@ SUDO_ARGS=() if [ "$RASPBIAN_VERSION" = "12" ]; then python3 -m venv /home/${USER}/installer_venv - source /home/${USER}/installer_env/bin/activate + source /home/${USER}/installer_venv/bin/activate SUDO_ARGS+=("--preserve-env" "env" "PATH=$PATH") fi From c52c87aebd182b9d57a0ead894f0420f9f968799 Mon Sep 17 00:00:00 2001 From: nicomiguelino Date: Wed, 8 Nov 2023 13:09:47 -0800 Subject: [PATCH 40/49] style: Remove unnecessary comments from the installer. --- bin/install.sh | 31 ------------------------------- 1 file changed, 31 deletions(-) diff --git a/bin/install.sh b/bin/install.sh index 570645e9e..1062b43fc 100755 --- a/bin/install.sh +++ b/bin/install.sh @@ -152,7 +152,6 @@ if [ ! -f /etc/locale.gen ]; then sudo locale-gen fi -# nico start - new code here RASPBIAN_VERSION=$(lsb_release -rs) APT_INSTALL_ARGS=( "git" @@ -166,23 +165,10 @@ if [ "$RASPBIAN_VERSION" = "12" ]; then else APT_INSTALL_ARGS+=("python3" "python3-dev" "python3-pip") fi -# nico end sudo sed -i 's/apt.screenlyapp.com/archive.raspbian.org/g' /etc/apt/sources.list sudo apt update -y -# nico start - old apt install code -# sudo apt-get install -y --no-install-recommends \ -# git \ -# libffi-dev \ -# libssl-dev \ -# python3 \ -# python3-dev \ -# python3-pip \ -# whois -# nico end -# nico start - new apt install code sudo apt-get install -y --no-install-recommends "${APT_INSTALL_ARGS[@]}" -# nico end if [ "$NETWORK" == 'y' ]; then export MANAGE_NETWORK=true @@ -198,15 +184,6 @@ else ANSIBLE_VERSION=ansible==2.8.8 fi -PIP_ARGS=() - -# nico start - old code -# if [ "$RASPBIAN_VERSION" = "12" ]; then -# PIP_ARGS+=("--break-system-packages") -# fi -# nico end - -# nico start - new code SUDO_ARGS=() if [ "$RASPBIAN_VERSION" = "12" ]; then @@ -215,20 +192,12 @@ if [ "$RASPBIAN_VERSION" = "12" ]; then SUDO_ARGS+=("--preserve-env" "env" "PATH=$PATH") fi -# nico end # @TODO # Remove me later. Cryptography 38.0.3 won't build at the moment. # See https://github.com/screenly/anthias/issues/1654 -# nico start - todo: choose only one -# sudo pip install cryptography==38.0.2 "${PIP_ARGS[@]}" sudo ${SUDO_ARGS[@]} pip install cryptography==38.0.2 -# nico end - -# nico start - todo: choose only one -# sudo pip install "$ANSIBLE_VERSION" "${PIP_ARGS[@]}" sudo ${SUDO_ARGS[@]} pip install "$ANSIBLE_VERSION" -# nico end # @TODO: Remove two lines below after testing. export REPOSITORY='https://github.com/nicomiguelino/Anthias.git' From eba413d6f4d5fe864a51620535670bbc0698c817 Mon Sep 17 00:00:00 2001 From: nicomiguelino Date: Wed, 8 Nov 2023 14:22:06 -0800 Subject: [PATCH 41/49] fix: Make `pip` recognizable as a command. --- ansible/roles/system/tasks/main.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/ansible/roles/system/tasks/main.yml b/ansible/roles/system/tasks/main.yml index adac7e934..d968cec72 100644 --- a/ansible/roles/system/tasks/main.yml +++ b/ansible/roles/system/tasks/main.yml @@ -268,8 +268,10 @@ - name: Remove deprecated pip dependencies (>= Debian 12) ansible.builtin.pip: name: supervisor + executable: /home/nico/installer_venv/bin/pip state: absent - extra_args: --break-system-packages + # TODO NICO: Remove if not needed. + # extra_args: --break-system-packages when: - ansible_distribution_major_version|int >= 12 From d9309d7fdd7faa7a54d73bbea1291d7ec64a44a3 Mon Sep 17 00:00:00 2001 From: nicomiguelino Date: Wed, 8 Nov 2023 16:43:03 -0800 Subject: [PATCH 42/49] fix: Make `pip` recognizable as a command. --- ansible/roles/screenly/tasks/main.yml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/ansible/roles/screenly/tasks/main.yml b/ansible/roles/screenly/tasks/main.yml index b7a147fc9..5a612844b 100644 --- a/ansible/roles/screenly/tasks/main.yml +++ b/ansible/roles/screenly/tasks/main.yml @@ -34,8 +34,11 @@ - name: Install pip dependencies ansible.builtin.pip: + executable: /home/nico/installer_venv/bin/pip requirements: "/home/{{ lookup('env', 'USER') }}/screenly/requirements/requirements.host.txt" - extra_args: "--no-cache-dir --upgrade --break-system-packages" + extra_args: "--no-cache-dir --upgrade" + # TODO NICO: Remove below if not needed. + # extra_args: "--no-cache-dir --upgrade --break-system-packages" when: ansible_distribution_major_version|int >= 12 - name: Remove screenly_utils.sh From c413f94d576c54d8c3542f8493ef0077523d0f15 Mon Sep 17 00:00:00 2001 From: nicomiguelino Date: Wed, 8 Nov 2023 20:39:08 -0800 Subject: [PATCH 43/49] fix: Make use of the USER environment variable. --- ansible/roles/screenly/tasks/main.yml | 4 +--- ansible/roles/system/tasks/main.yml | 4 +--- 2 files changed, 2 insertions(+), 6 deletions(-) diff --git a/ansible/roles/screenly/tasks/main.yml b/ansible/roles/screenly/tasks/main.yml index 5a612844b..3f8991187 100644 --- a/ansible/roles/screenly/tasks/main.yml +++ b/ansible/roles/screenly/tasks/main.yml @@ -34,11 +34,9 @@ - name: Install pip dependencies ansible.builtin.pip: - executable: /home/nico/installer_venv/bin/pip + executable: "/home/{{ lookup('env', 'USER') }}/installer_venv/bin/pip" requirements: "/home/{{ lookup('env', 'USER') }}/screenly/requirements/requirements.host.txt" extra_args: "--no-cache-dir --upgrade" - # TODO NICO: Remove below if not needed. - # extra_args: "--no-cache-dir --upgrade --break-system-packages" when: ansible_distribution_major_version|int >= 12 - name: Remove screenly_utils.sh diff --git a/ansible/roles/system/tasks/main.yml b/ansible/roles/system/tasks/main.yml index d968cec72..f0d93b57c 100644 --- a/ansible/roles/system/tasks/main.yml +++ b/ansible/roles/system/tasks/main.yml @@ -268,10 +268,8 @@ - name: Remove deprecated pip dependencies (>= Debian 12) ansible.builtin.pip: name: supervisor - executable: /home/nico/installer_venv/bin/pip + executable: /home/{{ lookup('env', 'USER') }}/installer_venv/bin/pip state: absent - # TODO NICO: Remove if not needed. - # extra_args: --break-system-packages when: - ansible_distribution_major_version|int >= 12 From 145891745a2f87dafe52479346f5f4540215eef0 Mon Sep 17 00:00:00 2001 From: nicomiguelino Date: Fri, 22 Dec 2023 12:39:02 -0800 Subject: [PATCH 44/49] fix: Enable FKMS for Pi 4 devices running Debian 11 and older. --- ansible/roles/system/tasks/main.yml | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/ansible/roles/system/tasks/main.yml b/ansible/roles/system/tasks/main.yml index f0d93b57c..4af611fde 100644 --- a/ansible/roles/system/tasks/main.yml +++ b/ansible/roles/system/tasks/main.yml @@ -52,6 +52,14 @@ regexp: ^(dtoverlay=vc4-kms-v3d)$ replace: '#\1' +- name: Add FKMS config for Pi 4. (<= Debian 11) + ansible.builtin.lineinfile: + path: /boot/config.txt + insertafter: '^\[pi4\]$' + line: dtoverlay=vc4-fkms-v3d + when: + - ansible_distribution_major_version|int <= 11 + - name: Backup kernel boot args ansible.builtin.copy: src: /boot/cmdline.txt From 8d545758a5f1982b0bc10cfa9c3017e358a36b4f Mon Sep 17 00:00:00 2001 From: nicomiguelino Date: Mon, 1 Apr 2024 13:02:51 -0700 Subject: [PATCH 45/49] fix: Enable FKMS on Pi 4 devices running Debian 12. --- ansible/roles/system/tasks/main.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ansible/roles/system/tasks/main.yml b/ansible/roles/system/tasks/main.yml index 4af611fde..5d7a69d15 100644 --- a/ansible/roles/system/tasks/main.yml +++ b/ansible/roles/system/tasks/main.yml @@ -52,13 +52,13 @@ regexp: ^(dtoverlay=vc4-kms-v3d)$ replace: '#\1' -- name: Add FKMS config for Pi 4. (<= Debian 11) +- name: Add FKMS config for Pi 4. (<= Debian 12) ansible.builtin.lineinfile: path: /boot/config.txt insertafter: '^\[pi4\]$' line: dtoverlay=vc4-fkms-v3d when: - - ansible_distribution_major_version|int <= 11 + - ansible_distribution_major_version|int <= 12 - name: Backup kernel boot args ansible.builtin.copy: From b357b9eb7202a855a8671df01afed590127389c0 Mon Sep 17 00:00:00 2001 From: nicomiguelino Date: Mon, 1 Apr 2024 14:26:57 -0700 Subject: [PATCH 46/49] fix: Tweak `/boot/firmware/config.txt` for Debian >= 12. --- ansible/roles/system/tasks/main.yml | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/ansible/roles/system/tasks/main.yml b/ansible/roles/system/tasks/main.yml index 5d7a69d15..8f3ea47f0 100644 --- a/ansible/roles/system/tasks/main.yml +++ b/ansible/roles/system/tasks/main.yml @@ -52,13 +52,21 @@ regexp: ^(dtoverlay=vc4-kms-v3d)$ replace: '#\1' -- name: Add FKMS config for Pi 4. (<= Debian 12) +- name: Add FKMS config for Pi 4. (<= Debian 11) ansible.builtin.lineinfile: path: /boot/config.txt insertafter: '^\[pi4\]$' line: dtoverlay=vc4-fkms-v3d when: - - ansible_distribution_major_version|int <= 12 + - ansible_distribution_major_version|int <= 11 + +- name: Add FKMS config for Pi 4. (>= Debian 12) + ansible.builtin.lineinfile: + path: /boot/firmware/config.txt + insertafter: '^\[pi4\]$' + line: dtoverlay=vc4-fkms-v3d + when: + - ansible_distribution_major_version|int >= 12 - name: Backup kernel boot args ansible.builtin.copy: From a593817e1e8d92abce55d28e0284882c445be8af Mon Sep 17 00:00:00 2001 From: nicomiguelino Date: Mon, 1 Apr 2024 16:48:43 -0700 Subject: [PATCH 47/49] fix: Read `/boot/firmware/config.txt` if OS is Debian 12. --- ansible/roles/system/tasks/main.yml | 28 +++++++++++++++++++--------- 1 file changed, 19 insertions(+), 9 deletions(-) diff --git a/ansible/roles/system/tasks/main.yml b/ansible/roles/system/tasks/main.yml index 8f3ea47f0..27d47ab87 100644 --- a/ansible/roles/system/tasks/main.yml +++ b/ansible/roles/system/tasks/main.yml @@ -1,6 +1,10 @@ --- +- name: Create a config_path variable + ansible.builtin.set_fact: + config_path: "{{ /boot/config.txt if ansible_distribution_major_version|int <= 11 else /boot/firmware/config.txt }}" + - name: Check NOOBS - ansible.builtin.command: cat /boot/config.txt + ansible.builtin.command: cat {{ config_path }} register: config_txt changed_when: false tags: @@ -8,7 +12,7 @@ - name: Make sure we have proper framebuffer depth ansible.builtin.lineinfile: - dest: /boot/config.txt + dest: "{{ config_path }}" regexp: ^framebuffer_depth= line: framebuffer_depth=32 tags: @@ -16,7 +20,7 @@ - name: Fix framebuffer bug ansible.builtin.lineinfile: - dest: /boot/config.txt + dest: "{{ config_path }}" regexp: ^framebuffer_ignore_alpha= line: framebuffer_ignore_alpha=1 tags: @@ -24,7 +28,7 @@ - name: Add gpu_mem_256 in config.txt if it doesn't exist ansible.builtin.lineinfile: - path: /boot/config.txt + path: "{{ config_path }}" line: gpu_mem_256=96 when: config_txt.stdout.find('gpu_mem_256') == -1 tags: @@ -32,7 +36,7 @@ - name: Add gpu_mem_512 in config.txt if it doesn't exist ansible.builtin.lineinfile: - path: /boot/config.txt + path: "{{ config_path }}" line: gpu_mem_512=128 when: config_txt.stdout.find('gpu_mem_512') == -1 tags: @@ -40,21 +44,27 @@ - name: Add gpu_mem_1024 in config.txt if it doesn't exist ansible.builtin.lineinfile: - path: /boot/config.txt + path: "{{ config_path }}" line: gpu_mem_1024=196 when: config_txt.stdout.find('gpu_mem_1024') == -1 tags: - touches_boot_partition +- name: Add pi4 section in config.txt if it doesn't exist + ansible.builtin.lineinfile: + path: "{{ config_path }}" + line: "[pi4]" + when: config_txt.stdout.find('[pi4]') == -1 + - name: Comment out the original dtoverlay config. ansible.builtin.replace: - dest: /boot/config.txt + dest: "{{ config_path }}" regexp: ^(dtoverlay=vc4-kms-v3d)$ replace: '#\1' - name: Add FKMS config for Pi 4. (<= Debian 11) ansible.builtin.lineinfile: - path: /boot/config.txt + path: "{{ config_path }}" insertafter: '^\[pi4\]$' line: dtoverlay=vc4-fkms-v3d when: @@ -62,7 +72,7 @@ - name: Add FKMS config for Pi 4. (>= Debian 12) ansible.builtin.lineinfile: - path: /boot/firmware/config.txt + path: "{{ config_path }}" insertafter: '^\[pi4\]$' line: dtoverlay=vc4-fkms-v3d when: From 943f44c722c5090ddcabbd65eb4b8a0d14151234 Mon Sep 17 00:00:00 2001 From: nicomiguelino Date: Mon, 1 Apr 2024 18:14:35 -0700 Subject: [PATCH 48/49] fix: Fix Ansible syntax errors. --- ansible/roles/system/tasks/main.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ansible/roles/system/tasks/main.yml b/ansible/roles/system/tasks/main.yml index 27d47ab87..4fbb6fd52 100644 --- a/ansible/roles/system/tasks/main.yml +++ b/ansible/roles/system/tasks/main.yml @@ -1,7 +1,7 @@ --- - name: Create a config_path variable ansible.builtin.set_fact: - config_path: "{{ /boot/config.txt if ansible_distribution_major_version|int <= 11 else /boot/firmware/config.txt }}" + config_path: "{{ '/boot/config.txt' if ansible_distribution_major_version|int <= 11 else '/boot/firmware/config.txt' }}" - name: Check NOOBS ansible.builtin.command: cat {{ config_path }} From 78cda551d458f6a26f499b05bd18d23a46440371 Mon Sep 17 00:00:00 2001 From: nicomiguelino Date: Mon, 1 Apr 2024 23:30:55 -0700 Subject: [PATCH 49/49] fix: Remove temporary changes from the install script. --- bin/install.sh | 4 ---- 1 file changed, 4 deletions(-) diff --git a/bin/install.sh b/bin/install.sh index 1062b43fc..954ac8815 100755 --- a/bin/install.sh +++ b/bin/install.sh @@ -199,10 +199,6 @@ fi sudo ${SUDO_ARGS[@]} pip install cryptography==38.0.2 sudo ${SUDO_ARGS[@]} pip install "$ANSIBLE_VERSION" -# @TODO: Remove two lines below after testing. -export REPOSITORY='https://github.com/nicomiguelino/Anthias.git' -export BRANCH=${CUSTOM_BRANCH} - sudo -u ${USER} ${SUDO_ARGS[@]} ansible localhost \ -m git \ -a "repo=$REPOSITORY dest=/home/${USER}/screenly version=$BRANCH force=no"