commit 830ca960a293751f78f841903a45e0ef0d2774d3 Author: Gardais Jérémy Date: Mon Nov 28 11:01:55 2016 +0100 Init repo diff --git a/manifests/config.pp b/manifests/config.pp new file mode 100644 index 0000000..2c1d7fd --- /dev/null +++ b/manifests/config.pp @@ -0,0 +1,22 @@ +# == Private class: root::configuration +# +class root::configuration { + + File { + owner => root, + group => root, + mode => 600, + } + + # Set .profile and bashrc files + file { $root::profile_path: + ensure => present, + content => template($root::profile_content), + } + + file { $root::bashrc_path: + ensure => present, + content => template($root::bashrc_content), + } + +} # Private class: root::configuration diff --git a/manifests/init.pp b/manifests/init.pp new file mode 100644 index 0000000..251b60c --- /dev/null +++ b/manifests/init.pp @@ -0,0 +1,47 @@ +# == Class: root +# +# Define some root's preferences +# +# === Parameters +# +# Document parameters here. +# +# [*sample_parameter*] +# Explanation of what this parameter affects and what it defaults to. +# e.g. "Specify one or more upstream ntp servers as an array." +# +# === Variables +# +# Here you should define a list of variables that this module would require. +# +# [*sample_variable*] +# Explanation of how this variable affects the funtion of this class and if +# it has a default. e.g. "The parameter enc_ntp_servers must be set by the +# External Node Classifier as a comma separated list of hostnames." (Note, +# global variables should be avoided in favor of class parameters as +# of Puppet 2.6.) +# +# === Examples +# +# class { 'root': +# servers => [ 'pool.ntp.org', 'ntp.local.company.com' ], +# } +# +# === Authors +# +# Author Name +# +# === Copyright +# +# Copyright 2016 Your name here, unless otherwise noted. +# +class root ( + $profile_path = $root::params::profile_path, + $profile_content = $root::params::profile_content, + $bashrc_path = $root::params::bashrc_path, + $bashrc_content = $root::params::bashrc_content, +) inherits root::params { + + include '::root::config' + +} # public class : root diff --git a/manifests/params.pp b/manifests/params.pp new file mode 100644 index 0000000..882dbfb --- /dev/null +++ b/manifests/params.pp @@ -0,0 +1,11 @@ +# == Private class: root::params +# +class root::params { + + $profile_path = '/root/.profile' + $profile_content = 'root/preferences/profile.erb' + + $bashrc_path = 'root/.bashrc' + $bashrc_content = 'root/preferences/bashrc.erb' + +} # Private class: root::params diff --git a/templates/preferences/bashrc.erb b/templates/preferences/bashrc.erb new file mode 100644 index 0000000..373f2a0 --- /dev/null +++ b/templates/preferences/bashrc.erb @@ -0,0 +1,20 @@ +# ~/.bashrc: executed by bash(1) for non-login shells. + +# Note: PS1 and umask are already set in /etc/profile. You should not +# need this unless you want different defaults for root. +# PS1='${debian_chroot:+($debian_chroot)}\h:\w\$ ' +# umask 022 + +# You may uncomment the following lines if you want `ls' to be colorized: +# export LS_OPTIONS='--color=auto' +# eval "`dircolors`" +# alias ls='ls $LS_OPTIONS' +# alias ll='ls $LS_OPTIONS -l' +# alias l='ls $LS_OPTIONS -lA' +# +# Some more alias to avoid making mistakes: +# alias rm='rm -i' +# alias cp='cp -i' +# alias mv='mv -i' + +alias z='zsh' diff --git a/templates/preferences/profile.erb b/templates/preferences/profile.erb new file mode 100644 index 0000000..f577492 --- /dev/null +++ b/templates/preferences/profile.erb @@ -0,0 +1,17 @@ +# ~/.profile: executed by Bourne-compatible login shells. + +if [ "$BASH" ]; then + if [ -f ~/.bashrc ]; then + . ~/.bashrc + fi +fi + +ZSH_IP="(129.20.79.141|129.20.79.142)" + +if [ "$(echo "${SSH_CLIENT}" | grep -E "${ZSH_IP}")" ]; then + printf '%b' "Launch ZSH\n" + exec zsh +fi + + +mesg n