summaryrefslogtreecommitdiff
path: root/manifests/workstation.pp
blob: cb11a674e3189287e2c1c339a4cb14cce399946a (plain)
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
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
class profiles::workstation (
  String $xkb_layout = 'planck',
  String $xkb_variant = 'dvorak_a6',
  String $xkb_options = 'compose:caps',
) {
  $os_name = $facts['os']['name'].downcase()
  if defined($os_name) {
    include "::profiles::workstation::name::${os_name}"
  }

  $os_fam = $facts['os']['family'].downcase()
  if defined($os_fam) {
    include "::profiles::workstation::family::${os_fam}"
  }

  include ::profiles::group_profile

  include ::profiles::repo

  if ($facts['systemd']) {
    file { 'User ssh-agent service':
      path   => '/etc/systemd/user/ssh-agent.service',
      source => "puppet:///modules/profiles/ssh-agent.service",
    }
  }

  # NOTE Hard coding checksums here kind of defeats the point of
  # pulling in data from above (since we no longer get updates),
  # but since GitHub doesn't send checksum headers the files gets
  # updated every time otherwise, which creates noise.

  file { 'Dvorak A6 TTY keyboard layout':
    ensure         => file,
    path           => '/usr/share/kbd/keymaps/i386/dvorak/dvorak-sv-a6.map',
    checksum       => 'md5',
    checksum_value => '96be6c1aa81522db46673c0f68e3336a',
    source         => 'https://raw.githubusercontent.com/HugoNikanor/keymaps/master/linux-tty/dvorak-sv-a6.map',
  }

  file { 'Dvorak A6 X11 keyboard layout':
    ensure         => file,
    path           => '/usr/share/X11/xkb/symbols/planck',
    checksum       => 'md5',
    checksum_value => '1f1023f6958916de592695cedbc94e5c',
    source         => 'https://raw.githubusercontent.com/HugoNikanor/keymaps/master/X11/planck',
  }

  file { '/etc/X11/xorg.conf.d':
    ensure  => directory,
    recurse => false,
  }

  file { 'X11 Raise max clients':
    ensure  => file,
    path    => '/etc/X11/xorg.conf.d/99-maxclients.conf',
    content => @(EOF)
      Section "ServerFlags"
        Option "MaxClients" "2048"
      EndSection
      | EOF
  }

  file { 'Default X11 keymap':
    ensure  => file,
    path    => '/etc/X11/xorg.conf.d/00-keyboard.conf',
    content => @("EOF")
      Section "InputClass"
        Identifier "system-keyboard"
        MatchIsKeyboard "on"
        Option "XkbLayout" "${xkb_layout}"
        Option "XkbModel" "pc105"
        Option "XkbVariant" "${xkb_variant}"
        Option "XkbOptions" "${xkb_options}"
      EndSection
      | EOF
  }

  file { 'Model M X11 keymap':
    ensure  => file,
    path    => '/etc/X11/xorg.conf.d/01-model-m.conf',
    content => @(EOF)
      Section "InputClass"
        Identifier "Model M"
        MatchUSBID "17f6:0822"
        Option "XkbLayout" "us"
        Option "XkbVariant" "dvorak"
      EndSection
      | EOF
  }

  file { 'Setup console':
    ensure  => file,
    path    => '/etc/vconsole.conf',
    content =>  epp('profiles/keyvalue.epp', { 'values' => {
      'KEYMAP' => 'dvorak-sv-a6',
      'FONT'   => 'lat9v-12',
    }}),
  }

  $cowpath = [
    '/usr/share/cows',
    '/usr/local/share/cows',
  ]

  # Merge everything from hiera, but provide defeaults for
  # non-overwritten values.
  $default_environment = {
    'COWPATH'  => $cowpath.join(':'),
  }
  $user_environment = lookup('environment', undef, 'hash', {})
  $environment = $default_environment + $user_environment

  file { '/etc/environment':
    content => epp('profiles/keyvalue.epp', { values => $environment }),
  }

  file { 'Passmenu with OTP support':
    path   => '/usr/local/bin/passmenu',
    mode   => '0555',
    source => 'puppet:///modules/profiles/passmenu',
  }

  include ::profiles::sudo
  include ::profiles::mounts
}