diff --git a/README.md b/README.md index 8a8722c..127536d 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,13 @@ -# raspberrypi-kiosk +# ansible-raspberrypi-kiosk -Ansible role to setup a raspberry pi in kiosk mode \ No newline at end of file +Ansible role to setup a Raspberry Pi in kiosk mode + +## Deploy + +1. Go to the [download page for the OS](https://www.raspberrypi.com/software/) and grab the **lite** version of the Raspberry Pi OS. Flash the OS on the SD card. +2. Insert the SD card in your Raspberry Pi, boot it, and go through the first-time-setup. Use `pi` as the username and `raspberry` as the password +3. Login and run `sudo systemctl enable ssh.service` to start the ssh server on boot. +4. If desired, `sudo raspi-config` and apply overclock and/or tweak the size of the swap. +5. Reboot your Raspberry Pi. +6. On your main machine, run `ansible-playbook site.yaml -i hosts` at the root of this repository. This can be very slow depending on the model of your Pi. +7. Once the playbook has finished running, your Raspberry Pi will reboot in kiosk mode. \ No newline at end of file diff --git a/hosts b/hosts index 1f1c8a6..c279ff5 100644 --- a/hosts +++ b/hosts @@ -1,2 +1,2 @@ [raspberrypi-kiosk] -raspberry ansible_become=true ansible_become_method=sudo ansible_become_user=root \ No newline at end of file +raspberrypi.local ansible_user=pi ansible_password=raspberry ansible_become_method=sudo ansible_become_user=root \ No newline at end of file diff --git a/roles/raspberrypi-kiosk/defaults/main.yaml b/roles/raspberrypi-kiosk/defaults/main.yaml index e69de29..12bb993 100644 --- a/roles/raspberrypi-kiosk/defaults/main.yaml +++ b/roles/raspberrypi-kiosk/defaults/main.yaml @@ -0,0 +1 @@ +kiosk_url: https://floatingqrcode.com/ \ No newline at end of file diff --git a/roles/raspberrypi-kiosk/handlers/main.yaml b/roles/raspberrypi-kiosk/handlers/main.yaml new file mode 100644 index 0000000..bb88114 --- /dev/null +++ b/roles/raspberrypi-kiosk/handlers/main.yaml @@ -0,0 +1,2 @@ +- name: Reboot + reboot: \ No newline at end of file diff --git a/roles/raspberrypi-kiosk/tasks/main.yaml b/roles/raspberrypi-kiosk/tasks/main.yaml index e69de29..195afce 100644 --- a/roles/raspberrypi-kiosk/tasks/main.yaml +++ b/roles/raspberrypi-kiosk/tasks/main.yaml @@ -0,0 +1,17 @@ +- name: Install Cage window manager and Midori browser + apt: + update_cache: yes + name: + - cage + - xwayland + - gtk3-nocsd + - midori + +- name: Configure autologin + command: raspi-config nonint do_boot_behaviour B2 + +- name: Install kiosk script + template: + src: kiosk.sh.j2 + dest: /etc/profile.d/kiosk.sh + notify: Reboot diff --git a/roles/raspberrypi-kiosk/templates/kiosk.sh.j2 b/roles/raspberrypi-kiosk/templates/kiosk.sh.j2 new file mode 100644 index 0000000..b6064ed --- /dev/null +++ b/roles/raspberrypi-kiosk/templates/kiosk.sh.j2 @@ -0,0 +1,8 @@ +#!/bin/bash + +if [ "$(tty)" = "/dev/tty1" ]; then + while true; do + GTK_CSD=0 cage -d -s -- midori -e fullscreen -a {{ kiosk_url }} + sleep 1 + done +fi \ No newline at end of file diff --git a/site.yaml b/site.yaml index fa4e40e..03a13db 100644 --- a/site.yaml +++ b/site.yaml @@ -1,10 +1,12 @@ - hosts: all + become: true tasks: - name: Perform system update apt: update_cache: true - upgrade: true + upgrade: dist - hosts: all + become: true roles: - raspberrypi-kiosk \ No newline at end of file