-
-
Save nlinker/4057857 to your computer and use it in GitHub Desktop.
Connecting between VMs with vagrant
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
config.vm.define :puppet do |app_config| | |
app_config.vm.customize ["modifyvm", :id, "--name", "puppet", "--memory", "512"] | |
app_config.vm.box = "precise_with_puppet" | |
app_config.hosts.name = 'puppet' | |
app_config.vm.host_name = 'puppet' | |
app_config.vm.forward_port 22, 2222, :auto => true | |
app_config.vm.forward_port 80, 4561 | |
app_config.vm.network :hostonly, "33.13.13.01" | |
app_config.vm.provision :shell do |shell| | |
shell.path = "../puppet_master_setup.sh" | |
end | |
end | |
config.vm.define :app do |app_config| | |
app_config.vm.customize ["modifyvm", :id, "--name", "app", "--memory", "512"] | |
app_config.vm.box = "precise_with_puppet" | |
app_config.hosts.name = 'app' | |
app_config.vm.host_name = 'app' | |
app_config.vm.forward_port 22, 2222, :auto => true | |
app_config.vm.forward_port 80, 4567 | |
app_config.vm.network :hostonly, "33.13.13.05" | |
app_config.vm.provision :shell do |shell| | |
shell.path = "../puppet_setup.sh" | |
end | |
end | |
# ================= # | |
# puppet /etc/hosts | |
# ================= # | |
127.0.0.1 localhost | |
127.0.1.1 puppet puppet vagrant-ubuntu-precise | |
# The following lines are desirable for IPv6 capable hosts | |
::1 ip6-localhost ip6-loopback | |
fe00::0 ip6-localnet | |
ff00::0 ip6-mcastprefix | |
ff02::1 ip6-allnodes | |
ff02::2 ip6-allrouters | |
33.13.13.05 app # VAGRANT: 949dcec6-5260-45ef-a722-a29ae0d01eaf (app) | |
# ================= # | |
# app /etc/hosts | |
# ================= # | |
127.0.0.1 localhost | |
127.0.1.1 app vagrant-ubuntu-precise | |
# The following lines are desirable for IPv6 capable hosts | |
::1 ip6-localhost ip6-loopback | |
fe00::0 ip6-localnet | |
ff00::0 ip6-mcastprefix | |
ff02::1 ip6-allnodes | |
ff02::2 ip6-allrouters | |
33.13.13.01 puppet # VAGRANT: 5f450945-4be7-47ea-bdb5-7c062af3f72a (puppet) | |
# Testing ping from app machine | |
vagrant@app:~$ ping puppet | |
ping: unknown host puppet | |
vagrant@app:~$ ping 33.13.13.01 | |
PING 33.13.13.01 (33.13.13.1) 56(84) bytes of data. | |
64 bytes from 33.13.13.1: icmp_req=1 ttl=64 time=0.019 ms | |
# Testing ping from puppet | |
vagrant@puppet:~$ ping app | |
ping: unknown host app | |
vagrant@puppet:~$ ping 33.13.13.05 | |
PING 33.13.13.05 (33.13.13.5) 56(84) bytes of data. | |
64 bytes from 33.13.13.5: icmp_req=7 ttl=64 time=0.403 ms | |
# etc hosts on the main machine (non-vagrant) | |
33.13.13.01 puppet # VAGRANT: 949dcec6-5260-45ef-a722-a29ae0d01eaf (puppet) | |
33.13.13.05 app # VAGRANT: 5f450945-4be7-47ea-bdb5-7c062af3f72a (app) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment