Hi! I'm new here.

Is it possible to reverse the order of provisioners from innermost to 
outermost when using a multi-machine setup? I want a small shell 
provisioner to create some facts in /etc/facter/facts.d/ before 
provisioning with puppet, to mimic our current setup as much as possible. 
(I have inherited a large puppet repo and am trying to create a Vagrant 
testbed for it before I start doing changes.)

The puppet settings are the same for every box, but requires the shell 
provisioner to run first. Here's an example Vagrantfile to show what I want 
to do (some names changed to protect the innocent):

$facts =<<FACTS
set -x
mkdir -p /etc/facter/facts.d
echo foo_role=$1        > /etc/facter/facts.d/role.txt
echo foo_location=$2    > /etc/facter/facts.d/location.txt
echo foo_environment=$3 > /etc/facter/facts.d/environment.txt
FACTS

Vagrant.configure(2) do |config|
  config.vm.box = "centos-6.6"
  config.vm.synced_folder "hiera", "/etc/puppet/hiera"

  config.vm.provision :puppet do |puppet|
    puppet.manifest_file = "site.pp"
    puppet.module_path = ["modules", "internal"]
    puppet.hiera_config_path = "hiera.yaml"
    puppet.options = "--test"
  end

  config.vm.define :foo1 do |c|
    c.vm.hostname = "foo-1.vagrant"
    c.vm.provision :shell, inline: $facts, args: "foo testing stage"
  end

  config.vm.define :bar do |c|
    c.vm.hostname = "bar-1.vagrant"
    c.vm.provision :shell, inline: $facts, args: "bar testing stage"
  end

  # ... more machines omitted ...

end

If that's not possible, is there a way to "macroify" the puppet setup so I 
can add it as a single line to each defined machine? (I am not not familiar 
with the terminology in Ruby nor Vagrant.) Any other suggestions welcome.

Stig

-- 
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/vagrant/issues
IRC: #vagrant on Freenode
--- 
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 [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/vagrant-up/0cf37104-2025-43fd-8651-bf3b20422d11%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to