Search code examples
vagrantvagrant-provision

centos vagrant boxes are invoking init script every instance on vagrant up command


I'm having centos vagrant box. Code can be found here.

On each instance when I do vagrant up, the shell script for provisioning is invoked.

This is not the case when I have ubuntu based vagrant box. Ubuntu box provisions only when I do vagrant reload not on vagrant up command.

How can I avoid invoking provision shell script every time on vagrant up without changing the file or vagrant OS.


Solution

  • In your Vagrant file you setup

    config.vm.provision "shell", run: "always", path: "standalone.sh"
    

    run: "always"

    In this case provision will not be invoked only if you run

    vagrant up --no-provision
    

    https://www.vagrantup.com/docs/cli/up.html#no-provision