forked from takara9/vagrant-kubernetes
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathVagrantfile
118 lines (105 loc) · 3.74 KB
/
Vagrantfile
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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
# coding: utf-8
# -*- mode: ruby -*-
#
Vagrant.configure(2) do |config|
# ノード1 仮想マシンの起動
#
config.vm.define 'node1' do |machine|
machine.vm.box = "ubuntu/xenial64"
machine.vm.hostname = 'node1'
machine.vm.network :private_network,ip: "172.16.20.12"
#machine.vm.network :public_network, ip: "192.168.1.92", bridge: "en0: Ethernet"
machine.vm.provider "virtualbox" do |vbox|
vbox.gui = false
vbox.cpus = 1
vbox.memory = 1024
end
machine.vm.synced_folder ".", "/vagrant", owner: "vagrant",
group: "vagrant", mount_options: ["dmode=700", "fmode=700"]
# ノード1 docker & k8sのインストール
#
machine.vm.provision "ansible_local" do |ansible|
ansible.playbook = "ansible-playbook/kubernetes.yml"
ansible.version = "latest"
ansible.verbose = false
ansible.install = true
ansible.limit = "node1"
ansible.inventory_path = "ansible-playbook/hosts"
end
end
# ノード2 仮想マシンの起動
#
config.vm.define 'node2' do |machine|
machine.vm.box = "ubuntu/xenial64"
machine.vm.hostname = 'node2'
machine.vm.network :private_network,ip: "172.16.20.13"
#machine.vm.network :public_network, ip: "192.168.1.93", bridge: "en0: Ethernet"
machine.vm.provider "virtualbox" do |vbox|
vbox.gui = false
vbox.cpus = 1
vbox.memory = 1024
end
machine.vm.synced_folder ".", "/vagrant", owner: "vagrant",
group: "vagrant", mount_options: ["dmode=700", "fmode=700"]
# ノード2 docker & k8sのインストール
#
machine.vm.provision "ansible_local" do |ansible|
ansible.playbook = "ansible-playbook/kubernetes.yml"
ansible.version = "latest"
ansible.verbose = false
ansible.install = true
ansible.limit = "node2"
ansible.inventory_path = "ansible-playbook/hosts"
end
end
#
# マスタ 仮想マシンの起動
#
config.vm.define 'master' do |machine|
machine.vm.box = "ubuntu/xenial64"
machine.vm.hostname = 'master'
machine.vm.network :private_network,ip: "172.16.20.11"
#machine.vm.network :public_network, ip: "192.168.1.91", bridge: "en0: Ethernet"
machine.vm.provider "virtualbox" do |vbox|
vbox.gui = false
vbox.cpus = 1
vbox.memory = 1024
end
machine.vm.synced_folder ".", "/vagrant", owner: "vagrant",
group: "vagrant", mount_options: ["dmode=700", "fmode=700"]
#
# マスタ docker & k8sのインストール
#
machine.vm.provision "ansible_local" do |ansible|
ansible.playbook = "ansible-playbook/kubernetes.yml"
ansible.version = "latest"
ansible.verbose = false
ansible.install = true
ansible.limit = "master" # or only "nodes" group, etc.
ansible.inventory_path = "ansible-playbook/hosts"
end
# マスタのセットアップ
#
machine.vm.provision "ansible_local" do |ansible|
ansible.playbook = "ansible-playbook/k8s_master.yml"
ansible.version = "latest"
ansible.verbose = false
ansible.install = true
ansible.limit = "master"
ansible.inventory_path = "ansible-playbook/hosts"
end
# ノードのセットアップ
#
machine.vm.provision "ansible_local" do |ansible|
ansible.playbook = "ansible-playbook/k8s_nodes.yml"
ansible.version = "latest"
ansible.verbose = false
ansible.install = true
ansible.limit = "nodes"
ansible.inventory_path = "ansible-playbook/hosts"
end
end
if Vagrant.has_plugin?("vagrant-cachier")
config.cache.scope = :box
end
end