I'm new to Chef/Packer so apologies if this is a novice question, basically I'm trying to get Packer to use my local machine to build the image and execute a shell script. Following is my packer-build.json
{
"builders": [
{
"type": "file",
"name": "example",
"target": "./test_artifact.txt",
"content": "example content"
}
],
"provisioners": [
{
"type": "chef-solo",
"cookbook_paths": ["/Users/bakthak/code/nc_deployment/chef-repo/cookbooks"],
"staging_directory": "/Users/bakthak",
"execute_command": "sh /Users/bakthak/check.sh"
}
]
}
Running build with this file produces the output
==> example: Provisioning with chef-solo
example: Installing Chef...
example: Creating directory: /Users/bakthak
example: Creating directory: /Users/bakthak/cookbooks-0
example: Creating configuration file 'solo.rb'
example: Creating JSON attribute file
example: Executing Chef: sh /Users/bakthak/check.sh
Build 'example' finished.
I had a few questions about this:
- Is packer using my local machine to install chef and build the image?
- Looks like the shell script
sh /Users/bakthak/check.sh
is not executed since that script creates a bunch of files in a directory which does not exist after packer build completion.
Thanks for the help :)