GithubHelp home page GithubHelp logo

jeffmccune / rizzo Goto Github PK

View Code? Open in Web Editor NEW

This project forked from ghoneycutt/rizzo

0.0 2.0 0.0 69 KB

Rizzo is a tool for working with Vagrant and layered Puppet control repos

License: Other

Ruby 99.80% Shell 0.20%

rizzo's Introduction

Rizzo

Rizzo is a heavily customized Vagrant configuration and work flow with a role based focus. It is meant to make working with Vagrant easier and purpose built for layered Puppet control repositories.

There should be at least one node for every role that is managed by a control repo. This information is stored in .rizzo.json under the control repo. This makes it apparent what roles are available and aids in functional testing.

Each control repo must have a directory under it named modules. It is up to you to populate this, so it works with the common tools such as librarian-puppet-simple, librarian-puppet and r10k, without being dependent on them.

Rizzo is named after Rizzo the Rat.

Installation

Add the rizzo gem to your control repository Gemfile. For example, in puppetdata:

diff --git a/Gemfile b/Gemfile
index 572f681..5c2f3b0 100644
--- a/Gemfile
+++ b/Gemfile
@@ -20,6 +20,7 @@ gem 'puppet-lint-undef_in_function-check'
 gem 'puppet-lint-unquoted_string-check'
 gem 'puppet-lint-variable_contains_upcase'
 gem 'puppet-syntax'
+gem 'rzo'

 gem 'serverspec', :require => false
 gem 'vagrant-wrapper', :require => false

Then update the bundle with:

bundle install --path .bundle/gems/
bundle update rzo

Interact with rizzo using:

bundle exec rizzo --help
usage: rizzo [GLOBAL OPTIONS] SUBCOMMAND [ARGS]
Sub Commands:

  config       Print out the combined rizzo json config
  generate     Initialize Vagrantfile in top control repo

Global options: (Note, command line arguments supersede ENV vars in {}'s)
  -l, --logto=<s>     Log file to write to or keywords STDOUT, STDERR {RZO_LOGTO} (default: STDERR)
  -s, --syslog        Log to syslog
  -v, --verbose       Set log level to INFO
  -d, --debug         Set log level to DEBUG
  -c, --config=<s>    Rizzo config file {RZO_CONFIG} (default: ~/.rizzo.json)
  -e, --version       Print version and exit
  -h, --help          Show this message

Once rizzo is installed, setup your configuration file, ~/.rizzo.json, then use bundle exec rizzo generate to write the Vagrantfile in your control repo.

Dependencies

  1. vagrant-vbguest gem See https://github.com/dotless-de/vagrant-vbguest

    vagrant plugin install vagrant-vbguest

  2. vagrant-proxyconf gem This is optional. When used, if you have proxy settings set in your environment, they will be transferred to the guest. See http://tmatilai.github.io/vagrant-proxyconf/

    vagrant plugin install vagrant-proxyconf

Setup

~/.rizzo.json

Change the paths to your git repos

{
  "defaults": {
    "bootstrap_repo_path": "/Users/gh/git/bootstrap"
  },
  "control_repos": [
    "/Users/gh/git/puppetdata",
    "/Users/gh/git/puppet-modules"
  ],
  "puppetmaster": {
    "name": "infra-puppetca",
    "modulepath": [
      "./modules",
      "./puppetdata/modules",
      "./ghoneycutt/modules"
    ],
    "synced_folders": {
      "/repos/puppetdata": {
        "local": "/Users/gh/git/puppetdata",
        "owner": "root",
        "group": "root"
      },
      "/repos/ghoneycutt": {
        "local": "/Users/gh/git/puppet-modules",
        "owner": "root",
        "group": "root"
      }
    }
  }
}

Once you have ~/.rizzo.json, change to your top level control repository and generate your Vagrantfile.

bundle exec rizzo generate
Wrote vagrant config to Vagrantfile

Once the Vagrantfile has been generated, interact with the roles using vagrant status.

vagrant status
Current machine states:

infra-puppetfourca        not created (virtualbox)
infra-puppetfour          not created (virtualbox)
infra-test                not created (virtualbox)

This environment represents multiple VMs. The VMs are all listed
above with their current state. For more information about a specific
VM, run `vagrant status NAME`.

Configuration Specification

defaults

The defaults hash is merged with each node entries hash. Put user specific entries in ~/.rizzo.json and project specific entries in ${PATH_TO_CONTROL_REPO}/.rizzo.json.

control_repos

The control_repos array is a list of control repos. Rizzo takes the approach that control repos are layered. The ordering should match your puppetmaster['modulepath'] array. The first control repo with a .rizzo.json in it will have that Rizzo config used.

puppetmaster

This hash is for your puppet master and is specific to that purpose.

name

If the name of the node matches puppetmaster['name'] then that node will be treated as a puppetmaster. This will add the synced folders which map to your control repos. This allows you to edit code locally using your favorite editor and have it immediately available within the puppetmaster.

modulepath

An array to describe the modulepath that is used in the puppetmaster's environment.conf. This file is available in the bootstrap_guest_path for use with your bootstrap script.

synced_folders

Hash of hashes for directories that are made available to the guest. The key for the hash is the directory under the guest and its keys are local, which is the path on the host and owner and group which are the owner and group permissions the directory will be mounted with on the guest.

controlrepo/.rizzo.json

{
  "defaults": {
    "bootstrap_script_path": "bootstrap_puppet4.sh",
    "bootstrap_script_args": "-l -f `hostname -f`",
    "bootstrap_guest_path": "/tmp/bootstrap",
    "box": "centos7.box",
    "box_url": "https://vagrantboxes/centos7.box",
    "box_download_checksum": "3764a2c4ae3829aa4b50971e216c3a03736aafb2",
    "box_download_checksum_type": "sha1",
    "memory": "1024",
    "netmask": "255.255.255.0",
    "update_packages": true,
    "update_packages_command": "yum -y update",
    "shutdown": true,
    "shutdown_command": "/sbin/shutdown -h now"
  },
  "nodes": [
    {
      "name": "infra-puppetca",
      "hostname": "infra-puppetca1.example.org",
      "forwarded_ports": [
        {
          "guest": "8140",
          "host": "8140"
        }
      ],
      "ip": "172.16.100.5",
      "memory": "2048"
    },
    {
      "name": "infra-puppet",
      "hostname": "infra-puppet1.example.org",
      "ip": "172.16.100.6",
      "memory": "2048"
    },
    {
      "name": "www-api",
      "hostname": "www-api1.example.org",
      "ip": "172.16.100.7"
    }
  ]
}

defaults

This hash is merged with each node entry.

nodes

A list of node entries.

name

Name of the node entry. This is what it will be referred to by Vagrant.

hostname

The FQDN (fully qualified domain name).

forwarded_ports

An optional array of hashes with the key guest and value is the port on the guest and the key host and the value is the port on the host. Rizzo will check and fail if you use duplicate host ports, as they must be unique.

ip

IP address.

netmask

Netmask.

memory

Amount of memory. This should be specified in MB without any unit signifier.

bootstrap_repo_path

The path on the host to your bootstrap repo.

bootstrap_guest_path

The path on the guest where the bootstrap_repo_path will be mounted.

bootstrap_script_path

Path of script to be used to bootstrap a system. This is relative to bootstrap_guest_path.

bootstrap_script_args

Any arguments to pass to bootstrap_script_path.

box

Name of the Vagrant box.

box_url

URL to the Vagrant box.

box_download_checksum

Checksum of the Vagrant box.

box_download_checksum_type

Type of checksum used in box_download_checksum.

update_packages

Boolean to determine if packages should be updated.

update_packages_command

Command to update the packages.

shutdown

Boolean to determine if the system should be shutdown after being provisioned. This is useful because Rizzo uses vagrant-vbguest which will check the version of the VirtualBox Guest Additions you have with that of the guest VM. If they differ, it will recompile on the guest. If the system is not shutdown and just rebooted, then on the next boot the guest additions will not work. Instead the system must be brought up with vagrant up node_name which will activate the vbguest plugin and ensure the guest additions are working.

shutdown_command

The command used to shutdown the system.

rizzo's People

Contributors

ghoneycutt avatar jeffmccune avatar

Watchers

 avatar  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.