I have a data_bag with 40+ items and need to add certain parameters to most of them.
Is there a way to edit, e.g. with knife, all data_bag items? So far, all I can see is to have each item open in my editor.
I have a data_bag with 40+ items and need to add certain parameters to most of them.
Is there a way to edit, e.g. with knife, all data_bag items? So far, all I can see is to have each item open in my editor.
You can go through all of them with cycle and save each into file by calling
for item in <item1> <item2> <item3> ; do
knife data bag show <data_bag> $item -Fj > my_data_bag/$item.json
done
Then add the required parameters into every json file by copy/paste or some macro. And update the bag items on chef-server by calling:
knife data bag from file <data_bag> my_data_bag/*.json