diff --git a/lib/puppet-standalone-mashup/capistrano.rb b/lib/puppet-standalone-mashup/capistrano.rb index 41423b5..718b5bb 100644 --- a/lib/puppet-standalone-mashup/capistrano.rb +++ b/lib/puppet-standalone-mashup/capistrano.rb @@ -49,6 +49,7 @@ Capistrano::Configuration.instance.load do task :rename do hostname = Capistrano::CLI.ui.ask("Hostname: ") + top.copy_skel run "cd #{puppet_dir} && #{sudo} ./rename #{hostname}" end diff --git a/shared/lib/puppet/provider/configure/action.rb b/shared/lib/puppet/provider/configure/action.rb index 16e7042..1550f65 100644 --- a/shared/lib/puppet/provider/configure/action.rb +++ b/shared/lib/puppet/provider/configure/action.rb @@ -2,7 +2,7 @@ Puppet::Type.type(:configure).provide(:action) do desc "Configure a program to install" def create - system %{bash -c '#{path} cd #{@resource[:build_path]} ; make clean ; make distclean ; ./configure --prefix=#{@resource[:install_path]} #{@resource[:options]}'}.tap { |o| p o } + system %{bash -c '#{path} cd #{@resource[:build_path]} ; ./configure --prefix=#{@resource[:install_path]} #{@resource[:options]}'}.tap { |o| p o } end def destroy @@ -15,7 +15,7 @@ Puppet::Type.type(:configure).provide(:action) do private def config_status - File.join(@resource[:build_path], 'config.status') + File.join(@resource[:build_path], @resource[:config_status]) end def path diff --git a/shared/lib/puppet/provider/gem/gem_install.rb b/shared/lib/puppet/provider/gem/gem_install.rb index 89e9a09..7747c9d 100644 --- a/shared/lib/puppet/provider/gem/gem_install.rb +++ b/shared/lib/puppet/provider/gem/gem_install.rb @@ -2,7 +2,7 @@ Puppet::Type.type(:gem).provide(:install) do desc "Install a Ruby Gem" def create - gem_command('install --no-ri --no-rdoc') + system gem_command('install --no-ri --no-rdoc') end def destroy @@ -25,7 +25,7 @@ Puppet::Type.type(:gem).provide(:install) do def gem_command(what) command = %{bash -c 'PATH=#{@resource[:path]} gem #{what} #{@resource[:name]} #{version}'} - %x{#{command}} + command end end diff --git a/shared/lib/puppet/provider/make_and_install/action.rb b/shared/lib/puppet/provider/make_and_install/action.rb index 5cfbcf7..ab89454 100644 --- a/shared/lib/puppet/provider/make_and_install/action.rb +++ b/shared/lib/puppet/provider/make_and_install/action.rb @@ -5,7 +5,9 @@ Puppet::Type.type(:make_and_install).provide(:action) do def create system %{bash -c '#{path} cd #{@resource[:build_path]} ; make && make install'} - File.symlink(@resource[:install_path], symlink_path) + + FileUtils.rm_rf symlink_path + FileUtils.ln_sf(@resource[:install_path], symlink_path) end def destroy diff --git a/shared/lib/puppet/type/configure.rb b/shared/lib/puppet/type/configure.rb index ddd9f55..1aa0f2a 100644 --- a/shared/lib/puppet/type/configure.rb +++ b/shared/lib/puppet/type/configure.rb @@ -19,6 +19,10 @@ Puppet::Type.newtype(:configure) do desc "Options to build the software" end + newparam(:config_status) do + desc "Relative location of config.status" + end + newparam(:path) do desc "Path for executables" end diff --git a/shared/modules/build_and_install/manifests/init.pp b/shared/modules/build_and_install/manifests/init.pp index c8b20ed..3d7f401 100644 --- a/shared/modules/build_and_install/manifests/init.pp +++ b/shared/modules/build_and_install/manifests/init.pp @@ -1,4 +1,4 @@ -define build_and_install($version, $source, $path = '', $configure = '') { +define build_and_install($version, $source, $path = '', $configure = '', $config_status = 'config.status') { $full_source = inline_template($source) $build_path = build_path($name, $version) @@ -17,6 +17,7 @@ define build_and_install($version, $source, $path = '', $configure = '') { options => $configure, path => $path, require => Download_and_unpack[$name], + config_status => $config_status, ensure => present } diff --git a/shared/modules/mkdir_p/manifests/init.pp b/shared/modules/mkdir_p/manifests/init.pp new file mode 100644 index 0000000..d1d40c0 --- /dev/null +++ b/shared/modules/mkdir_p/manifests/init.pp @@ -0,0 +1,7 @@ +define mkdir_p($path) { + exec { "mkdir -p ${name}": + path => $path, + unless => "test -d ${name}" + } +} + diff --git a/skel/redhat/bootstrap.erb b/skel/redhat/bootstrap.erb index ef4a114..154a1c9 100644 --- a/skel/redhat/bootstrap.erb +++ b/skel/redhat/bootstrap.erb @@ -1,5 +1,6 @@ #!/bin/bash +pwd=$PWD base_dir=<%= base_dir %> if [ ! -f ${base_dir}/ruby-base/bin/ruby ]; then @@ -20,6 +21,11 @@ if [ ! -f ${base_dir}/ruby-base/bin/ruby ]; then ./configure --prefix=${base_dir}/ruby-base --disable-pthread make make install + + cd ext/openssl + PATH=${base_dir}/ruby-base/bin:$PATH ruby extconf.rb + make + make install fi PATH=${base_dir}/ruby-base/bin:$PATH @@ -29,5 +35,6 @@ if [ ! -f ${base_dir}/ruby-base/bin/puppet ]; then gem install puppet fi -mkdir ~/.puppet +mkdir -p ~/.puppet +cd /tmp/puppet ./apply diff --git a/skel/rename.erb b/skel/rename.erb index bf9573d..49fd527 100644 --- a/skel/rename.erb +++ b/skel/rename.erb @@ -10,5 +10,9 @@ cat /etc/hosts | sed "s#^\\(127.0.0.1\\)\\(.*\\)\$#\\1 $1 \\2#g" > /etc/hosts.tm mv /etc/hosts.tmp /etc/hosts hostname $1 +if [ -f /etc/sysconfig/network ]; then + echo -e "NETWORKING=yes\nHOSTNAME=$1\n" > /etc/sysconfig/network +fi + echo "Server renamed to $1"