linuxchef-infradatabags

Chef DataBag values not being used on chef run


Have a simple DataBag similar to:

{
    "dsa-key": {
      "app-key": "xxxxxxxx"
    },
    "region": {
        "dev": {
            "app-db": {
                    "user":"xxxxx",
                    "pass":"xxxxx"
            },
            "app-test-user": {
                    "user":"xxxxx",
                    "pass":"xxxxx"
            }
        },
        "qe": {
            "app-db": {
                    "user":"xxxxx",
                    "pass":"xxxxx"
            },
            "app-test-user": {
                    "user":"xxxxx",
                    "pass":"xxxxx"
            }
        },
    }
}

It was an existing databag but I had to replace it since the person that originally created it left and knife was complaining that the databag was not encrypted using my key.

This is how I created the databag

knife vault create myDataBag auth "" --json myDataBag-credentials.json --search='role:build-myApp' --admins $USER --mode client

But now the cookbook doesn't pick up the values from the newly created databag.

Is there any other steps that needed to be take? I did notice that there's an "auth_keys" inside the databag when I look at it via the ChefManage website and in there I see a list of "clients" (nodes) but the list is short and it doesn't contain the nodes I want the databag to be used on, maybe this is the issue?

I would appreciate any help.


Solution

  • Your wording is very vague but I'm guessing the issue is your search query for the vault is incorrect. I discourage use of that feature in the first place due to security concerns, but you can either add the node you are missing via -A or fix your search query. Use knife search to make sure the query is correct, and then refresh the vault as needed. You should see all the clients in the _keys item.