简体   繁体   中英

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?

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM