From ce5b338ebb394f2b2c87d95d417517ff3de168ba Mon Sep 17 00:00:00 2001 From: Jan Klare Date: Thu, 30 Jul 2015 14:07:21 +0200 Subject: [PATCH] Backport of 'Create Chef Key' task in Rakefile backport of cherry-picked and merged commits: - 8f4a96e398037dce6ad4be5d5ef69b4862d2094a - 1e863ffbc1c5790d4a7cf562b3378a961a6995e3 Change-Id: I8fb223306bc47caaa7093d4d9c2e4b838a498b39 --- README.md | 1 - Rakefile | 16 ++++++++++++---- 2 files changed, 12 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index a23b53d..422a22c 100644 --- a/README.md +++ b/README.md @@ -22,7 +22,6 @@ $ git clone https://github.com/jjasghar/chef-openstack-testing-stack.git testing $ cd testing-stack $ vi vagrant_linux.rb # change the 'vm.box' to the openstack platform you'd like to run. $ chef exec rake berks_vendor -$ chef exec ruby -e "require 'openssl'; File.binwrite('.chef/validator.pem', OpenSSL::PKey::RSA.new(2048).to_pem)" ``` The stackforge OpenStack cookbooks by default use databags for configuring passwords. There are four diff --git a/Rakefile b/Rakefile index 074b72b..cd63bcc 100644 --- a/Rakefile +++ b/Rakefile @@ -26,23 +26,31 @@ task :berks_vendor do run_command('berks vendor cookbooks') end +desc "Create Chef Key" +task :create_key do + if not File.exist?('.chef/validator.pem') + require 'openssl' + File.binwrite('.chef/validator.pem', OpenSSL::PKey::RSA.new(2048).to_pem) + end +end + desc "All-in-One Neutron build" -task :aio_neutron do +task :aio_neutron => :create_key do run_command('chef-client -z vagrant_linux.rb aio-neutron.rb') end desc "All-in-One Nova-networking build" -task :aio_nova do +task :aio_nova => :create_key do run_command('chef-client -z vagrant_linux.rb aio-nova.rb') end desc "Multi-Neutron build" -task :multi_neutron do +task :multi_neutron => :create_key do run_command('chef-client -z vagrant_linux.rb multi-neutron.rb') end desc "Multi-Nova-networking build" -task :multi_nova do +task :multi_nova => :create_key do run_command('chef-client -z vagrant_linux.rb multi-nova.rb') end