Puppet Class: archlinux_workstation
- Defined in:
- manifests/init.pp
Overview
Main class for archlinux_workstation.
See README.markdown for advanced usage.
This class sets up your user and group and provides variables for other classes in the module.
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 |
# File 'manifests/init.pp', line 22
class archlinux_workstation (
String $username = undef,
Variant[String, Undef] $realname = undef,
Variant[String, Undef] $user_home = undef,
String $shell = '/bin/bash',
Array[String] $user_groups = ['sys'],
Variant[String, Undef] $makepkg_packager = undef,
) {
# make sure we're on arch, otherwise fail
if $::osfamily != 'Archlinux' {
fail("${::operatingsystem} not supported")
}
# user_home - default uses another param
if ! $user_home {
$real_user_home = "/home/${username}"
} else {
$real_user_home = $user_home
}
# realname - default uses another param
if $realname {
$real_name = $realname
} else {
$real_name = $username
}
validate_re($username, '^.+$', 'Parameter username must be a string for class archlinux_workstation')
validate_absolute_path($real_user_home)
# we make the user a virtual resource and then realize it so that other
# classes can append to the 'groups' attribute using plusignment
@user { $username:
ensure => present,
name => $username,
comment => $real_name,
gid => $username,
home => $real_user_home,
managehome => true,
shell => $shell,
groups => $user_groups,
require => [ Group[$username] ],
}
User <| title == $username |>
group { $username:
ensure => present,
name => $username,
system => false,
}
}
|