vitkonaft
vitkonaft

Reputation: 3

Use environment in chef-solo for packer

I need to create image by packer in Azure, using provisioner chef-solo.

{
"builders": [{ ... }]
"provisioners": [
    {
        "type": "chef-solo",           
        "cookbook_paths": ["C:/Users/User/workplace/Git/Chef/cookbooks"],

        "environments_path": "C:/Users/User/workplace/Git/Chef/environment",
        "roles_path": "C:/Users/User/workplace/Git/Chef/roles",
        "run_list": [
            "role[es601-master]"
        ]
    }
]}

In role I have environment with needed cookbooks. How I can define environment here?

Upvotes: 0

Views: 181

Answers (1)

AGL
AGL

Reputation: 546

Try this:

{
"builders": [{ ... }]
"provisioners": [
    {
        "type": "chef-solo",           
        "cookbook_paths": ["C:/Users/User/workplace/Git/Chef/cookbooks"],
        "environments_path": "C:/Users/User/workplace/Git/Chef/environment",
        "roles_path": "C:/Users/User/workplace/Git/Chef/roles",
        "run_list": [
            "role[es601-master]"
        ],
        "chef_environment": "dev"
    }
]}

For sure the value of the key "chef_environment" has to be one of your environments properly defined in "C:/Users/User/workplace/Git/Chef/environment"

Regards

Upvotes: 0

Related Questions