lib/poolparty/provisioners/capistrano/recipies/master.rb in auser-poolparty-0.2.92 vs lib/poolparty/provisioners/capistrano/recipies/master.rb in auser-poolparty-0.2.93
- old
+ new
@@ -25,10 +25,11 @@
desc "Configure master"
def master_configure_master_task
create_local_node_entry_for_puppet
move_provisioner_manifest
move_template_files
+ move_custom_modules
setup_poolparty_base_structure
ensure_provisioner_is_running
run_provisioner
end
desc "Set hostname to master"
@@ -41,30 +42,33 @@
end
desc "Download base gems"
def download_base_gems
run(returning(Array.new) do |arr|
base_gems.each do |name, url|
- arr << "wget #{url} -O #{Base.remote_storage_path}/#{name}.gem 2>&1; echo 'downloaded #{name}'" if url
+ if url && !url.empty?
+ arr << "curl -L -o #{Base.remote_storage_path}/#{name}.gem #{url} 2>&1; echo 'downloaded #{name}'"
+ arr << "if test -s #{Base.remote_storage_path}/#{name}.gem; then echo ''; else rm #{Base.remote_storage_path}/#{name}.gem; fi; echo ''"
+ end
end
end.join(" && "))
end
desc "Install base gems"
def install_base_gems
run(returning(Array.new) do |arr|
base_gems.each do |name, url|
str = url.empty? ? "#{name}" : "#{Base.remote_storage_path}/#{name}.gem"
- arr << "/usr/bin/gem install --ignore-dependencies --no-ri --no-rdoc #{str}"
+ arr << "/usr/bin/gem install --ignore-dependencies --no-ri --no-rdoc #{str}; echo 'insatlled #{name}'"
end
end.join(" && "))
end
desc "Start provisioner base"
def start_provisioner_base
run "/etc/init.d/puppetmaster start"
end
desc "Restart provisioner base"
def restart_provisioner_base
- run "/etc/init.d/puppetmaster stop;rm -rf /etc/poolparty/ssl;puppetmasterd --verbose;/etc/init.d/puppetmaster start"
+ run "/etc/init.d/puppetmaster stop;rm -rf /etc/poolparty/ssl;start_provisioner_based --verbose;/etc/init.d/puppetmaster start"
end
desc "Ensure provisioner is running"
def ensure_provisioner_is_running
run "/usr/sbin/puppetmasterd --verbose 2>1 > /dev/null;echo ''"
end
@@ -82,9 +86,17 @@
desc "Move template files into place"
def move_template_files
run <<-EOR
mkdir -p #{template_path} &&
cp -R #{remote_storage_path}/templates/* #{template_path}
+ EOR
+ end
+ desc "Move custom modules"
+ def move_custom_modules
+ run <<-EOR
+ if test -d #{remote_storage_path}/modules; then
+ mkdir -p #{base_config_directory}/modules && cp -R #{remote_storage_path}/modules #{base_config_directory};
+ fi
EOR
end
desc "Move manifest into place"
def move_provisioner_manifest
run <<-EOR
\ No newline at end of file