summaryrefslogtreecommitdiff
path: root/roles/streaming/browser-kiosk/tasks/main.yml
blob: fbaf11f674b4d5b946eddde1a5cf1066f835dae0 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
---
- name: install packages
  apt:
    name:
    - xserver-xorg
    - xserver-xorg-video-all
    - x11-xserver-utils
    - xinit
    - unclutter
    - xterm
    - ratpoison
    - chromium
    state: present

- name: create kiosk user
  user:
    name: kiosk
    home: /var/lib/kiosk
    create_home: no
    shell: /bin/sh
    system: yes
    groups:
    - video
    - render
    state: present

- name: create empty user dir for kiosk
  file:
    path: /var/lib/kiosk
    state: directory
    owner: kiosk
    group: kiosk

- name: install .xinitrc
  copy:
    content: |
      xset dpms force on
      xset dpms 0 0 0
      xset s off
      xsetroot -solid '#000000'

      {% if browser_kiosk_xinit_commands_extra is defined %}
      {{ browser_kiosk_xinit_commands_extra }}

      {% endif %}
      unclutter &
      ratpoison &
      /var/lib/kiosk/run
    dest: /var/lib/kiosk/.xinitrc
    owner: kiosk
    group: kiosk

- name: install .profile
  copy:
    content: |
      if [ -z "$DISPLAY" ]; then
        case $(tty) in
          /dev/tty1)
            startx
            exit 0
            ;;
        esac
      fi
    dest: /var/lib/kiosk/.profile
    owner: kiosk
    group: kiosk

- name: install .ratpoisonrc
  copy:
    content: |
      set border 0
    dest: /var/lib/kiosk/.ratpoisonrc
    owner: kiosk
    group: kiosk

- name: install run script
  copy:
    content: "{{ browser_kiosk_run_script }}"
    dest: /var/lib/kiosk/run
    owner: kiosk
    group: kiosk
    mode: 0755

- name: create override direcotry for getty@tty1 service unit
  file:
    path: /etc/systemd/system/getty@tty1.service.d
    state: directory

- name: generate override for getty@tty1 service unit
  copy:
    content: |
      [Service]
      ExecStart=
      ExecStart=-/sbin/agetty --autologin kiosk --noclear %I $TERM
      RestartSec=2
      StartLimitInterval=5
      StartLimitBurst=3
    dest: /etc/systemd/system/getty@tty1.service.d/autologin.conf

- name: make sure getty@tty1 service unit is enabled and started
  systemd:
    daemon_reload: yes
    name: getty@tty1.service
    state: started
    enabled: yes