GithubHelp home page GithubHelp logo

Comments (2)

DarK501 avatar DarK501 commented on July 20, 2024

Yes, however config.vm.provider is a child of config.vm so it needs to be configured after your VM define statement.

config.vm.define "app1" do |app|
    [...]
    config.vm.provider :vsphere do |vsphere, override|
       [...]
   end
end

This model allows a single configuration to be provisioned by multiple providers, allowing portability.

Remember that the Vagrant file is a parsed ruby file, so anything that goes in ruby should apply to the Vagrant file

from vagrant-vsphere.

MystaMax avatar MystaMax commented on July 20, 2024

Thank you very much, @DarK501! Your comments helped me get where I needed to be. Below is a working configuration for others to use:

Vagrant.configure("2") do |config|
    # General Vagrant VM configuration
      config.vm.box = 'dummy'
      config.vm.box_url = '/home/$user/vagrant/vsphere/dummy.box'
      config.ssh.insert_key = false

      #App 1 Definition - CentOS
      config.vm.define "db01" do |app01|
        app01.vm.hostname = "apptest01.host.net"
        app01.vm.provider :vsphere do |vsphere, override|
          override.nfs.functional = false  
          vsphere.host = 'vcsa01.host.net'
          vsphere.user = '[email protected]'
          vsphere.password = '$password'
          vsphere.insecure = true
          vsphere.compute_resource_name = 'Cluster01'
          vsphere.template_name = 'vagrant/vagrant-tmpl/vagrant-centos7'
          # vsphere.template_name = 'vagrant/vagrant-tmpl/vagrant-ubuntu1804'
          vsphere.vm_base_path = 'vagrant/vagrant-vms'
          vsphere.linked_clone = true
        end
      end

      #App 2 Definition - Ubuntu
      config.vm.define "app01" do |app02|
        app02.vm.hostname = "apptest02.host.net"
        app02.vm.provider :vsphere do |vsphere, override|
          override.nfs.functional = false  
          vsphere.host = 'vcsa01.host.net'
          vsphere.user = '[email protected]'
          vsphere.password = '$password'
          vsphere.insecure = true
          vsphere.compute_resource_name = 'Cluster01'
          # vsphere.template_name = 'vagrant/vagrant-tmpl/vagrant-centos7'
          vsphere.template_name = 'vagrant/vagrant-tmpl/vagrant-ubuntu1804'
          vsphere.vm_base_path = 'vagrant/vagrant-vms'
          vsphere.linked_clone = true
        end
      end

      #App 3 Definition - Ubuntu
      config.vm.define "app02" do |app03|
        app03.vm.hostname = "apptest02.host.net"
        app03.vm.provider :vsphere do |vsphere, override|
          override.nfs.functional = false  
          vsphere.host = 'vcsa01.host.net'
          vsphere.user = '[email protected]'
          vsphere.password = '$password'
          vsphere.insecure = true
          vsphere.compute_resource_name = 'Cluster01'
          # vsphere.template_name = 'vagrant/vagrant-tmpl/vagrant-centos7'
          vsphere.template_name = 'vagrant/vagrant-tmpl/vagrant-ubuntu1804'
          vsphere.vm_base_path = 'vagrant/vagrant-vms'
          vsphere.linked_clone = true
        end
      end

end

from vagrant-vsphere.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.