cancel
Showing results for 
Search instead for 
Did you mean: 
Tim_Rupp
Nimbostratus
Nimbostratus

Problem this snippet solves:

Provides a packer template that can be used to build a Vagrant "box" from a BIG-IP VE

Code :

{
  "variables": {
    "sudo_url": "http://repo.centos.org/files/sudo-1.8.16-1.el5.x86_64.rpm",
    "sudo_rpm": "sudo-1.8.16-1.el5.x86_64.rpm"
  },

  "builders": [
    {
      "type": "virtualbox-ovf",
      "source_path": "BIGIP-11.6.0.0.0.401.LTM_1SLOT-ide.ova",
      "ssh_username": "root",
      "ssh_password": "default",
      "ssh_wait_timeout": "30000s",
      "headless": "false",
      "shutdown_command": "shutdown -h now",
      "import_flags": ["--eula", "accept"],
      "guest_additions_mode": "disable",
      "vm_name": "BIGIP-11.6.0.0.0.401.LTM_1SLOT-ide",
      "vboxmanage": [
        ["modifyvm","{{.Name}}","--memory","4096"],
        ["modifyvm","{{.Name}}","--cpus","2"],
        ["modifyvm","{{.Name}}","--nic1","NAT"]
      ]
    }
  ],

  "post-processors": [
    {
      "type": "vagrant",
      "compression_level": 1,
      "keep_input_artifact": true,
      "output": "BIGIP-11.6.0.0.0.401.LTM_1SLOT-ide.box"
    }
  ],

  "provisioners": [
    {
      "type": "shell",
      "inline": [
        "mount -o remount,rw /dev/mapper/vg--db--hda-set.1._usr /usr",
        "curl -o /tmp/{{ user `sudo_rpm` }} {{ user `sudo_url` }}",
        "rpm -Uvh /tmp/{{ user `sudo_rpm` }}",

        "tmsh create auth user vagrant password vagrant partition-access add { all-partitions { role admin } } shell bash",
        "echo 'vagrant ALL=(ALL) NOPASSWD:ALL' > /etc/sudoers.d/vagrant",
        "mkdir -p /home/vagrant/.ssh",
        "chmod 0700 /home/vagrant/.ssh",
        "curl --insecure -L -o /home/vagrant/.ssh/authorized_keys https://raw.github.com/mitchellh/vagrant/master/keys/vagrant.pub",
        "chmod 0600 /home/vagrant/.ssh/authorized_keys",
        "chown -R vagrant /home/vagrant/.ssh",
        "tmsh save sys config"
      ]
    }
  ]
}
Comments
calvinchristoph
Nimbostratus
Nimbostratus

Tim,

 

I would like to thank you for the hard work you put in to produce this Vagrant box. I am noting issues with deploying it on a 12.x code release, but it looks to be an issue with Virtualbox rather than the image itself.

 

Any chance you could decipher the following error message?

 

2016/08/15 18:59:51 packer: 2016/08/15 18:59:51 Executing VBoxManage: []string{"controlvm", "BIGIP-12.1.0.0.0.1434.LTM_1SLOT-ide", "poweroff"} 2016/08/15 18:59:52 packer: 2016/08/15 18:59:52 stdout: 2016/08/15 18:59:52 packer: 2016/08/15 18:59:52 stderr: 0%...10%...20%...30%...40%...50%...60%...70%...80%...90%...100% 2016/08/15 18:59:52 ui: ==> virtualbox-ovf: Unregistering and deleting imported VM... ==> virtualbox-ovf: Unregistering and deleting imported VM... 2016/08/15 18:59:52 packer: 2016/08/15 18:59:52 Executing VBoxManage: []string{"unregistervm", "BIGIP-12.1.0.0.0.1434.LTM_1SLOT-ide", "--delete"} 2016/08/15 18:59:52 packer: 2016/08/15 18:59:52 stdout: 2016/08/15 18:59:52 packer: 2016/08/15 18:59:52 stderr: VBoxManage: error: Cannot unregister the machine 'BIGIP-12.1.0.0.0.1434.LTM_1SLOT-ide' while it is locked 2016/08/15 18:59:52 packer: VBoxManage: error: Details: code VBOX_E_INVALID_OBJECT_STATE (0x80bb0007), component MachineWrap, interface IMachine, callee nsISupports 2016/08/15 18:59:52 packer: VBoxManage: error: Context: "Unregister(CleanupMode_DetachAllReturnHardDisksOnly, ComSafeArrayAsOutParam(aMedia))" at line 155 of file VBoxManageMisc.cpp ==> virtualbox-ovf: Error deleting VM: VBoxManage error: VBoxManage: error: Cannot unregister the machine 'BIGIP-12.1.0.0.0.1434.LTM_1SLOT-ide' while it is locked ==> virtualbox-ovf: VBoxManage: error: Details: code VBOX_E_INVALID_OBJECT_STATE (0x80bb0007), component MachineWrap, interface IMachine, callee nsISupports ==> virtualbox-ovf: VBoxManage: error: Context: "Unregister(CleanupMode_DetachAllReturnHardDisksOnly, ComSafeArrayAsOutParam(aMedia))" at line 155 of file VBoxManageMisc.cpp 2016/08/15 18:59:52 ui error: ==> virtualbox-ovf: Error deleting VM: VBoxManage error: VBoxManage: error: Cannot unregister the machine 'BIGIP-12.1.0.0.0.1434.LTM_1SLOT-ide' while it is locked ==> virtualbox-ovf: VBoxManage: error: Details: code VBOX_E_INVALID_OBJECT_STATE (0x80bb0007), component MachineWrap, interface IMachine, callee nsISupports ==> virtualbox-ovf: VBoxManage: error: Context: "Unregister(CleanupMode_DetachAllReturnHardDisksOnly, ComSafeArrayAsOutParam(aMedia))" at line 155 of file VBoxManageMisc.cpp 2016/08/15 18:59:52 ui: ==> virtualbox-ovf: Deleting output directory... ==> virtualbox-ovf: Deleting output directory... 2016/08/15 18:59:52 ui error: Build 'virtualbox-ovf' errored: Script exited with non-zero exit status: 1 2016/08/15 18:59:52 Builds completed. Waiting on interrupt barrier... 2016/08/15 18:59:52 machine readable: error-count []string{"1"} 2016/08/15 18:59:52 ui error: ==> Some builds didn't complete successfully and had errors: 2016/08/15 18:59:52 machine readable: virtualbox-ovf,error []string{"Script exited with non-zero exit status: 1"} 2016/08/15 18:59:52 ui error: --> virtualbox-ovf: Script exited with non-zero exit status: 1 2016/08/15 18:59:52 ui: ==> Builds finished but no artifacts were created. 2016/08/15 18:59:52 waiting for all plugin processes to complete... 2016/08/15 18:59:52 /usr/bin/packer: plugin process exited 2016/08/15 18:59:52 /usr/bin/packer: plugin process exited Build 'virtualbox-ovf' errored: Script exited with non-zero exit status: 1 ==> Some builds didn't complete successfully and had errors: --> virtualbox-ovf: Script exited with non-zero exit status: 1 ==> Builds finished but no artifacts were created. 2016/08/15 18:59:52 /usr/bin/packer: plugin process exited
Tim_Rupp
Nimbostratus
Nimbostratus

calvinchristopher you might want to check out this github repo I maintain instead

 

https://github.com/f5devcentral/f5-packer-templates

 

It uses the ISOs instead of the OVAs and includes more releases than the original one I posted here. You should have access to these ISO files if you have access to There are a number of weird things that can happen across versions that I try to accommodate for in the packerfiles.

 

calvinchristoph
Nimbostratus
Nimbostratus

Additionally, it may be worth mentioning that interface vboxnet2 is not created by default, and will halt the deployment of the box. Users need to manually create the interface by running vboxmanage hostonlyif create three times (vboxnet0, vboxnet1, and finally vboxnet2)

 

calvinchristoph
Nimbostratus
Nimbostratus

Many thanks @Tim Rupp, your hard work has enabled our team to quickly test out new devops initiatives.

 

Version history
Last update:
‎01-Apr-2016 12:03
Updated by:
Contributors