Vagrant has the idea of events and triggers, however, they are very limited
in what they can do. They typically only fire when a Vagrant specific
command fires - https://www.vagrantup.com/docs/triggers/ You can create
your own (I believe that the host_updater plugin takes advantage of this)
remote.trigger.after :up do |trigger|
trigger.only_on = box_info[box_info.length - 1][:host]
trigger.ruby do |env,machine|
puts ""
end
end
If you are looking to target a specific machine - you can target that
machine on the Ruby/Vagrantfile side like
if default_os != 'bento/ubuntu-14.04' then
puts "Updating Underlying OS"
config.vm.provision "shell", inline: $your_script
end
On Tue, Feb 11, 2020 at 3:21 PM Brian Cain <[email protected]> wrote:
> Hey Steve -
>
> On Tue, Feb 11, 2020 at 8:10 AM Steve Freeman <[email protected]>
> 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].
>> 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/CADHESCXvz%3Dx7vcccJgKxciCQL43TTzDeWv1ztj0VEQ5wKG3G%2BQ%40mail.gmail.com
> <https://groups.google.com/d/msgid/vagrant-up/CADHESCXvz%3Dx7vcccJgKxciCQL43TTzDeWv1ztj0VEQ5wKG3G%2BQ%40mail.gmail.com?utm_medium=email&utm_source=footer>
> .
>
--
Dan Morgan
617.444.9251
--
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/CANsmJYHG3L9Dy4D1qXLorXWjtwiZwWaH5xgnH0K0dP7%2BTAOB2Q%40mail.gmail.com.