saltstack/salty-vagrant — pull request #75 by ev0rtex (2013-04-21 02:43:19+00:00)
Title: Pillar data export

I wanted an easy way to pass data from my Vagrantfile into pillar so I created my own custom plugin at one point. I rewrote the code with several improvements and integrated it into salty-vagrant because it just seemed like it belongs here. There is a __pillar_root__ option to specify the path to your pillar root and usage is pretty simple:

config.vm.provision :salt do |salt|
salt.pillar(:hosts, {
"hostnames" => {
"www" => "www.example.com",
"intranet" => "intranet.example.com"
}
})

salt.run_highstate = true
end

This will create the file _{pillar_root}_ __/_gen/hosts.sls__ with the following contents:

hostnames:
www: www.example.com
intranet: intranet.example.com

Additionally, _{pillar_root}_ __/top.sls__ will be modified so that it pulls in the generated file:

base:
'*':
- _gen/hosts

I welcome any and all constructive feedback and would love to see this incorporated in the next released version or so. If there would be a better way to implement any of this or some use cases I need to consider please discuss.