Created
June 10, 2015 21:40
-
-
Save jpic/3da63c660f56b2c0ad24 to your computer and use it in GitHub Desktop.
Example ruby loops in Vagrantfile
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# -*- mode: ruby -*- | |
# vi: set ft=ruby : | |
require 'fileutils' | |
Vagrant.require_version ">= 1.6.0" | |
Vagrant.configure(2) do |config| | |
(1..2).each do |i| | |
config.vm.define vm_name = "yl%d" % i do |config| | |
config.vm.hostname = vm_name | |
config.vm.network :private_network, ip: "172.16.16.#{i+100}" | |
config.vm.box = "terrywang/archlinux" | |
config.vm.provision "ansible" do |ansible| | |
ansible.playbook = "Vagrantplaybook.yml" | |
ansible.groups = { | |
'pg' => ["pg1", "pg2"], | |
} | |
ansible.extra_vars = { | |
pg_master: 'pg1', | |
pg_hot_standby: 'on', | |
} | |
end | |
end | |
end | |
(1..2).each do |i| | |
config.vm.define vm_name = "bdr%d" % i do |config| | |
config.vm.hostname = vm_name | |
config.vm.network :private_network, ip: "172.16.17.#{i+100}" | |
config.vm.box = "terrywang/archlinux" | |
config.vm.provision "ansible" do |ansible| | |
ansible.playbook = "Vagrantplaybook.yml" | |
ansible.verbose = 'vvvv' | |
ansible.groups = { | |
'pg' => ["bdr1", "bdr2"], | |
} | |
ansible.extra_vars = { | |
pg_bdr_path: "/home/vagrant/bdr", | |
pg_track_commit_timestamp: 'on', | |
pg_shared_preload_libraries: 'bdr', | |
pg_bdr_default_apply_delay: '2000', | |
pg_bdr_log_conflicts_to_table: 'on', | |
} | |
end | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment