Vagrant has a great Puppet fact-finding utility :
facter (hash) - a hash of data to set as available fax variables within the Puppets.
For example, here is a snippet from my Vagrantfile with Puppet setup:
config.vm.provision "puppet", :options => ["--fileserverconfig=/vagrant/fileserver.conf"] do |puppet| puppet.manifests_path = "./" puppet.module_path = "~/projects/puppet/modules" puppet.manifest_file = "./vplan-host.pp" puppet.facter = { "vagrant_puppet_run" => "true" } end
And then we will use this fact, for example, as follows:
$unbound_conf = $::vagrant_puppet_run ? { 'true' => 'puppet:///modules/unbound_dns/etc/unbound/unbound.conf.vagrant', default => 'puppet:///modules/unbound_dns/etc/unbound/unbound.conf', } file { '/etc/unbound/unbound.conf': owner => root, group => root, notify => Service['unbound'], source => $unbound_conf, }
Please note that this fact is only available during puppet provision .
source share