summaryrefslogtreecommitdiffstats
path: root/vm/vagrant-router/Vagrantfile
blob: 6e39ae0f0f2ebd84542410b41e3a809643478a8c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
# -*- mode: ruby -*-
# vi: set ft=ruby :

Vagrant.configure("2") do |config|
    config.vm.define "ipekatrinrouter" do |node|
        node.vm.box = "centos/7"
        node.vm.hostname = "ipekatrinrouter"
        node.vm.network "public_network", bridge: "br0", ip: "141.52.64.15", netmask: "255.255.254.0"
        node.vm.network "public_network", bridge: "br0", ip: "141.52.64.17", netmask: "255.255.254.0"
        node.vm.network "public_network", bridge: "br0", ip: "192.168.26.254"
        
        node.vm.provision "shell", run: "always", inline: "( ip addr show | grep 64.15 ) || ifcfg eth1 141.52.64.15/23"
        node.vm.provision "shell", run: "always", inline: "( ip addr show | grep 64.17 ) || ifcfg eth2 141.52.64.17/23"
        node.vm.provision "shell", run: "always", inline: "( ip addr show | grep 192.168.26 ) || ifcfg eth3 192.168.26.254"
        node.vm.provision "shell", run: "always", inline: "chmod +r /etc/sysconfig/network-scripts/ifcfg-eth*"
        node.vm.provision "shell", run: "always", inline: "chcon --reference /etc/sysconfig/network-scripts/ifcfg-eth0 /etc/sysconfig/network-scripts/ifcfg-eth*"
        
        node.vm.provision "shell" do |s|
            ssh_pub_key = File.readlines("/Image/My/Private/ssh/authorized_keys").first.strip
            s.inline = <<-SHELL
                mkdir -p /root/.ssh/
                echo #{ssh_pub_key} >> /root/.ssh/authorized_keys
            SHELL
        end

        node.vm.provider "virtualbox" do |vb|
            vb.memory = "1024"
            vb.customize [
                "modifyvm", :id,
                "--audio", "none",
            ]
        end
    end
end