Hi everybody,

I'm currently struggling with a problem, where I want a specific
configuration to be set by default for allchef Provisioners.

My idea was to define that in the global ~/.vagrant.d/Vagrantfile, e.g. like so:

# global Vagrant configuration
Vagrant.configure("2") do |config|

  # all chef-solo provisioners should inherit this by default!
  config.vm.provision :chef_solo do |chef|
    chef.version = "12.0.1"
  end
end

However, this does not work out as I expected. Instead of inheriting
the configuration, I got an additional chef_solo run for each VM.
Clearly not what I intended :-)

So I read again about named provisioners and provisioner inheritance
here (at the very bottom -> "Overriding Provisioner Settings"):
https://docs.vagrantup.com/v2/provisioning/basic_usage.html

However, this seems to work only if you explicitly name the
provisioners. However, I'm looking for a solution which mostly works
for any :chef_solo provisioners which are not explicitly named (i.e.
defining defaults for any unnamed :chef_solo provisioner). Not sure
how to get there though...

I would also accept a monkey-patching solution, but at this time my
Ruby skills left me and I could not get it to work (it simply has no
effect). This is what I tried:

# global Vagrant configuration
Vagrant.configure("2") do |config|
    # ...
end

module VagrantPlugins
# all chef provisioners should inherit this by default!
  module Chef
    module Config
      class Base < Vagrant.plugin("2", :config)
        def version
          "12.0.1"
        end
      end
    end
  end
end

Any ideas or suggestions?

Torben

-- 
You received this message because you are subscribed to the Google Groups 
"Vagrant" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to vagrant-up+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to