]> git.immae.eu Git - perso/Immae/Projets/Puppet.git/commitdiff
Add base configuration
authorIsmaël Bouya <ismael.bouya@normalesup.org>
Tue, 9 Aug 2016 14:05:26 +0000 (16:05 +0200)
committerIsmaël Bouya <ismael.bouya@normalesup.org>
Tue, 9 Aug 2016 15:58:53 +0000 (17:58 +0200)
.gitmodules
hiera.yaml [new file with mode: 0644]
manifests/install_ovh.pp
modules/base_configuration/manifests/init.pp [new file with mode: 0644]
modules/base_packages/manifests/init.pp
modules/concat [new submodule]
modules/inifile [new submodule]
modules/ssh [new submodule]
modules/sudo [new submodule]
modules/systemd [new submodule]

index 6792f860e969c6c264aec670048d6ff0042ae980..b4b4ba5e0d005993091b075b934ec9d274445e50 100644 (file)
@@ -4,3 +4,18 @@
 [submodule "modules/reboot"]
        path = modules/reboot
        url = https://github.com/puppetlabs/puppetlabs-reboot.git
+[submodule "modules/systemd"]
+       path = modules/systemd
+       url = https://github.com/jkroepke/puppet-systemd.git
+[submodule "modules/inifile"]
+       path = modules/inifile
+       url = https://github.com/puppetlabs/puppetlabs-inifile.git
+[submodule "modules/sudo"]
+       path = modules/sudo
+       url = https://github.com/saz/puppet-sudo.git
+[submodule "modules/ssh"]
+       path = modules/ssh
+       url = https://github.com/saz/puppet-ssh.git
+[submodule "modules/puppetlabs_concat"]
+       path = modules/concat
+       url = https://github.com/puppetlabs/puppetlabs-concat.git
diff --git a/hiera.yaml b/hiera.yaml
new file mode 100644 (file)
index 0000000..e69de29
index 48c3effdda3539492936ab1dcb436cae3ce4a06c..41a9ad22023c9def3ab0da241fcad4d8f79f95bd 100644 (file)
@@ -5,6 +5,9 @@ node default {
     class { 'base_packages': }
     class { 'locales': }
     class { 'cron_puppet': }
+    class { 'base_configuration':
+      hostname => 'new.immae.eu'
+    }
 
     reboot { 'after_run':
       apply => 'finished'
diff --git a/modules/base_configuration/manifests/init.pp b/modules/base_configuration/manifests/init.pp
new file mode 100644 (file)
index 0000000..4c6ca1e
--- /dev/null
@@ -0,0 +1,52 @@
+class base_configuration (
+  $hostname = undef,
+  $username = "immae",
+  $userid   = 1000
+) {
+  unless empty($hostname) {
+    class { 'systemd::hostname':
+      hostname => $hostname
+    }
+  }
+
+  user { "${username}:${userid}":
+    name       => $username,
+    uid        => $userid,
+    ensure     => "present",
+    groups     => "wheel",
+    managehome => true,
+    notify     => Exec["remove_password"]
+  }
+
+  exec { "remove_password":
+    command     => "/usr/bin/chage -d 0 $username && /usr/bin/passwd -d $username",
+    refreshonly => true
+  }
+
+  ssh_authorized_key { $username:
+    name => "immae@immae.eu",
+    user => $username,
+    type => "ssh-rsa",
+    key  => "AAAAB3NzaC1yc2EAAAADAQABAAABAQDi5PgLBwMRyRwzJPnSgUyRAuB9AAxMijsw1pR/t/wmxQne1O5fIPOleHx+D8dyZbwm+XkzlcJpgT0Qy3qC9J8BPhshJvO/tA/8CI/oS/FE0uWsyACH1DMO2dk4gRRZGSE9IuzDMRPlnfZ3n0tdsPzzv3GH4It/oPIgsvkTowKztGLQ7Xmjr5BxzAhXcIQymqA0U3XWHSdWvnSRDaOFG0PDoVMS85IdwlviVKLnV5Sstb4NC/P28LFfgvW8DO/XrOqujgDomqTmR41dK/AyrGGOb2cQUMO4l8Oa+74aOyKaB61rr/rJkr+wCbEttkTvgFa6zZygSk3edfiWE2rgn4+v"
+  }
+
+  class { 'sudo':
+    config_file_replace => false
+  }
+
+  sudo::conf { 'wheel':
+    priority => 10,
+    content  => "%wheel ALL=(ALL) ALL"
+  }
+
+  class { 'ssh::server':
+     storeconfigs_enabled => false,
+     options => {
+        'AcceptEnv'                       => undef,
+        'X11Forwarding'                   => 'yes',
+        'PrintMotd'                       => 'no',
+        'ChallengeResponseAuthentication' => 'no',
+        'Subsystem'                       => 'sftp /usr/lib/openssh/sftp-server',
+     }
+  }
+}
index a935d1b1ebad50f08eb5074779b7a1b636b2cfa8..269ca585abe36c0d4d9fdd688acfc3362b04c98d 100644 (file)
@@ -1,24 +1,8 @@
 class base_packages {
     # Preinstalled
-    package { 'base':
-      ensure => 'latest',
-    }
-    package { 'openssh':
-      ensure => 'latest',
-    }
-    package { 'grub':
-      ensure => 'latest',
-    }
-    package { 'sudo':
-      ensure => 'latest',
-    }
+    ensure_packages(['base', 'openssh', 'grub', 'sudo'])
 
     # Puppet dependencies
-    package { 'git':
-      ensure => 'latest',
-    }
-    package { 'puppet':
-      ensure => 'latest',
-    }
+    ensure_packages(['git', 'puppet'])
 }
 
diff --git a/modules/concat b/modules/concat
new file mode 160000 (submodule)
index 0000000..bdf9232
--- /dev/null
@@ -0,0 +1 @@
+Subproject commit bdf92329db427b7e202cf762091985ea6b64b3c8
diff --git a/modules/inifile b/modules/inifile
new file mode 160000 (submodule)
index 0000000..3099468
--- /dev/null
@@ -0,0 +1 @@
+Subproject commit 3099468f61d0f0c7465c61279376a7e68cef0352
diff --git a/modules/ssh b/modules/ssh
new file mode 160000 (submodule)
index 0000000..d0c77c0
--- /dev/null
@@ -0,0 +1 @@
+Subproject commit d0c77c06b7d9e03c9c30f564605e07535ee8f5c9
diff --git a/modules/sudo b/modules/sudo
new file mode 160000 (submodule)
index 0000000..6dad853
--- /dev/null
@@ -0,0 +1 @@
+Subproject commit 6dad85360bf119368a2fe396da2e22c81e01f4dd
diff --git a/modules/systemd b/modules/systemd
new file mode 160000 (submodule)
index 0000000..b0a93b8
--- /dev/null
@@ -0,0 +1 @@
+Subproject commit b0a93b8c4fa18f1f2c477c5348e9bccd3bdebd6b