apachevagrantpuphpet

Access vagrant VM with puphpet from local network?


I used vagrant and puphpet for two weeks and it works great. In my case I'll just use http://myserver.dev that I added to my host file as puphpet suggest

192.168.56.101 myserver.dev

Now I want to get access to my VM:s apache www folder from another computer in my local network.

This post suggest to uncomment some lines in vagrant file, but as I use puphpet my autogenerated vagrant file looks like this:

# -*- mode: ruby -*-

dir = File.dirname(File.expand_path(__FILE__))

require 'yaml'
require "#{dir}/puphpet/ruby/deep_merge.rb"
require "#{dir}/puphpet/ruby/to_bool.rb"
require "#{dir}/puphpet/ruby/puppet.rb"

configValues = YAML.load_file("#{dir}/puphpet/config.yaml")

provider = ENV['VAGRANT_DEFAULT_PROVIDER'] ? ENV['VAGRANT_DEFAULT_PROVIDER'] : 'local'
if File.file?("#{dir}/puphpet/config-#{provider}.yaml")
  custom = YAML.load_file("#{dir}/puphpet/config-#{provider}.yaml")
  configValues.deep_merge!(custom)
end

if File.file?("#{dir}/puphpet/config-custom.yaml")
  custom = YAML.load_file("#{dir}/puphpet/config-custom.yaml")
  configValues.deep_merge!(custom)
end

data = configValues['vagrantfile']

Vagrant.require_version '>= 1.8.1'

Vagrant.configure('2') do |config|
  eval File.read("#{dir}/puphpet/vagrant/Vagrantfile-#{data['target']}")
end

But there are no uncomment lines.

I thought maybe I need to do something in puphpet's config.yaml? Here's what I've found about ip and port:

machines:
    vflm_azud9vpjzelv:
        id: machine1
        hostname: myserver.puphpet
        network:
            private_network: 192.168.56.101
            forwarded_port:
                vflmnfp_rkr38vlo4vcb:
                    host: '6597'
                    guest: '22'
        memory: '512'
        cpus: '1'

Solution

  • You have two simple choices: