vagrant 명령어를 실행하여 provision 관련 옵션이 있는지 찾아보면 잘 드러나지 않는다. 


$  vagrant

Usage: vagrant [options] <command> [<args>]


    -v, --version                    Print the version and exit.

    -h, --help                       Print this help.


Common commands:

     box             manages boxes: installation, removal, etc.

     connect         connect to a remotely shared Vagrant environment

     destroy         stops and deletes all traces of the vagrant machine

     global-status   outputs status Vagrant environments for this user

     halt            stops the vagrant machine

     help            shows the help for a subcommand

     init            initializes a new Vagrant environment by creating a Vagrantfile

     login           log in to Vagrant Cloud

     package         packages a running vagrant environment into a box

     plugin          manages plugins: install, uninstall, update, etc.

     provision       provisions the vagrant machine

     rdp             connects to machine via RDP

     reload          restarts vagrant machine, loads new Vagrantfile configuration

     resume          resume a suspended vagrant machine

     share           share your Vagrant environment with anyone in the world

     ssh             connects to machine via SSH

     ssh-config      outputs OpenSSH valid configuration to connect to the machine

     status          outputs status of the vagrant machine

     suspend         suspends the machine

     up              starts and provisions the vagrant environment

     version         prints current and latest Vagrant version


For help on any individual command run `vagrant COMMAND -h`


Additional subcommands are available, but are either more advanced

or not commonly used. To see all subcommands, run the command

`vagrant list-commands`.


$  vagrant list-commands

Below is a listing of all available Vagrant commands and a brief

description of what they do.


box             manages boxes: installation, removal, etc.

connect         connect to a remotely shared Vagrant environment

destroy         stops and deletes all traces of the vagrant machine

docker-logs     outputs the logs from the Docker container

docker-run      run a one-off command in the context of a container

global-status   outputs status Vagrant environments for this user

halt            stops the vagrant machine

help            shows the help for a subcommand

init            initializes a new Vagrant environment by creating a Vagrantfile

list-commands   outputs all available Vagrant subcommands, even non-primary ones

login           log in to Vagrant Cloud

package         packages a running vagrant environment into a box

plugin          manages plugins: install, uninstall, update, etc.

provision       provisions the vagrant machine

rdp             connects to machine via RDP

reload          restarts vagrant machine, loads new Vagrantfile configuration

resume          resume a suspended vagrant machine

rsync           syncs rsync synced folders to remote machine

rsync-auto      syncs rsync synced folders automatically when files change

share           share your Vagrant environment with anyone in the world

ssh             connects to machine via SSH

ssh-config      outputs OpenSSH valid configuration to connect to the machine

status          outputs status of the vagrant machine

suspend         suspends the machine

up              starts and provisions the vagrant environment

version         prints current and latest Vagrant version


그럴 때는 명령어를 주고 -h 옵션을 주면 provision 여부를 확인할 수 있다. 

$ vagrant reload  -h

Usage: vagrant reload [vm-name]


        --[no-]provision             Enable or disable provisioning

        --provision-with x,y,z       Enable only certain provisioners, by type.

    -h, --help                       Print this help


$ vagrant up -h

Usage: vagrant up [options] [name]


Options:


        --[no-]provision             Enable or disable provisioning

        --provision-with x,y,z       Enable only certain provisioners, by type.

        --[no-]destroy-on-error      Destroy machine if any fatal error happens (default to true)

        --[no-]parallel              Enable or disable parallelism if provider supports it

        --provider PROVIDER          Back the machine with a specific provider

    -h, --help                       Print this help


$ vagrant provision -h

Usage: vagrant provision [vm-name] [--provision-with x,y,z]

        --provision-with x,y,z       Enable only certain provisioners, by type.

        --[no-]parallel              Enable or disable parallelism if provider supports it.

    -h, --help                       Print this help



이 명령어를 조합하면 provision에 대한 것을 확인할 수 있다. ansible을 활용하면 ansible-playbook 명령어를 이용해서 provision을 할 수 있다. 


$ vagrant reload --provision

$ vagrant reload --no-provision

$ vagrant up --no-provision

$ vagrant up --provision

$ vagrant provision

$ ansible-playbook -i hosts playbook.yml

Posted by '김용환'
,