-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Closed
Description
Here are the relevant settings in the packer template files (freebsd-9.2-amd64.json):
"provisioners": [
{
"environment_vars": [
"CHEF_VERSION={{user `chef_version`}}"
],
"execute_command": "export {{.Vars}} && cat {{.Path}} | su -m",
"scripts": [
"scripts/freebsd/postinstall.sh",
"scripts/freebsd/vmtools.sh",
"scripts/common/chef.sh",
"scripts/freebsd/cleanup.sh",
"scripts/common/minimize.sh"
],
"type": "shell"
}
],
"variables": {
"chef_version": "latest",
"mirror": "http://ftp.freebsd.org/pub/FreeBSD"
}When I run
packer build -only=virtualbox-iso freebsd-9.2-amd64.jsonI get the following output:
==> virtualbox-iso: Provisioning with shell script: scripts/common/chef.sh
virtualbox-iso: downloading https://www.getchef.com/chef/install.sh
virtualbox-iso: to file /tmp/install-chef.sh
virtualbox-iso: trying curl...
virtualbox-iso: Downloading Chef for freebsd...
virtualbox-iso: downloading https://www.getchef.com/chef/metadata?v=&prerelease=false&nightlies=false&p=freebsd&pv=9&m=amd64
virtualbox-iso: to file /tmp/install.sh.6601/metadata.txt
virtualbox-iso: trying curl...
virtualbox-iso: url https://opscode-omnibus-packages.s3.amazonaws.com/freebsd/9/amd64/chef-11.14.2_1.freebsd.9.amd64.sh
virtualbox-iso: md5 3276a5b8e155e02a56a5a0c2e416c177
virtualbox-iso: sha256 f45a91787243ffe1325468db58cc7669dcecdbd724eec753872f950fb9d79839
virtualbox-iso: downloaded metadata file looks valid...
virtualbox-iso: downloading https://opscode-omnibus-packages.s3.amazonaws.com/freebsd/9/amd64/chef-11.14.2_1.freebsd.9.amd64.sh
virtualbox-iso: to file /tmp/install.sh.6601/chef-11.14.2_1.freebsd.9.amd64.sh
virtualbox-iso: trying curl...
virtualbox-iso: Comparing checksum with shasum...
virtualbox-iso: Installing Chef
virtualbox-iso: installing with sh...
virtualbox-iso: Verifying archive integrity... All good.
virtualbox-iso: Uncompressing The full stack of chef..............(many more dots).............................
virtualbox-iso: Thank you for installing Chef!
==> virtualbox-iso: Provisioning with shell script: scripts/freebsd/cleanup.shSo until here everything looks fine.
When I try to use the box with Vagrant, though, I get the following:
Bringing machine 'php' up with 'virtualbox' provider...
==> php: Importing base box 'freebsd-64'...
==> php: Matching MAC address for NAT networking...
==> php: Setting the name of the VM: vagrant-9_php_1407423057712_57795
==> php: Clearing any previously set network interfaces...
==> php: Preparing network interfaces based on configuration...
php: Adapter 1: nat
php: Adapter 2: hostonly
==> php: Forwarding ports...
php: 22 => 2222 (adapter 1)
==> php: Running 'pre-boot' VM customizations...
==> php: Booting VM...
==> php: Waiting for machine to boot. This may take a few minutes...
php: SSH address: 127.0.0.1:2222
php: SSH username: vagrant
php: SSH auth method: private key
php: Warning: Connection timeout. Retrying...
php: Warning: Connection timeout. Retrying...
php: Warning: Remote connection disconnect. Retrying...
==> php: Machine booted and ready!
Sorry, don't know how to check guest version of Virtualbox Guest Additions on this platform. Stopping installation.
==> php: Checking for guest additions in VM...
==> php: Setting hostname...
==> php: Configuring and enabling network interfaces...
==> php: Exporting NFS shared folders...
==> php: Preparing to edit /etc/exports. Administrator privileges will be required...
nfsd running
==> php: Mounting NFS shared folders...
==> php: Running provisioner: chef_solo...
The chef binary (either `chef-solo` or `chef-client`) was not found on
the VM and is required for chef provisioning. Please verify that chef
is installed and that the binary is available on the PATH.The same error also occurs when I try and run it with freebsd-10.0-amd64.json.
If I specify the provisioner like this, everything works fine:
"provisioners": [
{
"environment_vars": [ "CHEF_VERSION={{user `chef_version`}}" ],
"type": "shell",
"scripts": [
"scripts/freebsd/postinstall.sh",
"scripts/freebsd/cleanup.sh",
"scripts/freebsd/vmtools.sh",
"scripts/common/minimize.sh"
],
"execute_command": "export {{.Vars}} && cat {{.Path}} | su -m"
}, {
"type": "chef-solo",
"cookbook_paths": ["Chef/cookbooks"],
"roles_path": "Chef/roles",
"run_list": [
]
}
], After building the box, I can use chef as normal with that setup. The thing is that I want to provision the machine with Chef when I start the machine vagrant up and not with Packer. This way I stay more flexible and can use the same base box for many different Vagrant setups.
Did I overlook something?
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels