Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Chef on Vagrant Box: Can't find encrypted data bag secret

When provisioning a vagrant box with (hosted-)chef I get the following error:

No such file or directory - file not found '/tmp/encrypted_data_bag_secret'

Here is the call causing the error:

ssl = Chef::EncryptedDataBagItem.load("ssl", s[:id])

I also can't find the encrypted_data_bag_secret in /etc/chef where it normally resides on my other servers.

Am I missing a config which uploads the data bag secret?

Here's the rest of the stack trace:

[2013-02-14T16:51:15+00:00] ERROR: Running exception handlers
[2013-02-14T16:51:15+00:00] FATAL: Saving node information to /srv/chef/file_store/failed-run-data.json
[2013-02-14T16:51:15+00:00] ERROR: Exception handlers complete
[2013-02-14T16:51:15+00:00] FATAL: Stacktrace dumped to /srv/chef/file_store/chef-stacktrace.out
[2013-02-14T16:51:15+00:00] FATAL: Errno::ENOENT: No such file or directory - file not found '/tmp/encrypted_data_bag_secret'
like image 741
j7nn7k Avatar asked Feb 14 '13 17:02

j7nn7k


Video Answer


1 Answers

When provisioning a vagrant box, you have to provide a path to your data bags secret key, if you want to use encrypted data bags.

config.vm.provision :chef_solo do |chef|
  [...]
  chef.encrypted_data_bag_secret_key_path = '/etc/chef/encrypted_data_bag_secret'
  [...]
end
like image 94
Draco Ater Avatar answered Sep 17 '22 01:09

Draco Ater