Skip to content

Instantly share code, notes, and snippets.

@Floppy
Last active June 14, 2021 20:33
Show Gist options
  • Save Floppy/f2d9a020df2341d974ac44024e20c7bf to your computer and use it in GitHub Desktop.
Save Floppy/f2d9a020df2341d974ac44024e20c7bf to your computer and use it in GitHub Desktop.
Ansible files for Joggler dashboard configuration
homeassistant:
customize: !include customize.yaml
auth_providers:
# Don't require login on local network
- type: trusted_networks
trusted_networks:
- 192.168.1.0/24
- 2001:xxxx:xxxx::/64
- fe80::/10
allow_bypass_login: true
- type: homeassistant
#!/bin/bash
sh -c "echo 0 > /sys/class/rtc/rtc0/wakealarm"
sh -c "echo `date '+%s' -d '+ 450 minutes'` > /sys/class/rtc/rtc0/wakealarm"
/sbin/shutdown -h now
---
- name: Install X etc
apt:
name:
- xserver-xorg
- xserver-xorg-legacy
- x11-utils
- xinit
- accountsservice
- lightdm
- chromium-browser
- unclutter
state: present
install_recommends: no
- name: Enable auto-login to x for user
copy:
content: |
[Seat:*]
autologin-user={{ dashboard.user }}
autologin-user-timeout=0
user-session=xsession
dest: /etc/lightdm/lightdm.conf.d/autologin.conf
mode: '0644'
notify: restart lightdm
- name: Create Xsession directory
file:
path: /usr/share/xsessions
state: directory
mode: '0755'
- name: Set up default Xsession
copy:
content: |
[Desktop Entry]
Name=Xsession
Comment=Default Xsession
Exec=/etc/X11/Xsession
Icon=
dest: /usr/share/xsessions/xsession.desktop
mode: '0644'
notify: restart lightdm
- name: Set up xsession for user
template:
src: xsession.j2
dest: "/home/{{ dashboard.user }}/.xsession"
mode: '0644'
notify: restart lightdm
- name: Make sure user has passwordless sudo for running fbset command
copy:
content: "{{ dashboard.user }} ALL=(ALL:ALL) NOPASSWD: /bin/fbset\n"
dest: "/etc/sudoers.d/dashboard-user"
owner: root
group: root
mode: 0444
notify: restart lightdm
- name: Time sleep and wake
copy:
src: snooze.sh
dest: "/usr/local/bin/snooze.sh"
owner: root
group: root
mode: 0755
- name: Sleep at midnight
cron:
name: snooze
user: root
hour: "0"
minute: "0"
job: "/usr/local/bin/snooze.sh"
# Set this to your URL - it must return a 200 OK when called, not a redirect.
export URL={{dashboard.url}}
# Dont want screensavers or screen blanking
xset s off &
xset -dpms &
xset s noblank &
# Hide the mouse cursor
unclutter -idle 10 -noevents &
# get screen resolution
WIDTH=`sudo fbset -s | grep "geometry" | cut -d " " -f6`
HEIGHT=`sudo fbset -s | grep "geometry" | cut -d " " -f7`
# Open chrome in incognito mode + kiosk mode
/usr/bin/chromium-browser --window-size=${WIDTH},${HEIGHT} --window-position=0,0 --hide-scrollbars --incognito --kiosk ${URL}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment