Skip to content

Instantly share code, notes, and snippets.

@zamoose
Last active August 29, 2015 14:14
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save zamoose/6c247080078c96e682dc to your computer and use it in GitHub Desktop.
Save zamoose/6c247080078c96e682dc to your computer and use it in GitHub Desktop.
Proposed HGV YAML format
---
# Root-level array members should roughly line up with
# Ansible host groups
# Top level Ansible group containing HGV info.
# Should probably only ever contain one host.
vagrant_hosts:
# These map to the "hosts:" portion of the inventory
hgv.dev:
# Everything per-host maps to the "vars:" portion of the inventory
# Domains to pass to vagrant-hostsupdater
domains:
- mail.hgv.dev
- hgv.dev
- php.hgv.dev
- hhvm.hgv.dev
- vvv.hgv.dev
# Blank/generic sites to configure virtualhosts for
sites:
nowp.hgv.dev:
comment: Non-wordpress
# WordPress sites to pre-configure
wpsites:
vvv.hgv.dev:
comment: VVV
wp_version: 4.1
plugins:
- debug-bar
- wordpress-seo
themes:
- elbee-elgee
- hemingway
# Potential other Ansible host groups, ultimately up to anyone deploying
# HGV-powered images in their own infrastructure
# production:
# staging:
# development:
@markkelnar
Copy link

Bare with me, I'm going to ramble for a minute:

The example group name 'vagrant_hosts' is a bit confusing. Maybe you're right and that's the top level group containing default variables for this install.

Maybe to reduce the amount in one long yaml file, each vagrant_hosts is it's own inventory/yaml file. Then production.yml is one, staging.yml is another, development.yml, mark.com.yml, 10up.yml, etc.

Do you need the label 'hgv.dev' at that point? The listener role requires backend/upstream to be specified along with the domains that will pass to that upstream.

Looks like what you have here can be flattened a bit into a hierarchy of groups and subgroups. That leads me to think that each listener could be a subgroup of the top level group, 'vagrant_hosts' in this example. Each listener would have a list of hosts.

Using the power of group inheritance could clean this up a bit.

@zamoose
Copy link
Author

zamoose commented Feb 3, 2015

Here's my thinking @markkelnar:
If we add multiple YAML files to parse in multiple locations to get the group inheritance, it only increases end user confusion. I'd much rather have only two files to worry about -- a "core" one and a user-supplied one.

Now, y'all have been doing Ansible a lot longer than I have, so I'll defer on the wisdom of your approaches, but what I really do want to have available is that top level listing of domains if at all possible. If there's a known array/dictionary item that contains an array of all the domains I need to parse per-YAML file, then it's trivial to mash the two together and feed them into the vagrant-hostsupdater portion of the Vagrantfile, taking care of our DNS issues in one fell swoop.

I'm not envisioning the YAML file we ship with having separate groups, really -- those commented-out sections are there mainly as documentation for what your approach could be. I'd like to have an easy way to signal to the inventory script, "hey, this is data that applies only to the HGV setup, ignore everything else safely".

Am I making sense or do I seem off-base here?

@markkelnar
Copy link

Ok, I read ya. Let's progress and see what comes out.
How can I help?

@michaelbeil
Copy link

Didn't see this till now, but progress seems to happening with @bradp's https://github.com/bradp/vv integration with HgV.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment