summaryrefslogtreecommitdiff
path: root/chaos-at-home/ch-equinox-t450s.yml
blob: 9022f337f10fcf959088e32e38f0d2bab3aa9383 (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
---
- name: Basic Setup
  hosts: ch-equinox-t450s
  roles:
  - role: apt-repo/base
  - role: core/base
  - role: core/sshd/base
  - role: core/zsh
  - role: core/cpu-microcode
  - role: apt-repo/backports
  - role: apt-repo/spreadspace
  - role: apt-repo/ansible
  - role: apt-repo/tor-project
  - role: apt-repo/kubic-project
  - role: apt-repo/kubernetes
  - role: apt-repo/riot
  - role: apt-repo/brave
  - role: apt-repo/nordvpn
  - role: apt-repo/freecad
  - role: apt-repo/kicad6
  - role: storage/zfs/pools
  - role: storage/zfs/sanoid
  - role: ws/base
  - role: core/admin-users
  - role: network/wireguard/base
  - role: ws/minet
  post_tasks:
  - name: disable caps-lock
    lineinfile:
      path: /etc/default/keyboard
      regexp: '#?\s*XKBOPTIONS='
      line: 'XKBOPTIONS="caps:none"'

    ## TODO install autostart and keyboard shortcut Ctrl+P
  - name: install touchpad control script
    copy:
      dest: /usr/local/bin/touchpadctl
      mode: 0755
      content: |
        #!/bin/bash

        ID=$(xinput list | grep "SynPS/2 Synaptics TouchPad" | sed 's/^.*id=\([0-9]*\).*$/\1/')
        if [ -z "$ID" ]; then
          ID=$(xinput list | grep "Synaptics TM3053-004" | sed 's/^.*id=\([0-9]*\).*$/\1/')
        fi

        if [ -z "$ID" ]; then
          echo "cannot find device!"
          exit 1
        fi

        if [ -n "ID" ]; then
          case $1 in
            enable|disable)
              xinput $1 $ID
              ;;
            toggle)
              CURRENT_STATE=$(xinput list-props $ID | grep 'Device Enabled' | awk 'BEGIN { FS = ":" } ; { print $2 }' | sed 's/^.*\([01]\).*$/\1/')
              if [ $CURRENT_STATE -ne 1 ]; then
                xinput enable $ID
              else
                xinput disable $ID
              fi
              ;;
            *)
              echo "usage: $0 (enable|disable|toggle)"
              ;;
          esac
        else
          echo "Touchpad not found..."
        fi

  - name: mask virtualbox web service unit
    systemd:
      name: vboxweb.service
      masked: true
      state: stopped

  - name: add flathub to systemd-wide flatpak remotes
    community.general.flatpak_remote:
      name: flathub
      flatpakrepo_url: https://flathub.org/repo/flathub.flatpakrepo
      state: present