author | Oleksandr Gavenko <gavenkoa@gmail.com> |
Mon, 22 Jan 2018 19:19:51 +0200 | |
changeset 2217 | 3005f2860e3c |
parent 2201 | af2d2e117b4e |
child 2236 | 15e9cc9e054f |
permissions | -rw-r--r-- |
2197
5ee52f8d25b5
Changing Vagrant home directory.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff
changeset
|
1 |
|
5ee52f8d25b5
Changing Vagrant home directory.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff
changeset
|
2 |
========= |
5ee52f8d25b5
Changing Vagrant home directory.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff
changeset
|
3 |
Vagrant |
5ee52f8d25b5
Changing Vagrant home directory.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff
changeset
|
4 |
========= |
5ee52f8d25b5
Changing Vagrant home directory.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff
changeset
|
5 |
|
5ee52f8d25b5
Changing Vagrant home directory.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff
changeset
|
6 |
Changing Vagrant home directory |
5ee52f8d25b5
Changing Vagrant home directory.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff
changeset
|
7 |
=============================== |
5ee52f8d25b5
Changing Vagrant home directory.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff
changeset
|
8 |
|
5ee52f8d25b5
Changing Vagrant home directory.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff
changeset
|
9 |
Set ``VAGRANT_HOME`` env var, like:: |
5ee52f8d25b5
Changing Vagrant home directory.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff
changeset
|
10 |
|
5ee52f8d25b5
Changing Vagrant home directory.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff
changeset
|
11 |
VAGRANT_HOME=d:\srv\vagrant |
5ee52f8d25b5
Changing Vagrant home directory.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff
changeset
|
12 |
|
5ee52f8d25b5
Changing Vagrant home directory.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff
changeset
|
13 |
Default is ``~/.vagrant.d`` for Linux and ``%USERPROFILE%\.vagrant.d`` for Windows. |
5ee52f8d25b5
Changing Vagrant home directory.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff
changeset
|
14 |
|
5ee52f8d25b5
Changing Vagrant home directory.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff
changeset
|
15 |
https://www.vagrantup.com/docs/other/environmental-variables.html |
5ee52f8d25b5
Changing Vagrant home directory.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
diff
changeset
|
16 |
|
2201
af2d2e117b4e
Running individual provisioning scripts.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
2197
diff
changeset
|
17 |
Running individual provisioning scripts |
af2d2e117b4e
Running individual provisioning scripts.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
2197
diff
changeset
|
18 |
======================================= |
af2d2e117b4e
Running individual provisioning scripts.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
2197
diff
changeset
|
19 |
|
af2d2e117b4e
Running individual provisioning scripts.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
2197
diff
changeset
|
20 |
You may give name to provisioning script:: |
af2d2e117b4e
Running individual provisioning scripts.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
2197
diff
changeset
|
21 |
|
af2d2e117b4e
Running individual provisioning scripts.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
2197
diff
changeset
|
22 |
Vagrant.configure("2") do |config| |
af2d2e117b4e
Running individual provisioning scripts.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
2197
diff
changeset
|
23 |
config.vm.provision 'user_ssh', type: :shell, privileged: false do |s| |
af2d2e117b4e
Running individual provisioning scripts.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
2197
diff
changeset
|
24 |
ssh_pub_key = File.readlines("#{Dir.home}/.ssh/id_rsa.pub").first.strip |
af2d2e117b4e
Running individual provisioning scripts.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
2197
diff
changeset
|
25 |
s.inline = "echo #{ssh_pub_key} >> /home/$USER/.ssh/authorized_keys" |
af2d2e117b4e
Running individual provisioning scripts.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
2197
diff
changeset
|
26 |
end |
af2d2e117b4e
Running individual provisioning scripts.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
2197
diff
changeset
|
27 |
config.vm.provision 'root_ssh', type: :shell, privileged: true do |s| |
af2d2e117b4e
Running individual provisioning scripts.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
2197
diff
changeset
|
28 |
ssh_pub_key = File.readlines("#{Dir.home}/.ssh/id_rsa.pub").first.strip |
af2d2e117b4e
Running individual provisioning scripts.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
2197
diff
changeset
|
29 |
s.inline = "mkdir /root/.ssh/; echo #{ssh_pub_key} >> /root/.ssh/authorized_keys" |
af2d2e117b4e
Running individual provisioning scripts.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
2197
diff
changeset
|
30 |
end |
af2d2e117b4e
Running individual provisioning scripts.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
2197
diff
changeset
|
31 |
... |
af2d2e117b4e
Running individual provisioning scripts.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
2197
diff
changeset
|
32 |
end |
af2d2e117b4e
Running individual provisioning scripts.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
2197
diff
changeset
|
33 |
|
af2d2e117b4e
Running individual provisioning scripts.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
2197
diff
changeset
|
34 |
and apply them individually:: |
af2d2e117b4e
Running individual provisioning scripts.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
2197
diff
changeset
|
35 |
|
af2d2e117b4e
Running individual provisioning scripts.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
2197
diff
changeset
|
36 |
vagrant provision --provision-with user_ssh |
af2d2e117b4e
Running individual provisioning scripts.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
2197
diff
changeset
|
37 |
vagrant provision --provision-with root_ssh |
af2d2e117b4e
Running individual provisioning scripts.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
2197
diff
changeset
|
38 |
vagrant provision --provision-with user_ssh,root_ssh |
af2d2e117b4e
Running individual provisioning scripts.
Oleksandr Gavenko <gavenkoa@gmail.com>
parents:
2197
diff
changeset
|
39 |