SALT Vagrant and Virtualbox
Ben Hosmer@bhosmer
Tuesday, October 23, 12
Mention RB government intelligence customersVagrant stores lightweight “boxes” for development and testing.Configuration management can be used to have repeatable environments that you can quickly and easily reset
Local Dev Prod
Tuesday, October 23, 12
Why use configuration management?
Local Dev Prod
Tuesday, October 23, 12
Isn’t this nicer?
Tuesday, October 23, 12
Puppet is a very popular one.It requires ruby etc.
Tuesday, October 23, 12
A sample puppet manifest.You have to kind of know ruby code to make it work or modify it.
Tuesday, October 23, 12
Saltstack is like puppet, but much easier, lighter-weight and uses python and yaml.
Tuesday, October 23, 12
YAML is much easier to read and interpret. You don’t have to know code to modify it.
The Team
Tuesday, October 23, 12
We can combine virtualbox, vagrant, and saltstack for configurations that are transportable and distributable among developers. Consistency!
Remote Execution
Tuesday, October 23, 12
An added benefit that you get out of the box with SALT is remote execution.Type command once and run it on every machine.
What you need.
Tuesday, October 23, 12
Rubyruby-lang.org
Tuesday, October 23, 12
We can’t get away from this, but you don’t need to actually know any ruby code.
Virtualbox.org
Tuesday, October 23, 12
Allows you to run another operating system inside your operating system.Host > Guest paradigm
vagrantup.com
Tuesday, October 23, 12
Vagrant connects our configuration management system and our boxes to an interface that we can script. You can use it without any configuration management. It lets us create a server, destroy it, and then repeat the process easily.
salty-vagrantvagrant gem install vagrant-salt
http://bit.ly/REYBZz
Tuesday, October 23, 12
A ruby gem that connects salt configuration management with vagrant.
A Base Box
vagrantbox.es
Tuesday, October 23, 12
The easiest way to get started is to download a box that has already been created.Get the Ubuntu precise 64 box. There are a lot of others available. CentOS/BSD/Lots of linux flavors.
Tuesday, October 23, 12
Now we’ll start diving deep.
Add your box.
vagrant box add precise64
Tuesday, October 23, 12
Now that you have the box, you need to tell vagrant about it.
Get the Vagrantfile
http://bit.ly/TggfrW
Tuesday, October 23, 12
Vagrant init will create a well-commented file for you, but you don’t need all of the configuration in it. It is much easier to download this from the salty-vagrant github page and copy and paste it.
Add this for web-browser access:
config.vm.network :hostonly, "192.168.33.20"
Tuesday, October 23, 12
Create Your Directories
Tuesday, October 23, 12
minion.conf:
http://bit.ly/RF1x8z
file_client: local
Tuesday, October 23, 12
This is all you need. This tells SALT to get its configuration from a local configuration instead of looking for a remote master.
The Top Filetop.sls
base: '*': - lamp-drupal
Tuesday, October 23, 12
This tells SALT what configuration you want to use.
Lamp-Drupal Salt Statehttp://bit.ly/RF1x8z
Tuesday, October 23, 12
Grab this from the github page.
Vagrant up!
Tuesday, October 23, 12
Vagrant up!
Tuesday, October 23, 12
Tuesday, October 23, 12
Tuesday, October 23, 12
Shared folder:localGuest: /vagrant
Tuesday, October 23, 12
Shared folder:localGuest: /vagrant
Virtualbox Guest Additions must match.
Tuesday, October 23, 12
They probably will not, so you need to update them and then use vagrant box repackage so that your box’s guest additions match the version of virtualbox.
vagrant halt
Tuesday, October 23, 12
Stops the machine, but retains your currently added software and configuration. Basically a shutdown.
salt-call
Tuesday, October 23, 12
Use this for local SALT commands instead of the standard use of “SALT”
vagrant destroy(Reset & do-over)
Tuesday, October 23, 12