- From: Vladimir Girnet <
>
- To:
- Subject: [chef] Override attributes using JSON
- Date: Mon, 26 Jul 2010 12:13:58 -0700 (PDT)
Hi,
I'm using Chef 0.9.6 on CentOS 5.5 - everything installed from Yum
repositories.
I need to create a user in the system, and then access this username in
several
cookbooks. I have created a cookbook "create_user" that has this receipe:
user_name = node[:user_name]
username user_name do
... create actions here
end
And I have created an attribute for this cookbook:
default[:user_name]="testuser"
So, if there is no username supplied, "testuser" is used.
Also, I'm creating a JSON file { "user_name": "myuser" }
When I run "chef-client -j <myfile>.json" on a non-registered node/client -
user "testuser" is created. Running the same command second time - node is
already registered from first run - user "myuser" is created.
If I run the same cookbook using chef-solo - everything works fine - only
"myuser" is created.
Why on first run of chef-client attributes are not overridden? How is
possible
to achieve correct user creation on first chef-client run?
Thanks
- [chef] Override attributes using JSON, Vladimir Girnet, 07/26/2010
Archive powered by MHonArc 2.6.16.