Coder Social home page Coder Social logo

vagrant-config_builder's Introduction

Vagrant Config Builder

Configure and manage your Vagrant environments with data.

Build Status

Synopsis

This plugin provides an interface to the Vagrant configuration constructs in a logic free manner. You can format your input data to fit your needs and use vagrant-config_builder to transform that into the needed Vagrant config.

Example

This example loads all yaml files in the config directory and generates a Vagrant config based on that information. File names are arbitrary and chosen for clarity.

Directory structure

.
├── config
│   ├── roles.yaml
│   └── vms.yaml
└── Vagrantfile

Vagrantfile

For pure yaml configurations, use yaml loader:

require 'config_builder'
Vagrant.configure('2', &ConfigBuilder.load(
  :yaml,
  :yamldir,
  File.expand_path('../config', __FILE__)
))

For yaml erb configurations, use yaml_erb loader:

require 'config_builder'
Vagrant.configure('2', &ConfigBuilder.load(
  :yaml_erb,
  :yamldir,
  File.expand_path('../config', __FILE__)
))

The yaml_erb loader would allow configuration such as:

---
roles:
  puppet_apply:
    provisioners:
      - type: puppet
        manifests_path: 'tests'
        module_path: 'spec/fixtures/modules'
        manifest_file: <%= ENV['VAGRANT_MANIFEST'] || 'init.pp' %>
        hiera_config_path: "hiera.yaml"

config/roles.yaml

---
boxes:
  centos-65-x64: http://puppet-vagrant-boxes.puppetlabs.com/centos-65-x64-virtualbox-puppet.box
  debian-73-x64: http://puppet-vagrant-boxes.puppetlabs.com/debian-73-x64-virtualbox-puppet.box
roles:
  bigvm:
    provider:
      type: virtualbox
      customize: [[modifyvm, !ruby/sym id, '--memory', 1024]]
    synced_folders:
      - host_path: '.'
        guest_path: '/vagrant'
        disabled: true
  smallvm:
    provider:
      type: vmware
      vmx:
        memsize: 512
        numvcpus: 1

config/vms.yaml

---
vms:
  -
    name: db
    private_networks: [ {ip: '10.20.1.2'} ]
    box: centos-65-x64
    hostname: db.puppetlabs.vm
    roles: bigvm
  -
    name: web
    private_networks: [ {ip: '10.20.1.3'} ]
    box: debian-73-x64

Installation

Installation into the Vagrant internal gems:

  • vagrant plugin install vagrant-config_builder

Installation from source

Build the gem:

  • gem build vagrant-config_builder.gemspec

Install the gem:

  • gem install vagrant-config_builder-<version>.gem

vagrant-config_builder's People

Contributors

adrienthebo avatar sharpie avatar nanliu avatar pradels avatar reidmv avatar adamcrews avatar ccaum avatar hunner avatar iristyle avatar jozefizso avatar petems avatar kr3cj avatar

Watchers

James Cloos avatar Roman Lishtaba avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.