User Tools

Site Tools


технология_vagrant

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision Both sides next revision
технология_vagrant [2022/08/15 09:49]
val [С использованием внешних скриптов]
технология_vagrant [2022/08/15 13:46]
val
Line 63: Line 63:
  
 <​code>​ <​code>​
-$ mkdir ~/node1+$ mkdir ~/nodes
  
-$ cd ~/node1+$ cd ~/nodes
  
 $ vagrant init specialist/​ubuntu20 $ vagrant init specialist/​ubuntu20
Line 186: Line 186:
 vagrant@node1:​~$ ls /vagrant/ vagrant@node1:​~$ ls /vagrant/
 </​code>​ </​code>​
- 
- 
  
 ==== С использованием ansible ==== ==== С использованием ansible ====
Line 205: Line 203:
  
 ===== Multi-Machine Vagrant Environments ===== ===== Multi-Machine Vagrant Environments =====
- 
-<​code>​ 
-$ mkdir ~/nodes 
- 
-$ cd ~/nodes 
- 
-$ vagrant init specialist/​ubuntu20 
-</​code>​ 
  
 ==== Внутри Vagrantfile ==== ==== Внутри Vagrantfile ====
Line 227: Line 217:
  
   config.vm.define "​node1"​ do |node1|   config.vm.define "​node1"​ do |node1|
-    node1.vm.network "​private_network",​ ip: "​192.168.X.210"+    node1.vm.network "​private_network",​ ip: "​192.168.X.201"
   end   end
  
   config.vm.define "​node2"​ do |node2|   config.vm.define "​node2"​ do |node2|
-    node2.vm.network "​private_network",​ ip: "​192.168.X.220"+    node2.vm.network "​private_network",​ ip: "​192.168.X.202"
   end   end
  
   config.vm.define "​node3"​ do |node3|   config.vm.define "​node3"​ do |node3|
-    node3.vm.network "​private_network",​ ip: "​192.168.X.230"+    node3.vm.network "​private_network",​ ip: "​192.168.X.203"
   end   end
   ​   ​
Line 250: Line 240:
     {     {
         :name => "​node1",​         :name => "​node1",​
-        :ip => "​192.168.X.210",+        :ip => "​192.168.X.201",
         :​vbox_config => [         :​vbox_config => [
             { "​--cpus"​ => "​2"​ },             { "​--cpus"​ => "​2"​ },
Line 258: Line 248:
     {     {
         :name => "​node2",​         :name => "​node2",​
-        :ip => "​192.168.X.220",+        :ip => "​192.168.X.202",
         :​vbox_config => [         :​vbox_config => [
             { "​--cpus"​ => "​2"​ },             { "​--cpus"​ => "​2"​ },
Line 266: Line 256:
     {     {
         :name => "​node3",​         :name => "​node3",​
-        :ip => "​192.168.X.230",+        :ip => "​192.168.X.203",
         :​vbox_config => [         :​vbox_config => [
             { "​--cpus"​ => "​2"​ },             { "​--cpus"​ => "​2"​ },
Line 282: Line 272:
       config.vm.hostname = opts[:name]       config.vm.hostname = opts[:name]
  
-      ​config.vm.provider "​virtualbox"​ do | vb | +#      ​config.vm.provider "​virtualbox"​ do | vb | 
-        file_to_disk = opts[:name] + '​_2.vdi'​ +       ​file_to_disk = opts[:name] + '​_2.vdi'​ 
-        unless File.exist?​(file_to_disk) +       ​unless File.exist?​(file_to_disk) 
-          vb.customize ['​createhd',​ '​--filename',​ file_to_disk,​ '​--size',​ 5 * 1024] +         ​vb.customize ['​createhd',​ '​--filename',​ file_to_disk,​ '​--size',​ 5 * 1024] 
-        end +       end 
-        vb.customize ['​storageattach',​ :id, '​--storagectl',​ '​SATA',​ '​--port',​ 2, '​--device',​ 0, '​--type',​ '​hdd',​ '​--medium',​ file_to_disk] +       ​vb.customize ['​storageattach',​ :id, '​--storagectl',​ '​SATA',​ '​--port',​ 2, '​--device',​ 0, '​--type',​ '​hdd',​ '​--medium',​ file_to_disk] 
-      end+     end
  
       opts[:​vbox_config].each do |hash|       opts[:​vbox_config].each do |hash|
Line 318: Line 308:
     {     {
         "​name":​ "​node1",​         "​name":​ "​node1",​
-        "​ip":​ "​192.168.X.210",+        "​ip":​ "​192.168.X.201",
         "​vbox_config":​ [         "​vbox_config":​ [
             { "​--cpus":​ "​2"​ },             { "​--cpus":​ "​2"​ },
Line 326: Line 316:
     {     {
         "​name":​ "​node2",​         "​name":​ "​node2",​
-        "​ip":​ "​192.168.X.220",+        "​ip":​ "​192.168.X.202",
         "​vbox_config":​ [         "​vbox_config":​ [
             { "​--cpus":​ "​2"​ },             { "​--cpus":​ "​2"​ },
Line 334: Line 324:
     {     {
         "​name":​ "​node3",​         "​name":​ "​node3",​
-        "​ip":​ "​192.168.X.230",+        "​ip":​ "​192.168.X.203",
         "​vbox_config":​ [         "​vbox_config":​ [
             { "​--cpus":​ "​2"​ },             { "​--cpus":​ "​2"​ },
технология_vagrant.txt · Last modified: 2024/06/29 13:17 by val