diff options
-rw-r--r-- | files/puppet-add-sarava-submodules | 14 | ||||
-rw-r--r-- | manifests/default-conf.pp | 52 | ||||
-rw-r--r-- | templates/bin/puppet-bootstrap | 34 |
3 files changed, 60 insertions, 40 deletions
diff --git a/files/puppet-add-sarava-submodules b/files/puppet-add-sarava-submodules deleted file mode 100644 index 81c8eda..0000000 --- a/files/puppet-add-sarava-submodules +++ /dev/null @@ -1,14 +0,0 @@ -#!/bin/sh - -git init -git add . - -mkdir -p ./modules - -repos="`lynx -dump http://git.sarava.org/?a=project_index | awk '{ print $1 }' | grep ^puppet-`" -for repo in $repos; do - module="`basename $repo .git | cut -d - -f 2`" - if [ ! -d "modules/$module" ]; then - git submodule add git://git.sarava.org/puppet-$module.git modules/$module - fi -done diff --git a/manifests/default-conf.pp b/manifests/default-conf.pp index b1453a3..c81970d 100644 --- a/manifests/default-conf.pp +++ b/manifests/default-conf.pp @@ -17,12 +17,12 @@ host { "$hostname": # puppet submodules script file { "/usr/local/sbin/puppet-bootstrap": - source => "files/puppet-bootstrap", owner => "root", group => "root", mode => 0755, ensure => present, require => Package["puppet"], + content => template("bin/puppet-bootstrap"), } # execute the bootstrap script to download puppet modules @@ -62,7 +62,7 @@ file { "$default_puppet_conf_dir/puppet.conf": group => "puppet", mode => 0644, require => Package["puppet"], - content => template("bootstrap/puppet/puppet.conf.erb"), + content => template("puppet/puppet.conf.erb"), } file { "$default_puppet_conf_dir/fileserver.conf": @@ -71,7 +71,7 @@ file { "$default_puppet_conf_dir/fileserver.conf": group => "puppet", mode => 0644, require => Package["puppet"], - content => template("bootstrap/puppet/fileserver.conf.erb"), + content => template("puppet/fileserver.conf.erb"), } file { "$default_puppet_conf_dir/auth.conf": @@ -80,7 +80,7 @@ file { "$default_puppet_conf_dir/auth.conf": group => "puppet", mode => 0644, require => Package["puppet"], - content => template("bootstrap/puppet/auth.conf.erb"), + content => template("puppet/auth.conf.erb"), } # files in $default_puppet_conf_dir/manifests @@ -90,7 +90,7 @@ file { "$default_puppet_conf_dir/manifests/site.pp": group => "puppet", mode => 0644, require => [ Package["puppet"], File["$default_puppet_conf_dir/manifests"] ], - content => template("bootstrap/puppet/site.pp.erb"), + content => template("puppet/site.pp.erb"), } file { "$default_puppet_conf_dir/manifests/modules.pp": @@ -99,7 +99,7 @@ file { "$default_puppet_conf_dir/manifests/modules.pp": group => "puppet", mode => 0644, require => [ Package["puppet"], File["$default_puppet_conf_dir/manifests"] ], - content => template("bootstrap/puppet/modules.pp.erb"), + content => template("puppet/modules.pp.erb"), } file { "$default_puppet_conf_dir/manifests/nodes.pp": @@ -108,7 +108,7 @@ file { "$default_puppet_conf_dir/manifests/nodes.pp": group => "puppet", mode => 0644, require => [ Package["puppet"], File["$default_puppet_conf_dir/manifests"] ], - content => template("bootstrap/puppet/nodes.pp.erb"), + content => template("puppet/nodes.pp.erb"), } # files in $default_puppet_conf_dir/manifests/classes @@ -118,7 +118,7 @@ file { "$default_puppet_conf_dir/manifests/classes/websites.pp": group => "puppet", mode => 0644, require => [ Package["puppet"], File["$default_puppet_conf_dir/manifests/classes"] ], - content => template("bootstrap/puppet/websites.pp.erb"), + content => template("puppet/websites.pp.erb"), } file { "$default_puppet_conf_dir/manifests/classes/users.pp": @@ -127,7 +127,7 @@ file { "$default_puppet_conf_dir/manifests/classes/users.pp": group => "puppet", mode => 0644, require => [ Package["puppet"], File["$default_puppet_conf_dir/manifests/classes"] ], - content => template("bootstrap/puppet/users.pp.erb"), + content => template("puppet/users.pp.erb"), } # files in $default_puppet_conf_dir/manifests/nodes @@ -137,7 +137,7 @@ file { "$default_puppet_conf_dir/manifests/nodes/$hostname-server.pp": group => "puppet", mode => 0644, require => [ Package["puppet"], File["$default_puppet_conf_dir/manifests/nodes"] ], - content => template("bootstrap/puppet/server.pp.erb"), + content => template("puppet/server.pp.erb"), } file { "$default_puppet_conf_dir/manifests/nodes/$hostname-master.pp": @@ -146,7 +146,7 @@ file { "$default_puppet_conf_dir/manifests/nodes/$hostname-master.pp": group => "puppet", mode => 0644, require => [ Package["puppet"], File["$default_puppet_conf_dir/manifests/nodes"] ], - content => template("bootstrap/puppet/master.pp.erb"), + content => template("puppet/master.pp.erb"), } file { "$default_puppet_conf_dir/manifests/nodes/$hostname-proxy.pp": @@ -155,7 +155,7 @@ file { "$default_puppet_conf_dir/manifests/nodes/$hostname-proxy.pp": group => "puppet", mode => 0644, require => [ Package["puppet"], File["$default_puppet_conf_dir/manifests/nodes"] ], - content => template("bootstrap/puppet/proxy.pp.erb"), + content => template("puppet/proxy.pp.erb"), } file { "$default_puppet_conf_dir/manifests/nodes/$hostname-web.pp": @@ -164,7 +164,7 @@ file { "$default_puppet_conf_dir/manifests/nodes/$hostname-web.pp": group => "puppet", mode => 0644, require => [ Package["puppet"], File["$default_puppet_conf_dir/manifests/nodes"] ], - content => template("bootstrap/puppet/web.pp.erb"), + content => template("puppet/web.pp.erb"), } file { "$default_puppet_conf_dir/manifests/nodes/$hostname-storage.pp": @@ -173,7 +173,7 @@ file { "$default_puppet_conf_dir/manifests/nodes/$hostname-storage.pp": group => "puppet", mode => 0644, require => [ Package["puppet"], File["$default_puppet_conf_dir/manifests/nodes"] ], - content => template("bootstrap/puppet/storage.pp.erb"), + content => template("puppet/storage.pp.erb"), } file { "$default_puppet_conf_dir/manifests/nodes/$hostname-test.pp": @@ -182,7 +182,7 @@ file { "$default_puppet_conf_dir/manifests/nodes/$hostname-test.pp": group => "puppet", mode => 0644, require => [ Package["puppet"], File["$default_puppet_conf_dir/manifests/nodes"] ], - content => template("bootstrap/puppet/test.pp.erb"), + content => template("puppet/test.pp.erb"), } @@ -220,7 +220,7 @@ file { "$default_puppet_conf_dir/files/apache/htdocs/index.html": group => "puppet", mode => 0644, require => [ Package["puppet"], File["$default_puppet_conf_dir/files/apache/htdocs"] ], - content => template("files/apache/htdocs/index.html.erb"), + content => template("apache/htdocs/index.html.erb"), } file { "$default_puppet_conf_dir/files/apache/htdocs/missing.html": @@ -229,7 +229,7 @@ file { "$default_puppet_conf_dir/files/apache/htdocs/missing.html": group => "puppet", mode => 0644, require => [ Package["puppet"], File["$default_puppet_conf_dir/files/apache/htdocs"] ], - content => template("files/apache/htdocs/missing.html.erb"), + content => template("apache/htdocs/missing.html.erb"), } file { "$default_puppet_conf_dir/files/apache/vhosts/git": @@ -238,7 +238,7 @@ file { "$default_puppet_conf_dir/files/apache/vhosts/git": group => "puppet", mode => 0644, require => [ Package["puppet"], File["$default_puppet_conf_dir/files/apache/vhosts"] ], - content => template("files/apache/vhosts/git.erb"), + content => template("apache/vhosts/git.erb"), } file { "$default_puppet_conf_dir/files/apache/vhosts/lists": @@ -247,7 +247,7 @@ file { "$default_puppet_conf_dir/files/apache/vhosts/lists": group => "puppet", mode => 0644, require => [ Package["puppet"], File["$default_puppet_conf_dir/files/apache/vhosts"] ], - content => template("files/apache/vhosts/lists.erb"), + content => template("apache/vhosts/lists.erb"), } file { "$default_puppet_conf_dir/files/apache/vhosts/mail": @@ -256,7 +256,7 @@ file { "$default_puppet_conf_dir/files/apache/vhosts/mail": group => "puppet", mode => 0644, require => [ Package["puppet"], File["$default_puppet_conf_dir/files/apache/vhosts"] ], - content => template("files/apache/vhosts/mail.erb"), + content => template("apache/vhosts/mail.erb"), } file { "$default_puppet_conf_dir/files/apache/vhosts/nagios": @@ -265,7 +265,7 @@ file { "$default_puppet_conf_dir/files/apache/vhosts/nagios": group => "puppet", mode => 0644, require => [ Package["puppet"], File["$default_puppet_conf_dir/files/apache/vhosts"] ], - content => template("files/apache/vhosts/nagios.erb"), + content => template("apache/vhosts/nagios.erb"), } file { "$default_puppet_conf_dir/files/apache/vhosts/wiki": @@ -274,7 +274,7 @@ file { "$default_puppet_conf_dir/files/apache/vhosts/wiki": group => "puppet", mode => 0644, require => [ Package["puppet"], File["$default_puppet_conf_dir/files/apache/vhosts"] ], - content => template("files/apache/vhosts/wiki.erb"), + content => template("apache/vhosts/wiki.erb"), } file { "$default_puppet_conf_dir/files/etc/aliases": @@ -283,7 +283,7 @@ file { "$default_puppet_conf_dir/files/etc/aliases": group => "puppet", mode => 0644, require => [ Package["puppet"], File["$default_puppet_conf_dir/files/etc"] ], - content => template("files/etc/aliases.erb"), + content => template("etc/aliases.erb"), } file { "$default_puppet_conf_dir/files/etc/nagios3/htpasswd.users": @@ -292,7 +292,7 @@ file { "$default_puppet_conf_dir/files/etc/nagios3/htpasswd.users": group => "puppet", mode => 0644, require => [ Package["puppet"], File["$default_puppet_conf_dir/files/etc/nagios3.users"] ], - content => template("files/etc/nagios3/htpasswd.users.erb"), + content => template("etc/nagios3/htpasswd.users.erb"), } file { "$default_puppet_conf_dir/files/etc/nginx/$domain": @@ -301,7 +301,7 @@ file { "$default_puppet_conf_dir/files/etc/nginx/$domain": group => "puppet", mode => 0644, require => [ Package["puppet"], File["$default_puppet_conf_dir/files/etc/nginx"] ], - content => template("files/etc/nginx/domain.erb"), + content => template("etc/nginx/domain.erb"), } file { "$default_puppet_conf_dir/files/postfix/tls_policy": @@ -310,5 +310,5 @@ file { "$default_puppet_conf_dir/files/postfix/tls_policy": group => "puppet", mode => 0644, require => [ Package["puppet"], File["$default_puppet_conf_dir/files/postfix"] ], - content => template("files/postfix/tls_policy.erb"), + content => template("postfix/tls_policy.erb"), } diff --git a/templates/bin/puppet-bootstrap b/templates/bin/puppet-bootstrap new file mode 100644 index 0000000..6c16f3f --- /dev/null +++ b/templates/bin/puppet-bootstrap @@ -0,0 +1,34 @@ +#!/bin/sh + +puppet_dir=<%= puppet_dir %> + +function usage { + echo "Usage: $1 add-submodules" + exit $2 +} + +function add_submodules { + cd $puppet_dir + git init + git add . + mkdir -p ./modules + + repos="`lynx -dump http://git.sarava.org/?a=project_index | awk '{ print $1 }' | grep ^puppet-`" + for repo in $repos; do + module="`basename $repo .git | cut -d - -f 2`" + if [ ! -d "modules/$module" ]; then + git submodule add git://git.sarava.org/puppet-$module.git modules/$module + fi + done +} + +if [[ $# -ne 1 ]]; then + usage $0 1 + exit 1 +fi + +case $1 in + add-submodules) add_submodules ;; + help) usage $0 0 ;; + *) usage $0 1; exit 1 ;; +esac |