Provisioning in vagrant
1.Allows to install software automatically
2.Alter configurations
3.you can install software manually(it is not advisable for repeatable task)
4.you can
The shell provisioner takes various options. One of
1.
2.
3.
Sample Examples:
2.Alter configurations
3.you can install software manually(it is not advisable for repeatable task)
4.you can
vagrant destroy
and vagrant up
and have a fully ready-to-go work environment with a single command.The shell provisioner takes various options. One of
inline
or path
is required:1.
inline
(string) - Specifies a shell command inline to execute on the remote machine. See the inline scripts section below for more information.2.
path
(string) - Path to a shell script to upload and execute. It can be a script relative to the project Vagrantfile or a remote script (like a gist).3.
args
(string or array) - Arguments to pass to the shell script when executing it as a single string. These arguments must be written as if they were typed directly on the command line, so be sure to escape characters, quote, etc. as needed. You may also pass the arguments in using an array. In this case, Vagrant will handle quoting for you.Sample Examples:
Vagrant.configure("2") do |config|
config.vm.provision "shell",
inline: "echo Hello, World"
end
$script = <<SCRIPT
echo I am provisioning...
date > /etc/vagrant_provisioned_at
SCRIPT
Vagrant.configure("2") do |config|
config.vm.provision "shell", inline: $script
end
Vagrant.configure("2") do |config|
config.vm.provision "shell", path: "script.sh"
end
Vagrant.configure("2") do |config|
config.vm.provision "shell", path: "https://example.com/provisioner.sh"
end
Vagrant.configure("2") do |config|
config.vm.provision "shell" do |s|
s.inline = "echo $1"
s.args = "'hello, world!'"
end
end
Vagrant.configure("2") do |config|
config.vm.provision "shell" do |s|
s.inline = "echo $1"
s.args = ["hello, world!"]
end
end
Subscribe to:
Post Comments
(
Atom
)
No comments :
Post a Comment