From: Ismaƫl Bouya Date: Tue, 9 Aug 2016 14:05:26 +0000 (+0200) Subject: Add base configuration X-Git-Url: https://git.immae.eu/?a=commitdiff_plain;h=f860f6d2b475fa611af2b6a66ee1c774757b77f4;p=perso%2FImmae%2FProjets%2FPuppet.git Add base configuration --- diff --git a/.gitmodules b/.gitmodules index 6792f86..b4b4ba5 100644 --- a/.gitmodules +++ b/.gitmodules @@ -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 index 0000000..e69de29 diff --git a/manifests/install_ovh.pp b/manifests/install_ovh.pp index 48c3eff..41a9ad2 100644 --- a/manifests/install_ovh.pp +++ b/manifests/install_ovh.pp @@ -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 index 0000000..4c6ca1e --- /dev/null +++ b/modules/base_configuration/manifests/init.pp @@ -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', + } + } +} diff --git a/modules/base_packages/manifests/init.pp b/modules/base_packages/manifests/init.pp index a935d1b..269ca58 100644 --- a/modules/base_packages/manifests/init.pp +++ b/modules/base_packages/manifests/init.pp @@ -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 index 0000000..bdf9232 --- /dev/null +++ b/modules/concat @@ -0,0 +1 @@ +Subproject commit bdf92329db427b7e202cf762091985ea6b64b3c8 diff --git a/modules/inifile b/modules/inifile new file mode 160000 index 0000000..3099468 --- /dev/null +++ b/modules/inifile @@ -0,0 +1 @@ +Subproject commit 3099468f61d0f0c7465c61279376a7e68cef0352 diff --git a/modules/ssh b/modules/ssh new file mode 160000 index 0000000..d0c77c0 --- /dev/null +++ b/modules/ssh @@ -0,0 +1 @@ +Subproject commit d0c77c06b7d9e03c9c30f564605e07535ee8f5c9 diff --git a/modules/sudo b/modules/sudo new file mode 160000 index 0000000..6dad853 --- /dev/null +++ b/modules/sudo @@ -0,0 +1 @@ +Subproject commit 6dad85360bf119368a2fe396da2e22c81e01f4dd diff --git a/modules/systemd b/modules/systemd new file mode 160000 index 0000000..b0a93b8 --- /dev/null +++ b/modules/systemd @@ -0,0 +1 @@ +Subproject commit b0a93b8c4fa18f1f2c477c5348e9bccd3bdebd6b