Error at vagrant up "Provider expected: vsphere while Provider of box: vmware_desktop

63 views
Skip to first unread message

call...@yahoo.ca

unread,
Dec 15, 2017, 4:12:46 PM12/15/17
to Packer
Hi,

I am on Windows 10, with vmware workstation 14.0 installed, using packer 1.1.1 to build my box using type vmware.iso.

My box gets created and complete with the following lines

Build 'vmware-iso' finished.
==> Builds finished. The artifacts of successful builds are:
--> vmware-iso: 'vmware' provider box: xtract-vmware-rhel-7.3.box


When I try to do the vagrant up, using vagrant 1.9.6, I am getting the ERROR:
Provider expected: vsphere 
Provider of box: vmware_desktop

My vagrant file is:
HOSTNAME = "exfo." + ENV['USERNAME'] + "-" + File.basename(File.expand_path("..", Dir.pwd)).tr(" ", "").tr("_", "").tr(".", "")
BOXNAME = "xtract-vmware-rhel-7.3"
BOXURL = "file:///c:/Test/Xtract/Packer/xtract-rhel-esxi/" + BOXNAME + ".box"
Vagrant.configure("2") do |config|
    config.ssh.insert_key = false
    config.vm.box = BOXNAME
    config.vm.box_url = BOXURL
    config.vm.network "public_network", ip: "xxx.xxx.xxx.xxx", netmask: "255.255.254.0", gateway: "xxx.xxx.xxx.xxx"
    config.vm.synced_folder('.', '/Vagrant', type: 'rsync')
    config.vm.provider :vsphere  do |vsphere|
   
        # The host we're going to connect to
        vsphere.host = 'Vcenter01.xxx.com'                           
        # The host for the new VM
        vsphere.compute_resource_name = 'xxx.xxx.xxx.xxx'           
        # The resource pool for the new VM
        vsphere.resource_pool_name = 'Shared'                   
        # The template we're going to clone       
        #vsphere.template_name = 'ubuntu.template.dc.sw10.net'   
        # The name of the new machine
        vsphere.name = 'myvm'
        # vSphere login
        vsphere.user = 'xxxxxx'                                   
        # vSphere password
        vsphere.password = 'xxxxxx'                           
        # If you don't have SSL configured correctly, set this to 'true'
        vsphere.insecure = true                        
    end

    config.vm.provision "shell", path: "scripts/xtract-start.sh", run: 'always'
end

Alvaro Miranda Aguilera

unread,
Dec 15, 2017, 4:47:20 PM12/15/17
to packe...@googlegroups.com
hello

if i understood correctly.

you are building packer + vmware workstation

and you want to use vagrant on vsphere

is this correct?

are couple of vmware vagrant plugins, which one are you using?

then if packer is copying the box vsphere and the box or template is there then, in the documentation of the plugin they show you how to use a dummy box, right?

if thats the case then you need to update your vagrant file per plugin instructions.

packer i think is fine, so is more a vagrant question, right?

Alvaro

--
This mailing list is governed under the HashiCorp Community Guidelines - https://www.hashicorp.com/community-guidelines.html. Behavior in violation of those guidelines may result in your removal from this mailing list.
 
GitHub Issues: https://github.com/mitchellh/packer/issues
IRC: #packer-tool on Freenode
---
You received this message because you are subscribed to the Google Groups "Packer" group.
To unsubscribe from this group and stop receiving emails from it, send an email to packer-tool+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/packer-tool/cc85e06d-5f33-4a3d-98da-1e274dc17e4b%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.



--
Alvaro

call...@yahoo.ca

unread,
Dec 15, 2017, 6:12:38 PM12/15/17
to Packer
Hi,

Here are the plugin list

vagrant-share (1.1.9, system)
vagrant-vmware-esxi (1.1.7)
vagrant-vmware-workstation (5.0.4)
vagrant-vsphere (1.13.2)

Yes I have vmware_workstation on my build machine, but I want to deploy on a remote machine esxi and have a static IP assigned on eth1. To do that I need to specify a customization_spec_name,. This option seems to be supported for provider vsphere only. I tried esxi (the option is not available) and vmnware_workstation (does not seems to support remote deployment). Maybe I am wrong ?

I am building a box from scratch with a rhel 7.3 OS,
Here is the packer file:

{
    "variables":
    {
    "iso_url": "/c:/Test/Linux/rhel/rhel-server-7.3-x86_64-dvd.iso",
    "iso_checksum": "120acbca7b3d55465eb9f8ef53ad7365f2997d42d4f83d7cc285bf5c71e1131f",
    "iso_checksum_type": "sha256",
    "os_release": "7.3",
    "disk_size": "50000",
    "box_name": "xtract-vmware-rhel"
    },
    "builders":
    [
        {
            "headless": true,
            "type": "vmware-iso",
            "vm_name": "{{user `box_name`}}-{{user `os_release`}}",
            "boot_wait": "10s",
            "disk_size": "{{user `disk_size`}}",
            "guest_os_type": "rhel7-64",
            "http_directory": "http",
            "iso_url": "{{user `iso_url`}}",
            "iso_checksum": "{{user `iso_checksum`}}",
            "iso_checksum_type": "{{user `iso_checksum_type`}}",
            "tools_upload_flavor": "linux",
            "tools_upload_path": "/tmp/vmware_tools_{{.Flavor}}.iso",
            "boot_command":
            [
                "<esc><wait>",
                "vmlinuz initrd=initrd.img inst.geoloc=0 rd.driver.blacklist=dm-multipath net.ifnames=0 biosdevname=0 ",
                "ks=http://{{ .HTTPIP }}:{{ .HTTPPort }}/vagrant-vmware.ks",
                "<enter>"
            ],
            "shutdown_command": "echo 'vagrant'|sudo -S /sbin/halt -h -p",
            "shutdown_timeout" : "300s",
            "ssh_username": "vagrant",
            "ssh_password": "vagrant",
            "ssh_port": 22,
            "ssh_wait_timeout": "60m",
            "output_directory": "builds",
            "vmx_data": {
                "numvcpus": 2,
                "cpuid.coresPerSocket": 1,
                "memsize": 4096,
                "ethernet0.virtualDev": "vmxnet3",
                "virtualHW.version": "11"
                }    
        }
    ],
   "provisioners": 
   [
        {
            "inline":
            [
                "sudo mkdir /home/vagrant/scripts",
                "sudo chmod 777 /home/vagrant/scripts"
            ],
            "type": "shell"
        },
        {
            "source": "./scripts/",
            "destination": "/home/vagrant/scripts",
            "type": "file"
        },
        {
            "type": "shell",
            "execute_command": "echo 'vagrant' | {{.Vars}} sudo -S -E bash '{{.Path}}'",
                "scripts":
                [
                    "scripts/subscription.sh",
                    "scripts/base.sh",                           
                    "scripts/vagrant.sh",
                    "scripts/vmware.sh",
                    "scripts/sshd.sh",
                    "scripts/cleanup.sh",
                    "scripts/setup-java2.sh",
                    "scripts/install-xtract.sh",
                    "scripts/xtract-env.sh"
                ]
        }
    ],
    "post-processors": [{
        "type": "vagrant",
        "output": "{{user `box_name`}}-{{user `os_release`}}.box",
        "keep_input_artifact": false
    }]
Reply all
Reply to author
Forward
0 new messages