[chef] I want to implement env_attributes() in Chef roles


Chronological Thread 
  • From: DV < >
  • To:
  • Subject: [chef] I want to implement env_attributes() in Chef roles
  • Date: Thu, 14 Nov 2013 11:02:06 -0800

Hey all,

I'm trying to come up with an efficient way to promote changes to our applications one environment at a time. Say I have 4 prod environments, and many roles in each environment, some for database, some for app server, etc. My task is to promote a new version of database to each environment in a specific role only, one environment at a time (to avoid downtime).

If I update the database version attribute in the role, it'll update all environments. If I update the database version attribute in the environment, it'll update all databases in that environment, not only the one I'm targeting.

I want to have ability to specify something like the following in the role:

env_attributes(
  "env-1" => {
    "database" => {
      "version" => "1.2.3"
    }
  },
  "env-2" => {
    "database" => {
      "verison" => "1.2.1"
    }
  }
)

My current solution is to use env_run_lists() to do this, but it's time-consuming as I have to create a new recipe each time I want to upgrade to new version.

Does that make sense? Would anyone know how I can go about implementing this role functionality?

--
Best regards, Dmitriy V.



Archive powered by MHonArc 2.6.16.

§