Giter Site home page Giter Site logo

salt-sandbox's Introduction

Description

Salt Sandbox is a multi-VM Vagrant-based Salt development environment used for creating and testing new Salt state modules outside of your production environment. It's also a great way to learn firsthand about Salt and its remote execution capabilities.

Salt Sandbox will set up three separate virtual machines:

  • salt.example.com - the Salt master server
  • minion1.example.com - the first Salt minion machine
  • minion2.example.com - the second Salt minion machine

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

Requirements

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

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

  • CentOS 5.7
  • 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 CentOS 5.7 box for you), and then you should be good to clone this repo and go:

$ vagrant box list
centos57
$ git clone git://github.com/elasticdog/salt-sandbox.git
$ cd salt-sandbox/

Initial Startup

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

$ vagrant up

The following tasks will be handled automatically:

  1. The Salt master daemon will be installed and enabled on the master machine.
  2. The Salt minion daemon 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 minion public keys will be automatically accepted by the master server.
  5. The master server will utilize the top.sls file and base/ directory that exist outside of the VMs (in your salt-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 Salt 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 SLS module, just create the standard module structure under base/ in your salt-sandbox Git working directory (an example "helloworld" module should exist there already). This directory is automatically in the Salt master server's file_roots path, and any changes will be picked up immediately.

$ mkdir -p base/mymodule
$ vim base/mymodule/init.sls

To have your module actually applied to one or more of the minions, edit the top.sls file and specify how it should be used during state execution...that's it!

Check Your Handiwork

To log on to the virtual machines and see the result of your Salt modules, just use standard Vagrant Multi-Machine Environment commands, and provide the proper VM name (master, minion1, or minion2):

$ vagrant ssh master

Then instruct all minions to execute a highstate call and apply any applicable modules:

[vagrant@master ~]$ sudo salt '*' state.highstate

License

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

Copyright © 2012, Aaron Bull Schaefer.

salt-sandbox's People

Contributors

elasticdog avatar leoj3n 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

salt-sandbox's Issues

Hardcoded IP addresses

Hello,
I just tried your project and get stuck on small detail -- I changed IP addresses of nodes in Vagrantfile and after logging into master node, command sudo salt '*' state.highstate doesn't work. After while I found, that I must change accordingly hostnames in /etc/hosts file on all nodes.

Please, put some note about this into README file.

Thank you very much!

Missing Dependency: python26-jinja2

I get the following error when running vagrant up:

==> master: err: /Stage[main]/Salt::Server/Package[salt-master]/ensure: change from absent to latest failed: Could not update: Execution of '/usr/bin/yum -d 0 -e 0 -y install salt-master' returned 1: salt-0.9.7-1.el5.noarch from epel-salt has depsolving problems
==> master:   --> Missing Dependency: python26-jinja2 is needed by package salt-0.9.7-1.el5.noarch (epel-salt)
==> master: Error: Missing Dependency: python26-jinja2 is needed by package salt-0.9.7-1.el5.noarch (epel-salt)

More of the same output at the following URL:
https://gist.github.com/andre-luiz-dos-santos/6cb7c1eb548c8b34fc44

Missing dependency for

Thanks for putting together something like this. I ran into a small issue when running vagrant up... both minions and the master threw the following error:

==> minion2: /usr/local/lib/ruby/gems/1.9.1/gems/puppet-2.7.9/lib/puppet/provider/service/bsd.rb:12: warning: class variable access from toplevel
==> minion2: notice: /Stage[pre]/Mirrors::Yum/File[epel-salt.repo]/ensure: defined content as '{md5}b88d8d90898d073fd35c57623dbbc21c'
==> minion2: notice: /Stage[pre]/Mirrors::Yum/Exec[yum_makecache]: Triggered 'refresh' from 1 events
==> minion2: notice: /Stage[pre]/Vagrant/Group[puppet]/ensure: created
==> minion2: notice: /Stage[pre]/Networking/File[/etc/hosts]/content: content changed '{md5}571c763e747cd16d8b9352fac8be5012' to '{md5}4145ec6fe7d8fea21c5aec18d26366a6'
==> minion2: err: /Stage[main]/Salt/Package[salt-minion]/ensure: change from absent to latest failed: Could not update: Execution of '/usr/bin/yum -d 0 -e 0 -y install salt-minion' returned 1: salt-0.9.7-1.el5.noarch from epel-salt has depsolving problems
==> minion2:   --> Missing Dependency: python26-jinja2 is needed by package salt-0.9.7-1.el5.noarch (epel-salt)
==> minion2: Error: Missing Dependency: python26-jinja2 is needed by package salt-0.9.7-1.el5.noarch (epel-salt)
==> minion2:  You could try using --skip-broken to work around the problem
==> minion2:  You could try running: package-cleanup --problems
==> minion2:                         package-cleanup --dupes
==> minion2:                         rpm -Va --nofiles --nodigest
==> minion2: The program package-cleanup is found in the yum-utils package.
==> minion2:  at /tmp/vagrant-puppet-7/modules-0/salt/manifests/init.pp:22
==> minion2: notice: /Stage[main]/Salt/Service[salt-minion]: Dependency Package[salt-minion] has failures: true
==> minion2: warning: /Stage[main]/Salt/Service[salt-minion]: Skipping because of failed dependencies
==> minion2: notice: Finished catalog run in 45.56 seconds
The SSH command responded with a non-zero exit status. Vagrant
assumes that this means the command failed. The output for this command
should be in the log above. Please read the output to determine what
went wrong.

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.