Closed yoshiwaan closed 8 years ago
@cbednarski I noticed that this issue has both the "wontfix" and "enhancement" labels. I was merely curious what the expected status of this issue is now. If this issue is or is not being considered, it might influence my current provisioning refactoring plans somewhat.
Thanks for the suggestion @yoshiwaan I don't use chef-zero and I have no plans to implement this myself, but if you contribute a PR I'd be happy to review it.
This is already possible. Here's an example from a configuration I use:
{
"variables": {
"chef_dir": "/tmp/packer-chef-client"
},
"provisioners": [
{ "type": "shell", "inline": [ "mkdir -p {{user `chef_dir`}}" ] },
{ "type": "file", "source": "./roles", "destination": "{{user `chef_dir`}}" },
{ "type": "file", "source": "./cookbooks", "destination": "{{user `chef_dir`}}" },
{ "type": "file", "source": "./data_bags", "destination": "{{user `chef_dir`}}" },
{ "type": "file", "source": "./environments", "destination": "{{user `chef_dir`}}" },
{ "type": "file", "source": "./scripts/install_chef.sh", "destination": "{{user `chef_dir`}}/install_chef.sh" },
{
"type": "chef-client",
"install_command": "sudo bash {{user `chef_dir`}}/install_chef.sh",
"server_url": "http://localhost:8889",
"config_template": "./config/client.rb.template",
"run_list": [ "role[testing]" ],
"skip_clean_node": true,
"skip_clean_client": true
}
]
}
And here's the ./config/client.rb.template
referenced by the config_template
variable to chef-client
:
log_level :info
log_location STDOUT
local_mode true
chef_zero.enabled true
ssl_verify_mode "verify_peer"
role_path "{{user `chef_dir`}}/roles"
data_bag_path "{{user `chef_dir`}}/data_bags"
environment_path "{{user `chef_dir`}}/environments"
cookbook_path [ "{{user `chef_dir`}}/cookbooks" ]
HTH
In the same way that Vagrant supports chef-solo, chef-client and chef-zero provisioners, it would be good to add chef-zero to Packer, as chef-solo is essentially the 'old school' way of doing it now. I know this is achievable now by using on of the other provisioners and altering a bunch of settings, but this is an enhancement request to make it a first class citizen.
It should support the directory copy options of the Chef solo provisioner and take care of running in local mode automatically.