This shows you the differences between two versions of the page.
| Both sides previous revision Previous revision Next revision | Previous revision | ||
|
технология_vagrant [2024/09/09 07:44] val [Внутри Vagrantfile] |
технология_vagrant [2025/07/29 16:23] (current) val [Управление образами] |
||
|---|---|---|---|
| Line 14: | Line 14: | ||
| * [[https://hashicorp-releases.yandexcloud.net/vagrant/]] | * [[https://hashicorp-releases.yandexcloud.net/vagrant/]] | ||
| - | * [[https://val.bmstu.ru/unix/HashiCorp/vagrant_2.2.10_x86_64.msi]] | + | * [[https://val.bmstu.ru/unix/HashiCorp/vagrant_2.4.3_windows_amd64.msi]] |
| - | * [[http://gate.isp.un/unix/HashiCorp/vagrant_2.2.10_x86_64.msi]] | + | |
| * Можно не перезагружать систему, но нужно перезапустить Cmder | * Можно не перезагружать систему, но нужно перезапустить Cmder | ||
| Line 48: | Line 47: | ||
| $ vagrant box list | $ vagrant box list | ||
| - | $ vagrant box add /c/distrs/ubuntu_20.04.box --name specialist/ubuntu20 | + | $ ### vagrant box add /c/distrs/ubuntu_20.04.box --name specialist/ubuntu20 |
| $ ### vagrant box add generic/debian12 | $ ### vagrant box add generic/debian12 | ||
| - | $ ### vagrant box add /c/distrs/debian12-generic.box --name generic/debian12 | + | $ ### vagrant box remove generic/debian12 |
| + | |||
| + | $ vagrant box add /c/distrs/debian12-generic.box --name generic/debian12 | ||
| $ vagrant box list | $ vagrant box list | ||
| Line 63: | Line 64: | ||
| $ cd ~/nodes | $ cd ~/nodes | ||
| - | $ vagrant init specialist/ubuntu20 | + | $ ###vagrant init specialist/ubuntu20 |
| - | $ ###vagrant init generic/debian12 | + | $ vagrant init generic/debian12 |
| $ less Vagrantfile | $ less Vagrantfile | ||
| Line 169: | Line 170: | ||
| λ vagrant up --provision | λ vagrant up --provision | ||
| + | λ ###vagrant provision --provision-with provision_once | ||
| λ ###vagrant reload --provision | λ ###vagrant reload --provision | ||
| λ vagrant ssh | λ vagrant ssh | ||
| + | |||
| $ date | $ date | ||
| + | $ ip a | ||
| </code> | </code> | ||
| Line 200: | Line 204: | ||
| timedatectl set-timezone Europe/Moscow | timedatectl set-timezone Europe/Moscow | ||
| - | apt update | + | apt-get update |
| - | #apt install -y docker.io | + | |
| + | apt-get purge resolvconf | ||
| + | rm /etc/resolv.conf | ||
| + | touch /etc/resolv.conf | ||
| + | |||
| + | #apt-get install -y docker.io | ||
| </code><code> | </code><code> | ||
| λ touch provision_onstart.sh | λ touch provision_onstart.sh | ||
| Line 223: | Line 232: | ||
| λ cat Vagrantfile | λ cat Vagrantfile | ||
| </code><code> | </code><code> | ||
| + | ... | ||
| + | config.vm.synced_folder ".", "/vagrant", disabled: false | ||
| ... | ... | ||
| + | ### My provision ### | ||
| + | ### /My provision ### | ||
| + | ... | ||
| + | </code><code> | ||
| + | vagrant@node1:~$ ls /vagrant/ | ||
| + | |||
| + | vagrant@node1:~$ tr -d '\r' < /vagrant/provision_once.sh | shellcheck - | ||
| + | vagrant@node1:~$ tr -d '\r' < /vagrant/provision_onstart.sh | shellcheck - | ||
| + | </code><code> | ||
| + | λ cat Vagrantfile | ||
| + | </code><code> | ||
| ### My provision ### | ### My provision ### | ||
| Line 235: | Line 257: | ||
| ... | ... | ||
| </code><code> | </code><code> | ||
| - | vagrant@node1:~$ ls /vagrant/ | ||
| - | |||
| - | vagrant@node1:~$ shellcheck /vagrant/provision_once.sh | ||
| - | vagrant@node1:~$ shellcheck /vagrant/provision_onstart.sh | ||
| - | |||
| λ vagrant provision --provision-with provision_once,provision_onstart | λ vagrant provision --provision-with provision_once,provision_onstart | ||