Reputation: 22208
Trying to execute a very basic example of triggers usage shown in the official docs:
Vagrant.configure("2") do |config|
config.trigger.before :up do |trigger|
trigger.name = "Hello world"
trigger.info = "I am running before vagrant up!!"
end
config.trigger.after :up do |trigger|
trigger.name = "Hello world"
trigger.info = "I am running after vagrant up!!"
end
config.vm.define "ubuntu" do |ubuntu|
ubuntu.vm.box = "ubuntu/trusty64"
end
end
Failing with the following error:
Vagrant: Unknown configuration section 'trigger'.
Any idea?
(*) The vagrant-triggers plugin was merged to Vagrant 2.1.0 in may 2018.
Upvotes: 1
Views: 754
Reputation: 22208
OK, For some reason I thought I was on latest Version of Vagrant on local machine.
Problem was fixed after upgrading from version 2.0.2 to latest (currently 2.2.5).
Output looks fine now:
==> ubuntu: Running action triggers before up ...
==> ubuntu: Running trigger: Hello world...
==> ubuntu: I am running before vagrant up!!
....
==> ubuntu: Running action triggers after up ...
==> ubuntu: Running trigger: Hello world...
==> ubuntu: I am running after vagrant up!!
I hope it will help anybody...
Upvotes: 1