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 <[email protected] 
> <javascript:>> 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 [email protected] <javascript:>.
>> 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 [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/vagrant-up/446d83dc-2dbf-4bc8-8fcc-0a5fc2f711ed%40googlegroups.com.

Reply via email to