Am I right in thinking that probably there is no option to change the value from the command line?
For example something like this:
knife data bag edit my_data_bag host1 ...action "upgrade"
So then second line will be changed from "remove" to "upgrade":
{
"id": "host1",
"action": "remove"
}
I know that I can do it from file, but I wanted to provide simpler process for different teams. It would be easier to provide command and not files to edit. It requires some understanding to edit json file and passing to the knife. Also there can be difficulties to edit json for hundreds of boxes.
Maybe you see a good way to simplify this? The goal is to provide simple process like few commands rather than editing files.
As there is no direct way to modify it through knife
, I would recommend to programmatically change the file using the jq
utility.
Based on a simple script, you could read input from the user, change the JSON file accordingly and then call knife data bag from file
without needing the user to directly invoke knife
.
Another option - and I personally would prefer this - would be that the modified JSON file is pushed via Git, which then triggers a CI server (e.g. Jenkins), which then updates the data bag. This would make your setup easier, if not everyone needs access to the Chef server.