[chef] Overriding cookbook attributes in a role - am I doing it wrong?


Chronological Thread 
  • From: Mike Williams < >
  • To:
  • Subject: [chef] Overriding cookbook attributes in a role - am I doing it wrong?
  • Date: Tue, 23 Nov 2010 18:47:42 +1100

I have an attribute default set in a cookbook attributes file:

default[:lmds][:database][:host] = "localhost"

which I'm attempting to override in a role:

$ knife role show lmds-app -a default_attributes
{
  "default_attributes": {
    "lmds": {
      "database": {
        "host": "i-3F2007E9"
      }
    }
  }
}

I then apply that role to a node:

$ knife node show -r i-3DBB07DC.ec.int.realestate.com.au
{
  "run_list": [
    "role[lmds-app]"
  ]
}

However, the node is picking up the cookbook-default, "localhost", rather than the value specified in the role.  Based on the documentation on the Chef Wiki, I thought the role would trump the cookbook.  Am I doing the override incorrectly?

If I put the override in _node_ attributes, rather than the role, then it works ... but I don't want to have to do that for every node.

-- 
cheers, 
Mike Williams




Archive powered by MHonArc 2.6.16.

§