Vagrant: provisioning

From wikinotes

Provisioning, allows you to run a script that is run every time the image is run for the first time.

Vagrant.configure("2") do |config|
  config.vm.box = "hashicorp/precise32"

  # run a script after startup  (relpath from Vagrantfile dir)
  config.vm.provision :shell, \
    path: "scripts/bootstrap.sh"

  # run a single command (as root)
  config.vm.provision :shell, \
    inline: "pkg install -y bash"								

  # run a single comand, every time you boot
  config.vm.provision :shell,               \
    inline: "ip link set enp0s8 up", \
    :run => 'always'

  # copy a file into vagrant
  config.vm.provision "file", \  
    source:      "sshkeys/ansible_server/id_rsa.pub" \
    destination: "~/.ssh/id_rsa.pub"

end