Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feat/extras #111

Closed
wants to merge 2 commits into from
Closed

Conversation

purpleidea
Copy link

This patch adds support for adding additional /etc/hosts entries, which aren't present in vagrant. It is necessary for VIP's, or for simply listing hosts that you want to include in your /etc/hosts faked "DNS".

This patch is based off of my earlier feature: #109

If you'd like it rebased off of master, I can do that, but it makes sense to merge the other one first, and then this one.

Cheers,
James

@pbitty
Copy link
Contributor

pbitty commented Aug 27, 2014

@pixell and @purpleidea, both of you submitted recent PRs that in my opinion have an overlap in functionality. I'm wondering if we can implement something general enough to satisfy both use-cases.

In #101, the goal is to specify specific IPs per alias, per machine. In this PR, the goal is to specify extra hosts that will be added to every machine.

Since the machine-specific configs are always merged with the global config, it should be possible to implement an option that can be used at both levels. This is pretty much the functionality in this PR, except it should work at the machine level. When defined globally, it will apply to all machines.

Something like this:

# This applies to all machines
config.hostmanager.extra_hosts = [
    { ip: '10.0.0.2', host: 'banana', aliases: ['orange', 'strawberry']   },
    { ip: '10.0.0.3', host: 'cherry', aliases: ['raspberry', 'blueberry'] }
]

# This applies to only the one machine
config.vm.define :server1 do |machine|
    ## ... machine-specific config ...
    machine.vm.hostmanager.extra_hosts = [
        { ip: '10.0.0.10', host: 'red',   aliases: ['orange', 'yellow']  },
        { ip: '10.0.0.11', host: 'green', aliases: ['blue', 'purple']    }
    ]
end

@purpleidea, I the main change required in your PR is to tap into the machine's config instead of the global config (ie: use machine.config.hostmanager.extra_hosts). The rest should be handled by vagrant's config merge.

What do you both think?

This is needed on some systems so that:

hostname --fqdn

and

facter -p | grep fqdn

both return something useful.

This patch adds the fqdn_friendly and domain_name configuration options.
This is necessary if you want to add a VIP to each host, or if you want
to define a host that isn't part of your vagrant infrastructure, but
which needs to be listed in your "DNS".
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants