Giter VIP home page Giter VIP logo

puppet-sandbox's Introduction

Description

Puppet Sandbox is a multi-VM Vagrant-based Puppet development environment used for creating and testing new modules outside of your production environment. It is prefered over the upstream Learning Puppet VM as it gives you more flexibility and allows you to use your own local editing environment and tools.

Puppet Sandbox will set up three separate virtual machines:

  • puppet.example.com - the Puppet master server
  • client1.example.com - the first Puppet client machine
  • client2.example.com - the second Puppet client machine

These VMs can be used in conjunction to segregate and test your modules based on node roles, Puppet environments, etc. You can even test modules on different Linux distributions or release versions to better match your production infrastructure.

Check out the Puppet Sandbox Demonstration screencast for a brief overview of the project.

Requirements

To use Puppet Sandbox, you must have the following items installed and working:

Puppet Sandbox has been designed for and tested with Vagrant base boxes running:

  • CentOS 6.3
  • CentOS 5.8
  • Ubuntu 12.04 - Precise Pangolin
  • Ubuntu 10.04 - Lucid Lynx

...although it may work just fine with other distributions/versions.

Usage

Make sure you have a compatible Vagrant base box (if you don't have one already, it will download a 64-bit Ubuntu 12.04 box for you), and then you should be good to clone this repo and go:

$ vagrant box list
precise64
$ git clone git://github.com/elasticdog/puppet-sandbox.git
$ cd puppet-sandbox/

If you want a CentOS base box to work from, I highly recommend the boxes published by Jan Vansteenkiste: http://packages.vstone.eu/vagrant-boxes/

Initial Startup

To bring up the Puppet Sandbox environment, issue the following command:

$ vagrant up

The following tasks will be handled automatically:

  1. The Puppet server daemon will be installed and enabled on the master machine.
  2. The Puppet client agent will be installed and enabled on all three machines.
  3. A host-only network will be set up with all machines knowing how to communicate with each other.
  4. All client certificate requests will be automatically signed by the master server.
  5. The master server will utilize the nodes.pp file and modules/ directory that exist outside of the VMs (in your puppet-sandbox Git working directory) by utilizing VirtualBox's shared folder feature.

All of this is handled using Vagrant's provisioning capabilities and is controlled by the manifests under the provision/ directory. In theory, you should never have to touch any of that code directly unless you're working to improve Puppet Sandbox.

If you wish to change the domain name of the VMs (it defaults to example.com), edit the "domain" variable at the top of Vagrantfile and reload the machines:

$ vim Vagrantfile
$ vagrant reload

Developing New Modules

To start developing a new Puppet module, just create the standard module structure under modules/ in your puppet-sandbox Git working directory (an example "helloworld" module should exist there already). This directory is automatically in the Puppet master server's modulepath, and any changes will be picked up immediately.

$ mkdir -p modules/users/manifests
$ vim modules/users/manifests/init.pp

To have your module actually applied to one or more of the nodes, edit the nodes.pp file and include your classes...that's it!

Check Your Handiwork

To log on to the virtual machines and see the result of your applied Puppet modules, just use standard Vagrant Multi-VM Environment commands, and provide the proper VM name (master, client1, or client2):

$ vagrant ssh client1

If you don't want to wait for the standard 30-minutes between Puppet runs by the agent daemon, you can easily force a manual run:

[vagrant@client1 ~]$ sudo puppet agent --test

License

Puppet Sandbox is provided under the terms of The MIT License.

Copyright © 2012, Aaron Bull Schaefer.

puppet-sandbox's People

Contributors

elasticdog avatar gorozco1 avatar jasonwmiller avatar jkapellen avatar longlivechief avatar martialblog avatar mc0e avatar pathcl avatar phinze avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

puppet-sandbox's Issues

Setup doesn't work if behind proxy

Hi,

The setup does not work if you run it behind a proxy. It will not be able to download the apt keys and packages. Any chance we can supply a http_proxy variable?


err: /Stage[pre]/Mirrors::Apt/Exec[apt_key_puppetlabs]/returns: change from notrun to 0 failed: apt-key adv --keyserver 'pgp.mit.edu' --recv-keys '4BD6EC30' returned 2 instead of one of [0] at /tmp/vagrant-puppet/modules-0/mirrors/manifests/apt.pp:27


The following SSH command responded with a non-zero exit status.
Vagrant assumes that this means the command failed!

cd /tmp/vagrant-puppet/manifests && puppet apply --modulepath '/etc/puppet/modules:/tmp/vagrant-puppet/modules-0' default.pp --detailed-exitcodes || [ $? -eq 2 ]

Cheers,

NS_ERROR_FAILURE "Failed to create the host-only adapter"

Modified the Vagrantfile to use the ubuntu/trusty64 box.

Ran vagrant up and received:

$ vagrant up
Bringing machine 'puppet' up with 'virtualbox' provider...
Bringing machine 'client1' up with 'virtualbox' provider...
Bringing machine 'client2' up with 'virtualbox' provider...
==> puppet: Importing base box 'ubuntu/trusty64'...
==> puppet: Matching MAC address for NAT networking...
==> puppet: Checking if box 'ubuntu/trusty64' is up to date...
==> puppet: Setting the name of the VM: puppet-sandbox_puppet_1409175947884_69336
==> puppet: Clearing any previously set forwarded ports...
==> puppet: Clearing any previously set network interfaces...
There was an error while executing `VBoxManage`, a CLI used by Vagrant
for controlling VirtualBox. The command and stderr is shown below.

Command: ["hostonlyif", "create"]

Stderr: 0%...
Progress state: NS_ERROR_FAILURE
VBoxManage: error: Failed to create the host-only adapter
VBoxManage: error: VBoxNetAdpCtl: Error while adding new interface: failed to open /dev/vboxnetctl: No such file or directory
VBoxManage: error: Details: code NS_ERROR_FAILURE (0x80004005), component HostNetworkInterface, interface IHostNetworkInterface
VBoxManage: error: Context: "int handleCreate(HandlerArg*, int, int*)" at line 66 of file VBoxManageHostonly.cpp

I'm investigating now, but I'm new to puppet - does this seem like a problem with my setup?

Include Puppet 4

I'm working on including Puppet 4. This is a working Build:
martialblog@611b790

However, there are some issues.

  • The nodes.pp and site.pp are not in place yet.
  • Puppet 4 seems to like a lot of memory. I couldn't get it down...
  • Would be cool to select either Puppet 3 or 4.

Firewall woes...

Not sure if this is within your control, but there's a firewall problem in the CentOS 6 box. We don't use ubuntu/debian so I set the puppet server to be CentOS. It starts up with a firewall config that doesn't allow inbound on 8140.

I'll mess around with it, and see if I can configure a fix. Would including a firewall template and make puppet apply it during the provision step work best?

Atlas is now deprecated so 'vagrant up' fails

pathcl@polonio:~/src$ git clone https://github.com/elasticdog/puppet-sandbox
Cloning into 'puppet-sandbox'...
remote: Counting objects: 248, done.
remote: Total 248 (delta 0), reused 0 (delta 0), pack-reused 248
Receiving objects: 100% (248/248), 46.91 KiB | 0 bytes/s, done.
Resolving deltas: 100% (70/70), done.
Checking connectivity... done.
pathcl@polonio:~/src$ cd puppet-sandbox/
pathcl@polonio:~/src/puppet-sandbox$ ls -ltr
total 28
-rw-rw-r-- 1 pathcl pathcl 1275 jul  8 05:00 Vagrantfile
-rw-rw-r-- 1 pathcl pathcl  139 jul  8 05:00 TODO
-rw-rw-r-- 1 pathcl pathcl 4471 jul  8 05:00 README.md
drwxrwxr-x 4 pathcl pathcl 4096 jul  8 05:00 provision
drwxrwxr-x 3 pathcl pathcl 4096 jul  8 05:00 modules
-rw-rw-r-- 1 pathcl pathcl 1064 jul  8 05:00 LICENSE
pathcl@polonio:~/src/puppet-sandbox$ vagrant up
Bringing machine 'puppet' up with 'virtualbox' provider...
Bringing machine 'client1' up with 'virtualbox' provider...
Bringing machine 'client2' up with 'virtualbox' provider...
==> puppet: Box 'ubuntu/trusty64' could not be found. Attempting to find and install...
    puppet: Box Provider: virtualbox
    puppet: Box Version: >= 0
==> puppet: Box file was not detected as metadata. Adding it directly...
==> puppet: Adding box 'ubuntu/trusty64' (v0) for provider: virtualbox
    puppet: Downloading: https://atlas.hashicorp.com/ubuntu/trusty64
An error occurred while downloading the remote file. The error
message, if any, is reproduced below. Please fix this error and try
again.

The requested URL returned error: 404 Not Found

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.