vagrant.rst
changeset 2201 af2d2e117b4e
parent 2197 5ee52f8d25b5
child 2236 15e9cc9e054f
equal deleted inserted replaced
2200:75f1bafcfe41 2201:af2d2e117b4e
    12 
    12 
    13 Default is ``~/.vagrant.d`` for Linux and ``%USERPROFILE%\.vagrant.d`` for Windows.
    13 Default is ``~/.vagrant.d`` for Linux and ``%USERPROFILE%\.vagrant.d`` for Windows.
    14 
    14 
    15 https://www.vagrantup.com/docs/other/environmental-variables.html
    15 https://www.vagrantup.com/docs/other/environmental-variables.html
    16 
    16 
       
    17 Running individual provisioning scripts
       
    18 =======================================
       
    19 
       
    20 You may give name to provisioning script::
       
    21 
       
    22   Vagrant.configure("2") do |config|
       
    23     config.vm.provision 'user_ssh', type: :shell, privileged: false do |s|
       
    24       ssh_pub_key = File.readlines("#{Dir.home}/.ssh/id_rsa.pub").first.strip
       
    25       s.inline = "echo #{ssh_pub_key} >> /home/$USER/.ssh/authorized_keys"
       
    26     end
       
    27     config.vm.provision 'root_ssh', type: :shell, privileged: true do |s|
       
    28       ssh_pub_key = File.readlines("#{Dir.home}/.ssh/id_rsa.pub").first.strip
       
    29       s.inline = "mkdir /root/.ssh/; echo #{ssh_pub_key} >> /root/.ssh/authorized_keys"
       
    30     end
       
    31     ...
       
    32   end
       
    33 
       
    34 and apply them individually::
       
    35 
       
    36   vagrant provision --provision-with user_ssh
       
    37   vagrant provision --provision-with root_ssh
       
    38   vagrant provision --provision-with user_ssh,root_ssh
       
    39