You must be trying to run chef-client outside of Vagrant on subsequent
runs, e.g. directly on the guest. If that's the case, why not just run
chef-client through Vagrant again?
You might look at the Vagrant "file provisioner" to upload files to the
guest, from the host. If you create a custom.rb file like you mentioned,
you could use this from Vagrant and then use a file upload provisioner to
also make it available from the standard Chef location as client.rb.
On Saturday, August 9, 2014 2:10:34 PM UTC-7, Daniel D wrote:
>
> good morning.
>
> *Situation*:
>
> doing vagrant up for a debian7 box
> Once vagrant runs the chef-client the first time the node get's registered
> (successfully) . My Roles/Cookbox /recipes were applied.
> On the first run vagrant copies the client.rb and the .pem files to
> /tmp/vagrant-chef-3/ folder and runs teh chef-client. So far .. so good.
>
> But vagrant does not copy the client.rb and .pem files to /etc/chef/
> inside the guest. - Which means that the next run of chef-client fails due
> to the missing files.
>
>
> What do you suggest?
>
> *A) vagrant shell and copy *the files to the correct location?
> (Disadvantage: If the client.rb refers to an include file this path
> get's resolved ba vagrant:
> Example:
> My vagrant file contains: chef.custom_config_path = ".chef/custom.rb"
> This get's rsolved to Chef::Config.from_file
> "/tmp/vagrant-chef-3/custom-config.rb" on the guest in
> /tmp/vagrant-chef-3/client.rb
> So in this case I have no clue on how ti fix the line during
> provision.I can't just echo in this line after provision because it
> contains: Chef::Config.ssl_verify_mode = :verify_peer
>
>
> B) bad magic in the custom.rb (my extension to the Vagrant file:
>
> if ::File.exist?("/tmp/vagrant-chef-3/client.rb")
> ruby_block "Copy Chef config file if running in a Vagrant guest" do
> block do
> ::FileUtils.cp "/tmp/vagrant-chef-1/client.rb", "#{node['chef-client'][
> 'conf_dir']}/client.rb"
> end
> if ::File.exist?("#{node['chef-client']['conf_dir']}/client.rb")
> not_if { ::FileUtils.compare_file("/tmp/vagrant-chef-1/client.rb", "#{node
> ['chef-client']['conf_dir']}/client.rb") }
> end
> end
> end
>
> *C) I'm totally wrong *here and you have a clean solution I've overseen?
>
> *Upfront, thanks for your help!!*
>
>
>
>
--
You received this message because you are subscribed to the Google Groups
"Vagrant" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.