forked from k-ta-yamada/postgres-ha-ansible
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Vagrantfile
58 lines (48 loc) · 1.69 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
# -*- mode: ruby -*-
# vi: set ft=ruby :
Vagrant.configure("2") do |config|
config.vm.box = "centos/7"
config.vm.box_version = "1710.01"
hosts = [
{ hostname: :pg1, ip: %w[192.168.1.201 192.168.2.201] },
{ hostname: :pg2, ip: %w[192.168.1.202 192.168.2.202] }
]
controle_node = { hostname: :pg0, ip: %w[192.168.1.200 192.168.2.200] }
hosts.unshift(controle_node) if /cygwin|mswin|mingw|bccwin|wince|emx/ =~ RUBY_PLATFORM
hosts.each do |host|
config.vm.define host[:hostname] do |node|
node.vm.provider "virtualbox" do |v|
v.linked_clone = true
end
node.vm.hostname = host[:hostname]
host[:ip].each { |ip| node.vm.network "private_network", ip: ip }
end
end
config.vm.provision "selinux:disabled", type: :shell do |s|
s.inline = <<-SHELL
sed -i 's/^SELINUX=enforcing/SELINUX=disabled/' /etc/selinux/config
setenforce 0
SHELL
end
config.vm.provision "sshd:password_authentication", type: :shell do |s|
s.inline = <<-SHELL
sed -i 's/^PasswordAuthentication no/PasswordAuthentication yes/' /etc/ssh/sshd_config
systemctl reload sshd.service
SHELL
end
config.vm.provision "timedatectl:set-timezone:Asia/Tokyo", type: :shell do |s|
s.inline = "timedatectl set-timezone Asia/Tokyo"
end
# optional
# if Vagrant.has_plugin?("vagrant-proxyconf")
# config.proxy.http = ENV["http_proxy"]
# config.proxy.https = ENV["https_proxy"]
# config.proxy.no_proxy = ENV["no_proxy"]
# end
# optional
# if Vagrant.has_plugin?("vagrant-hostmanager")
# config.hostmanager.enabled = true
# config.hostmanager.manage_host = true
# config.hostmanager.manage_guest = true
# end
end