diff --git a/touch_display/inventory.yml b/touch_display/inventory.yml new file mode 100644 index 0000000..fe1bfc9 --- /dev/null +++ b/touch_display/inventory.yml @@ -0,0 +1,18 @@ +predavalnice_pi: + # Skupne spremenljivke za vse zaslone + vars: + # Check here: https://github.com/leukipp/touchkio/releases + touchkio_version: "1.1.2" + # Multimedia network + static_ip_netmask: "255.255.255.0" + static_ip_gateway: "192.168.190.1" + static_ip_dns_servers: + - "212.235.188.28" + - "212.235.188.29" + hosts: + p01_touch_display: + predavalnica: p01 + static_ip_address: "192.168.190.111" + hostname: "p01_touch_display.local" + kiosk_url: "http://192.168.190.110" + diff --git a/touch_display/main.yml b/touch_display/main.yml new file mode 100644 index 0000000..e81dab2 --- /dev/null +++ b/touch_display/main.yml @@ -0,0 +1,6 @@ +- hosts: predavalnice_pi + # TODO: better include (import playbook) + tasks: + - include_tasks: static_ip.yml + - include_tasks: pi_stuff.yml + - include_tasks: touch_display.yml diff --git a/touch_display/pi_stuff.yml b/touch_display/pi_stuff.yml new file mode 100644 index 0000000..0440760 --- /dev/null +++ b/touch_display/pi_stuff.yml @@ -0,0 +1,36 @@ +- name: Enable boot splash screen + become: true + shell: "raspi-config nonint get_boot_splash && raspi-config nonint do_boot_splash 0" + register: boot_splash + changed_when: + - boot_splash == "1" + +- name: Disable color splash + become: true + community.general.ini_file: + path: /boot/firmware/config.txt + option: disable_splash + value: 1 + no_extra_spaces: true + +- name: Change splash image + become: true + copy: + src: splash.png + dest: /usr/share/plymouth/themes/pix/splash.png + +- name: Remove desktop bloat + become: true + apt: + name: + - gvfs + - gnome-keyring + - cups + state: absent + +- name: Switch to wayfire + become: true + shell: "raspi-config nonint is_wayfire && raspi-config nonint do_wayland W2" + register: result + failed_when: ( result.rc not in [ 0, 1 ] ) + changed_when: ( result.rc == 1 ) diff --git a/touch_display/splash.png b/touch_display/splash.png new file mode 100644 index 0000000..521e50a Binary files /dev/null and b/touch_display/splash.png differ diff --git a/touch_display/static_ip.yml b/touch_display/static_ip.yml new file mode 100644 index 0000000..4af86fe --- /dev/null +++ b/touch_display/static_ip.yml @@ -0,0 +1,28 @@ + +- name: Configure static IP address (using Network Manager). + become: yes + community.general.nmcli: + conn_name: "Multimedia net" + ifname: eth0 + type: ethernet + ip4: "{{ static_ip_address }}/{{ static_ip_netmask | ansible.utils.ipaddr('prefix') }}" + gw4: "{{static_ip_gateway}}" + state: present + +- name: Restart NetworkManager + become: yes + service: + name: NetworkManager + state: restarted + +- name: Wait for network to be available + become: yes + wait_for_connection: + timeout: 60 + +# TODO: get rid of netaddr +- name: Display new IP configuration + debug: + msg: "Static IP configured: {{ static_ip_address }}/{{ static_ip_netmask | ansible.utils.ipaddr('prefix') }}" + + \ No newline at end of file diff --git a/touch_display/touch_display.yml b/touch_display/touch_display.yml new file mode 100644 index 0000000..fa592d1 --- /dev/null +++ b/touch_display/touch_display.yml @@ -0,0 +1,32 @@ + +- name: Download .deb file + get_url: + url: "https://github.com/leukipp/touchkio/releases/download/v{{ touchkio_version }}/touchkio_{{ touchkio_version }}_arm64.deb" + dest: "/tmp/touchkio_{{ touchkio_version }}_arm64.deb" + register: deb_download + +- name: Install the latest .deb package + become: yes + apt: + deb: "/tmp/touchkio_{{ touchkio_version }}_arm64.deb" + when: deb_download is succeeded + +- name: Create systemd user service directory + file: + path: "{{ ansible_env.HOME }}/.config/systemd/user" + state: directory + +- name: Create systemd user service + template: + src: touchkio.service.j2 + dest: "{{ ansible_env.HOME }}/.config/systemd/user/touchkio.service" + +- name: Enable systemd service + ansible.builtin.systemd_service: + name: touchkio + enabled: true + state: restarted + scope: user + daemon_reload: true + + when: ansible_check_mode == false diff --git a/touch_display/touchkio.service.j2 b/touch_display/touchkio.service.j2 new file mode 100644 index 0000000..9425fa4 --- /dev/null +++ b/touch_display/touchkio.service.j2 @@ -0,0 +1,11 @@ +[Unit] +Description=TouchKio +After=graphical.target + +[Service] +ExecStart=/usr/bin/touchkio --web-url="{{ kiosk_url }}" +Restart=on-failure +RestartSec=5s + +[Install] +WantedBy=default.target