I'm new to Chef (configuration management). I use mysql cookbook with all default attributes. Running it makes it generate a random password for root account. I can use the password with node['mysql']['server_root_password']. Then, I change mysql password using mysqladmin. The variable node['mysql']['server_root_password'] is not updated to my new password. How can I tell the mysql cookbook to update the value inside node['mysql']['server_root_password'] please?
Asked
Active
Viewed 1,070 times
0
-
Are you running Chef client (with server) or chef solo? What exactly do you want to update? The the value in attributes/server.rb? – Terry Wang Jun 25 '13 at 22:50
-
I use Chef-server/Chef-client. In my recipe, I use the variable node['mysql']['server_root_password'] to login/run mysql script. But this variables holds the old password which is no longer valid since I have change my root password to a different value using mysqladmin. So the resource failes to execute. – Sang Quang Nguyen Jun 26 '13 at 05:11
-
In this case, just update it by hand in the recipe, because you manually changed the root password later for mysql -_- Or, probably you can override the node['mysql']['server_root_password'] by using a JSOn attribute file when executing. – Terry Wang Jun 27 '13 at 01:27
1 Answers
0
You need to update the node's attribute to reflect the new password.
One way to do that would be to use Knife and the knife-set-attribute plugin.
knife set_attribute node mysql.server_root_password yournewpassword
Other ways to set attributes can be explored in the Chef attribute docs.

Emil Sit
- 22,894
- 7
- 53
- 75