azurechef-solopacker

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?


Solution

  • 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