diff --git a/hosts b/hosts new file mode 100644 index 0000000..2302eda --- /dev/null +++ b/hosts @@ -0,0 +1 @@ +localhost ansible_connection=local diff --git a/local.yml b/local.yml new file mode 100644 index 0000000..9a82700 --- /dev/null +++ b/local.yml @@ -0,0 +1,8 @@ +--- + +- hosts: localhost + gather_facts: yes + user: root + roles: + - attendance + diff --git a/roles/attendance/files/bash_profile b/roles/attendance/files/bash_profile new file mode 100644 index 0000000..f33cd80 --- /dev/null +++ b/roles/attendance/files/bash_profile @@ -0,0 +1 @@ +[[ -z $DISPLAY && $XDG_VTNR -eq 1 ]] && startx -- -nocursor diff --git a/roles/attendance/files/openbox_rc b/roles/attendance/files/openbox_rc new file mode 100644 index 0000000..89b409a --- /dev/null +++ b/roles/attendance/files/openbox_rc @@ -0,0 +1,133 @@ + + + + + + 10 + 20 + + + + yes + no + yes + no + 200 + no + + + + Smart +
yes
+ Primary + 1 +
+ + + Clearlooks + NLIMC + yes + yes + + sans + 8 + bold + normal + + + sans + 8 + bold + normal + + + sans + 9 + normal + normal + + + sans + 9 + normal + normal + + + sans + 9 + bold + normal + + + sans + 9 + bold + normal + + + + + 1 + 1 + + + 0 + + + + yes + Nonpixel + Center + + 10 + 10 + + + + + 0 + 0 + 0 + 0 + + + + C-g + + + + + + + + + + + + + + + + + + + + + + + /var/lib/openbox/debian-menu.xml + menu.xml + 200 + no + 100 + 400 + yes + yes + + + + + +
+ diff --git a/roles/attendance/files/tty_unit b/roles/attendance/files/tty_unit new file mode 100644 index 0000000..7b64983 --- /dev/null +++ b/roles/attendance/files/tty_unit @@ -0,0 +1,4 @@ +[Service] +ExecStart= +ExecStart=-/sbin/agetty --noissue --autologin auto --noclear %I $TERM + diff --git a/roles/attendance/tasks/autologin_auto_user.yml b/roles/attendance/tasks/autologin_auto_user.yml new file mode 100644 index 0000000..56513d7 --- /dev/null +++ b/roles/attendance/tasks/autologin_auto_user.yml @@ -0,0 +1,56 @@ +--- + +- name: Setup silent login for user auto + file: + path: /home/auto/.hushlogin + state: touch + mode: 0644 + owner: auto + +- name: Create openbox config dir + file: + path: /home/auto/.config/openbox + state: directory + owner: auto + mode: 0755 + +- name: Setup openbox autostart for user auto + template: + src: autostart.j2 + dest: /home/auto/.config/openbox/autostart + mode: 0644 + owner: auto + +- name: Configure Openbox + copy: + src: openbox_rc + dest: /home/auto/.config/openbox/rc.xml + owner: auto + +- name: Start graphical screen when user logs in + copy: + src: bash_profile + dest: /home/auto/.bash_profile + mode: 0644 + owner: auto + +- name: Create autostart config dir + file: + path: /etc/systemd/system/getty@tty1.service.d + state: directory + owner: root + mode: 0755 + +- name: Login user auto when system starts + copy: + src: tty_unit + dest: /etc/systemd/system/getty@tty1.service.d/override.conf + mode: 0644 + owner: root + +- name: Restart the login service + systemd: + daemon_reload: yes + name: getty@tty1 + state: restarted + diff --git a/roles/attendance/tasks/main.yml b/roles/attendance/tasks/main.yml new file mode 100644 index 0000000..f5cd184 --- /dev/null +++ b/roles/attendance/tasks/main.yml @@ -0,0 +1,20 @@ +--- + +- name: Install required packages + apt: + update_cache: yes + pkg: '{{ required_packages }}' + +- name: Create the auto user + user: + name: auto + uid: 1001 + home: /home/auto + group: users + groups: + - video + shell: /usr/bin/bash + password: '!' + +- import_tasks: autologin_auto_user.yml + diff --git a/roles/attendance/templates/autostart.j2 b/roles/attendance/templates/autostart.j2 new file mode 100644 index 0000000..91ad652 --- /dev/null +++ b/roles/attendance/templates/autostart.j2 @@ -0,0 +1,19 @@ +# Disable any form of screen saver / screen blanking / power management +xset s off +xset s noblank +xset -dpms + +# Allow quitting the X server with CTRL-ATL-Backspace +setxkbmap -option terminate:ctrl_alt_bksp + +# Start Chromium in kiosk mode +sed -i 's/"exited_cleanly":false/"exited_cleanly":true/' \ + ~/snap/chromium/common/chromium/Local\ State +sed -i 's/"exited_cleanly":false/"exited_cleanly":true/; s/"exit_type":"[^"]\+"/"exit_type":"Normal"/' \ + ~/snap/chromium/common/chromium/Default/Preferences + +chromium-browser --disable-infobars --noerrdialogs \ + --disable-session-crashed-bubble --disable-component-update \ + --overscroll-history-navigation=0 --disable-features=Translate \ + --kiosk '{{ kiosk_url }}' + diff --git a/roles/attendance/vars/main.yml b/roles/attendance/vars/main.yml new file mode 100644 index 0000000..1fa36cf --- /dev/null +++ b/roles/attendance/vars/main.yml @@ -0,0 +1,14 @@ +--- + +required_packages: + - xserver-xorg + - xserver-xorg-video-fbdev + - x11-xserver-utils + - xinit + - xdotool + - openbox + - nitrogen + - chromium-browser + +kiosk_url: 'https://attendance.agofer.net/' +