]> git.immae.eu Git - perso/Immae/Projets/Puppet.git/blob - modules/base_configuration/manifests/init.pp
Add base configuration
[perso/Immae/Projets/Puppet.git] / modules / base_configuration / manifests / init.pp
1 class base_configuration (
2 $hostname = undef,
3 $username = "immae",
4 $userid = 1000
5 ) {
6 unless empty($hostname) {
7 class { 'systemd::hostname':
8 hostname => $hostname
9 }
10 }
11
12 user { "${username}:${userid}":
13 name => $username,
14 uid => $userid,
15 ensure => "present",
16 groups => "wheel",
17 managehome => true,
18 notify => Exec["remove_password"]
19 }
20
21 exec { "remove_password":
22 command => "/usr/bin/chage -d 0 $username && /usr/bin/passwd -d $username",
23 refreshonly => true
24 }
25
26 ssh_authorized_key { $username:
27 name => "immae@immae.eu",
28 user => $username,
29 type => "ssh-rsa",
30 key => "AAAAB3NzaC1yc2EAAAADAQABAAABAQDi5PgLBwMRyRwzJPnSgUyRAuB9AAxMijsw1pR/t/wmxQne1O5fIPOleHx+D8dyZbwm+XkzlcJpgT0Qy3qC9J8BPhshJvO/tA/8CI/oS/FE0uWsyACH1DMO2dk4gRRZGSE9IuzDMRPlnfZ3n0tdsPzzv3GH4It/oPIgsvkTowKztGLQ7Xmjr5BxzAhXcIQymqA0U3XWHSdWvnSRDaOFG0PDoVMS85IdwlviVKLnV5Sstb4NC/P28LFfgvW8DO/XrOqujgDomqTmR41dK/AyrGGOb2cQUMO4l8Oa+74aOyKaB61rr/rJkr+wCbEttkTvgFa6zZygSk3edfiWE2rgn4+v"
31 }
32
33 class { 'sudo':
34 config_file_replace => false
35 }
36
37 sudo::conf { 'wheel':
38 priority => 10,
39 content => "%wheel ALL=(ALL) ALL"
40 }
41
42 class { 'ssh::server':
43 storeconfigs_enabled => false,
44 options => {
45 'AcceptEnv' => undef,
46 'X11Forwarding' => 'yes',
47 'PrintMotd' => 'no',
48 'ChallengeResponseAuthentication' => 'no',
49 'Subsystem' => 'sftp /usr/lib/openssh/sftp-server',
50 }
51 }
52 }