In this tutorial you will learn about Vagrant provisioning: how and when provisioning happens in Vagrant and also I will show you how to include bootstrap.sh shell provision script.
Code used during this tutorial:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 |
# Vagrant Provisioning # Provisioners in Vagrant allow you to automatically install software, alter configurations, # and more on the machine as part of the vagrant up process # See https://docs.vagrantup.com/v2/provisioning/index.html # WHEN PROVISIONING HAPPENS cd ~/vagrant/ubuntu-trusty32/ mkdir provision-shell vi provision-shell/bootstrap.sh #!/bin/bash echo 'Provisioning...' echo 'test' > /tmp/test.txt vi Vagrantfile config.vm.provision "shell", path: "provision-shell/bootstrap.sh" vagrant destroy -f vagrant up --provider virtualbox vagrant ssh ls /tmp/ vi /tmp/test.txt # Useful links https://docs.vagrantup.com/v2/provisioning/index.html https://docs.vagrantup.com/v2/provisioning/basic_usage.html https://docs.vagrantup.com/v2/provisioning/shell.html |
Useful links:
https://docs.vagrantup.com/v2/provisioning/index.html
https://docs.vagrantup.com/v2/provisioning/basic_usage.html
https://docs.vagrantup.com/v2/provisioning/shell.html