]> git.immae.eu Git - perso/Immae/Projets/Puppet.git/blobdiff - modules/base_configuration/manifests/init.pp
Install OVH vps from scratch
[perso/Immae/Projets/Puppet.git] / modules / base_configuration / manifests / init.pp
index a46dd8be9984c87937fa9e2531b521d28ea3bc65..8b2ce4ccb6ebba10eaa7526b802ddacab87bca49 100644 (file)
@@ -1,27 +1,59 @@
 class base_configuration (
-  $hostname = undef,
-  $username = "immae",
-  $userid   = 1000
+  $hostname  = undef,
+  $username  = "immae",
+  $userid    = 1000,
+  $code_path = undef,
+  $device    = undef,
 ) {
+  unless empty($device) {
+    class { 'grub_install':
+      device => $device,
+    }
+  }
+
+  class { 'locales': }
+
+  unless empty($code_path) {
+    class { 'cron_puppet':
+      code_path => $code_path,
+    }
+  }
+
   service { "sshd":
-    ensure => "running",
+    #ensure => "running",
     enable => true,
   }
-  service { "systemd-networkd.socket":
-    ensure => "running",
+  service { "systemd-networkd":
+    #ensure => "running",
     enable => true,
   }
-  service { "systemd-networkd":
-    ensure => "running",
+  service { "systemd-resolved":
+    #ensure => "running",
     enable => true,
   }
 
+  file { "/etc/localtime":
+    ensure => "link",
+    target => "../usr/share/zoneinfo/Europe/Paris"
+  }
+
+  exec { "set_locale":
+    command     => "/usr/bin/systemd-firstboot --locale=fr_FR.UTF-8",
+    creates     => "/etc/locale.conf",
+  }
+
   unless empty($hostname) {
-    class { 'systemd::hostname':
-      hostname => $hostname
+    exec { "set_hostname":
+      command     => "/usr/bin/systemd-firstboot --hostname=$hostname",
+      creates     => "/etc/hostname",
     }
   }
 
+  file { "/etc/vconsole.conf":
+    ensure => "link",
+    target => "/dev/null",
+  }
+
   user { "${username}:${userid}":
     name       => $username,
     uid        => $userid,
@@ -70,6 +102,42 @@ class base_configuration (
     password => '!'
   }
 
+  file { '/etc/modprobe.d/pcspkr_no_autoload.conf':
+     ensure => "present",
+     path   => "/etc/modprobe.d/pcspkr_no_autoload.conf",
+     source => 'puppet:///modules/base_configuration/pcspkr_no_autoload.conf',
+     mode   => "0644",
+     owner  => "root",
+     group  => "root"
+  }
+
+  file { '/etc/systemd/system/getty@tty1.service.d/':
+    ensure => "directory",
+    path   => "/etc/systemd/system/getty@tty1.service.d/",
+    mode   => "0755",
+    owner  => "root",
+    group  => "root"
+  }
+
+  file { '/etc/systemd/system/getty@tty1.service.d/noclear.conf':
+     ensure  => "present",
+     path    => "/etc/systemd/system/getty@tty1.service.d/noclear.conf",
+     source  => 'puppet:///modules/base_configuration/getty_conf_override.conf',
+     recurse =>  true,
+     mode    => "0644",
+     owner   => "root",
+     group   => "root"
+  }
+
+  file { '/etc/systemd/network/en-dhcp.network':
+     ensure => "present",
+     path   => "/etc/systemd/network/en-dhcp.network",
+     source => 'puppet:///modules/base_configuration/en-dhcp.network',
+     mode   => "0644",
+     owner  => "root",
+     group  => "root"
+  }
+
   file { '/etc/pacman.d/mirrorlist':
      ensure  => "present",
      path    => "/etc/pacman.d/mirrorlist",
@@ -108,7 +176,7 @@ class base_configuration (
     create_mode  => '0664',
     create_owner => 'root',
     create_group => 'utmp',
-    rotate       => '1',
+    rotate       => 1,
     minsize      => '1M',
   }
   logrotate::rule { 'btmp':
@@ -119,7 +187,7 @@ class base_configuration (
     create_mode  => '0600',
     create_owner => 'root',
     create_group => 'utmp',
-    rotate       => '1',
+    rotate       => 1,
   }
 
   ensure_packages(["whois"], { 'install_options' => '--asdeps' })
@@ -136,4 +204,6 @@ class base_configuration (
     logpath  => '',
     order    => 10
   }
+
+  class { 'aur': }
 }