One other point, the trigger runs on the host, not the guest. The resulting file is to be used on the guest.
On Tuesday, February 11, 2020 at 3:28:58 PM UTC-5, Steve Freeman wrote: > > I'm trying to write out a configuration file based on the state of > execution at that point in the overall provisioning process. If I don't > use a trigger, then the code will execute the code to write the file with > different parameters while the Vagrantfile is being evaluated. The > resulting file is the last one generated. The file isn't just a handful of > properties to be written or I'd pass the values as arguments and write the > file locally in the provisioning script. > > Here is what I'd like to be able to do: > > config.trigger.before [:up,:provision], :provisioner_name => > "install" do |trigger| > trigger.info = "Generate install configuration" > trigger.ruby do |env, machine| > puts "generating configuration for > #{json['version'][0]}" > generate_configuration( json, baseOS, node_name ) > end > end > > > On Tuesday, February 11, 2020 at 3:21:53 PM UTC-5, Brian Cain wrote: >> >> Hey Steve - >> >> On Tue, Feb 11, 2020 at 8:10 AM Steve Freeman <free...@gmail.com> wrote: >> >>> I have a shell provisioners specified with names, like so: >>> >>> config.vm.provision "disk", type: "shell", path: "provision.ps1" >>> >>> How do I get a trigger to execute specific code only before this >>> particular provisioner? >>> >> >> What kind of trigger are you writing? If it's just a trigger that runs on >> the guest, the easiest thing to do >> would be to use a regular provisioner instead. >> >> >>> -- >>> 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 vagra...@googlegroups.com. >>> To view this discussion on the web visit >>> https://groups.google.com/d/msgid/vagrant-up/416eb13e-c41c-40cc-97f2-cfadd64eb1f1%40googlegroups.com >>> >>> <https://groups.google.com/d/msgid/vagrant-up/416eb13e-c41c-40cc-97f2-cfadd64eb1f1%40googlegroups.com?utm_medium=email&utm_source=footer> >>> . >>> >> >> >> -- >> Brian Cain >> > -- 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 vagrant-up+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/vagrant-up/67395f69-c602-4dcc-afb1-ca5c5bb7e93e%40googlegroups.com.