Inline Scripts

We've briefly touched upon inline scripts, but there are more options available that can be added into the configuration for provisioning.

You can run a script inline using the following syntax:

config.vm.provision "shell", inline: "sudo apt-get update -y && echo updating finished"

Or you could create a variable outside the block and use that variable for a cleaner and easier-to-read format:

$shellscript = <<-SCRIPT
sudo apt-get update -y
echo updating finished
SCRIPT

config.vm.provision "shell", inline: $shellscript

You can experiment with both options and see what works best for you. You may find that, when working on a development team, they already have a syntax you must follow when creating and editing Vagrantfiles.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.217.194.39