[chef] Re: Strange order execution of recipes, chef-solo


Chronological Thread 
  • From: AJ Christensen < >
  • To:
  • Subject: [chef] Re: Strange order execution of recipes, chef-solo
  • Date: Tue, 27 Nov 2012 10:25:11 +1300

You're running that file resource :create action at compile time. Was that your intention? Do you need this deploy key to be present at compile time?

I don't believe the user::data_bag recipe does its work during compile phase [0]. Although, it could be modified to do so.

--AJ

[0]: https://github.com/fnichol/chef-user/blob/master/recipes/data_bag.rb#L41


On 27 November 2012 10:15, Marcelo de Moraes Serpa < " target="_blank"> > wrote:
Hello list,

So I have my own recipe, and it's like an "aggregator" recipe, it's the only recipe in the run list for my node, and it in turn calls other recipes in order to build the node and deploy a couple of apps.

My default.rb for this recipe looks like this:

include_recipe "build-essential"
include_recipe "user::data_bag"
include_recipe "sudo"
include_recipe "fullofcaffeine::setup_keys"
include_recipe "git::default" #sets up git
include_recipe "nginx::default" #installs nginx
include_recipe "runit"
include_recipe "unicorn"
include_recipe "ruby"
package "libpq-dev"
require_recipe "postgresql::client"
require_recipe "postgresql::server"
require_recipe "fullofcaffeine::deploy_rack_apps"


I'm cooking a new node now, and I just got the following error:

Error executing action `create` on resource 'file[/home/deploy/.ssh/id_deploy

This is caused by the "fullofcaffeine::setup_keys" recipe, which is pretty simple, and looks like:

# Handle ssh key for git private repo
secret =  Chef::EncryptedDataBagItem.load_secret('/tmp/chef-solo/data_bag_key')
secrets = Chef::EncryptedDataBagItem.load("deploy_keys", "marcelo-laptop",secret)
file "/home/deploy/.ssh/id_deploy" do
  action :nothing 
  content secrets["deploy_key"]
  owner "deploy"
  group "deploy"
  mode '0600'
end.run_action(:create) 
 
However, for some reason, the user::data_bag (https://github.com/fnichol/chef-user) - the one that should have created the deploy user before the setup of keys - did not run, and hence the deploy key could not be written in the non-existent path for the deploy user.

Any ideas why this happens? Any insights appreciated, I'm a bit lost here.

Thanks in advance,

- Marcelo.






Archive powered by MHonArc 2.6.16.

§