News for hackers. Stuff that matters.
Re:Salt: Like Puppet, Except It Doesn’t Suck by SandB0x on Monday June 24, 2013 @11:22AM (#5933483)
I'm not a web developer but I have a side-project that runs on a cobbled together EC2 instance. The server state is in theory documented in a set of of shell scripts and virtualenv requirements files.

I know that I should be doing this in a more robust way but whenever I try and read up on configuration management tools like Puppet and Chef, they're all described in comparative terms - Puppet does X better than Vagrant which does Y better than Chef, etc. I quickly lose patience and get back to digging myself into a deeper technical hole.

Is there a non-recursive explanation of what these tools are able to do and where someone like me should start?

Edit: Thanks for the helpful responses!

Re:Salt: Like Puppet, Except It Doesn’t Suck by danudey on Monday June 24, 2013 @12:04PM (#5933772)
These tools allow you to specify a state and then specify which servers should have that state. A 'state', loosely speaking, is a collection of definitions of 'X should be Y'.

For example:

Package 'libapache2-mod-php' should be installed. File '/etc/apache2/sites-available/customersite' should be the contents of this file we have on the master server. File '/etc/apache2/sites-enabled/customersite' should be a symlink to above. Directory '/var/www/customersite' should be the contents of this git repository. Command 'apache2ctl graceful' should be run if any of the above change.

With these five rules, you can turn a default install of Ubuntu into a webserver providing client files in a matter of seconds.

Once you have those rules written, you then apply them. You can wildcard, so that hosts matching 'www*.yourhostingco.com' get these rules.

Now, when you want to add a new webserver to your cluster, you install a new Ubuntu instance, you register it with the Salt master server, and then trigger a state update, and you're done. No SCP'ing files, no manual git checkouts, no copy-paste-edit configuration management.

Then, once you've got all that, you can get into templating. You can do templating both on the contents of files (e.g. for memcached config, insert the machine's internal IP address instead of having one config per server) as well as the rules themselves to avoid having a ton of boilerplate (for module in 'list','of','python','modules', install the module via pip with these rules).

One of my favourite benefits of something like Salt is that if you use Salt to do all of your configuration, then just back up your salt config to github or wherever, then you always have a record of how you did things. You don't get the incomplete documentation or missing steps that happen with most approaches.

As a sysadmin managing a cluster of systems, it can be life-changing.

Re:Salt: Like Puppet, Except It Doesn’t Suck by nwmcsween on Monday June 24, 2013 @12:56PM (#5934150)
But the problem that all of the configuration managers have and also why they all suck is that the state you specify has no guarantee of being the end state. A much better alternative would be to manage state in chunks and test those chunks, e.g an http-server transaction would require responding on port 80 if not fail or roll it back. Rolling back could be using namespaces, jails, etc.
Re:Salt: Like Puppet, Except It Doesn’t Suck by johtso on Monday June 24, 2013 @02:53PM (#5934888)
You might be interested in Salt's requisite statements: http://docs.saltstack.com/ref/states/ordering.html#requisite...

In combination with service.running you can require that, for example, package x is installed, and its service is running, before service y is started.

Re:Salt: Like Puppet, Except It Doesn’t Suck by Goladus on Monday June 24, 2013 @09:14PM (#5936874)
I would not say that is a reason why all configuration managers suck. The feature you'd like to see would represent a significant increase in overhead, complexity, and potential drawbacks that not everyone needs yet.

Meanwhile, a disciplined system of designing and documenting tests and rollback procedures before committing changes will accomplish this without the need for additional software.

My guess is that if you are not disciplined enough to design tests and rollback procedures on your own, then you are probably going to just switch off or work around those features if they are built into the software.

Re:Salt: Like Puppet, Except It Doesn’t Suck by showerst on Monday June 24, 2013 @03:00PM (#5934928)
Ansible allows you to do this, it has failure modes that let you take actions, including rolling back.
Re:Salt: Like Puppet, Except It Doesn’t Suck by mitchellh on Monday June 24, 2013 @12:15PM (#5933871)
The other responses are awesome, but I just want to nitpick one thing (as the creator of Vagrant): Vagrant isn't a configuration management tool, so it can't really be compared with Chef/Puppet.

Vagrant actually works with Chef, Puppet, CFEngine, Ansible, Salt, and more.

Re:Salt: Like Puppet, Except It Doesn’t Suck by tieTYT on Monday June 24, 2013 @02:09PM (#5934622)
You told us what it "isn't" but you didn't tell us what it "is". Yes, I could just google, but I don't care enough. I think you missed out on a little bit of marketing here.
Re:Salt: Like Puppet, Except It Doesn’t Suck by nbouscal on Monday June 24, 2013 @02:15PM (#5934664)
I don't think Mitchell really needs to worry much at this point about marketing Vagrant. Everyone in the DevOps space is already plenty well familiar with it (mostly because it's incredibly awesome). Also, TFA explains what it is: “Vagrant is an established project that wraps around a number of existing virtualization providers to allow for extremely quick provisioning of disposable, consistent environments.”
Re:Salt: Like Puppet, Except It Doesn’t Suck by SandB0x on Monday June 24, 2013 @04:37PM (#5935505)
TFA, or any least the quote you have selected, does not explain what it is. It states (in quite ambiguous terms) what the combination of Vagrant and "existing virtualization providers" can achieve but not what Vagrant's role is.

From http://www.vagrantup.com: "Create a single file for your project to describe the type of machine you want, the software that needs to be installed, and the way you want to access the machine. Store this file with your project code"

That, and http://docs.vagrantup.com/v2/why-vagrant/, sounds quite similar to a configuration management tool to me (I believe you that it's not, I'm just saying I wouldn't have understood that). Seems geared to launching instances/VMs too perhaps. Maybe it's my lack of domain knowledge and maybe I have unfair expectations but I think that the sales pitch should be accessible to a developer who's not solely in the "DevOps space".

Accessibility is good because I'm sure it is incredibly awesome and may well be useful to a broader set of people who aren't yet in the loop.

Re:Salt: Like Puppet, Except It Doesn’t Suck by frio on Monday June 24, 2013 @07:01PM (#5936301)
With vagrant, I can create a vagrantfile. This says: "create a VM using this basic distribution, this networking configuration, these forwarded ports, and this hardware exposed". It defines the basic machine.

I can then use "vagrant up". This creates a new VM using Virtualbox, VMware, or whatever I have installed (I think there's even EC2 providers now!). It configures that VMs hardware as above.

Then, vagrant can use one of many tools in the configuration space -- Chef, Puppet, Salt -- to configure the software in the VM.

I guess the distinction lies there: vagrant configures hardware. Salt et all configure the software.

Re:Salt: Like Puppet, Except It Doesn’t Suck by reledi on Friday June 28, 2013 @09:19AM (#5957780)
The quote that SandB0x posted (it comes from vagrantup.com) says that it can be used for defining "the software that needs to be installed". So is the distinction Vagrant : h/w + s/w, Salt et al : s/w?
Re:Salt: Like Puppet, Except It Doesn’t Suck by nbouscal on Friday June 28, 2013 @10:39AM (#5958211)
It's more that you use configuration management for the software, and then Vagrant does the hardware and hands control over to your configuration management for the software. Vagrant can also do the software itself, yes, but the way of doing so is running shell scripts, so it's far preferable to use a configuration management tool (the main benefit being idempotence).
Re:Salt: Like Puppet, Except It Doesn’t Suck by nbouscal on Monday June 24, 2013 @05:30PM (#5935810)
The quote seemed pretty clear to me, but I suppose that could be because I already know what it does. Vagrant wraps VM software (VirtualBox, VMWare, etc — the "existing virtualization providers" in the quote) to create disposable development environments. It also allows you to connect with configuration management tools like Chef or Puppet, which then configure that disposable environment to mirror your production environment. It doesn't really do configuration on its own (unless you count running shell commands), so it isn't a configuration management tool itself. It does one thing well.

I agree that we should be evangelizing DevOps and bringing more people into the loop. I was simply saying that Vagrant itself doesn't really need any marketing. It's hard to read much of anything about the field without seeing it mentioned.

Re:Salt: Like Puppet, Except It Doesn’t Suck by reledi on Friday June 28, 2013 @09:34AM (#5957853)
Thank you, your explanation finally made me clearly understand what these tools are for. I constantly hear about them, have read their landing pages, and even listened to a talk on Vagrant + Puppet, but still didn't understand what it is exactly that these tools do (and do differently).

Vagrant doesn't need more marketing, but it -- and the other tools -- do need to explain clearly what it does (and does not) do in a way that non-DevOps folks can understand. Perhaps the easiest way to do that is with a simple use case.

Re:Salt: Like Puppet, Except It Doesn’t Suck by nbouscal on Friday June 28, 2013 @10:37AM (#5958196)
I couldn't agree more that most of the tools in this area could benefit from some better explanations and best practices. The development is happening at such a rapid pace that it becomes very difficult for a newcomer to figure out what's going on. I talked to someone at Opscode about it yesterday and he agreed, and said that it's something they are working on, so hopefully this will get better soon.
Re:Salt: Like Puppet, Except It Doesn’t Suck by AlexanderDhoore on Monday June 24, 2013 @11:45AM (#5933641)
I just now (past few days) started learning about this stuff. I've been doing the "Learning Puppet" tutorials [1].

The most important thing about it is that you describe the state of the server. And puppet applies it for you. It's idempotent (you might know this term from REST). You can run puppet multiple times and the end result would be the same.

Normally (without config management) you would write scripts that do the configuration. If you ran them twice, things could go wrong, or they would overwrite the stuff from last time. Scripts are descriptions of what steps to take. Puppet manifests are descriptions of what state you want the server to be in.

[1] http://docs.puppetlabs.com/learning/index.html

Re:Salt: Like Puppet, Except It Doesn’t Suck by fmstephe on Monday June 24, 2013 @12:35PM (#5933997)
Ok, the declarative and idempotency sounds great. But consider this one use case. I want to stop a service, upgrade it to a new version, restart that service. The service is an application which I wrote that runs in apache tomcat.

    1: Stop Service
    2: Upgrade
    3: Start Service
Right now I have just made three non-declarative statements about my tomcat server. I am describing a process that runs through a series of steps to reach a new conclusion.

So puppet has these beautiful (sounding) properties. But declaratively describing the state of my servers isn't a real problem I have.

I need to deal with the way that my servers change. I need to upgrade services, including starting and stopping. Puppet absolutely fails at this. Any attempt to describe a process is antagonistic to puppet at a fundamental level.

Whenever people seek a solution to these problems they always get fed that line. That puppet is declarative and idempotent, which is fine. But we should be _very_ clear that puppet does a spectacularly bad job of solving a very ordinary problem that I have, and which I would expect almost everyone else working with large numbers of servers to have too.

Re:Salt: Like Puppet, Except It Doesn’t Suck by MarcParadise on Monday June 24, 2013 @12:57PM (#5934155)
Your actual objective seems to be: 1. The current version of MyApplication must be deployed and running.

If you're interested in trying out Chef - which seems like a good fit from your comment - read on.

For tomcat you could take a look at this community-provided cookbook, which contains resources that make it simple:

https://github.com/opscode-cookbooks/application_java

If you explicitly need to stop/start tomcat beforehand (I believe this resource does a restart after deploying your app) you can do that with the "service" resource built into Chef - though doing so may mean that you're restarting every time you converge the node, which is probably not what you're looking for.

Re:Salt: Like Puppet, Except It Doesn’t Suck by Shish2k on Monday June 24, 2013 @02:03PM (#5934590)
> I want to stop a service

You WANT to stop the service? Really? Stopping the service is an actual headline-level goal, and not a behind-the-scenes detail?

Personally I tell puppet "make sure that the latest version of X is running", because that's what I actually want, and I don't care how it does it...

Re:Salt: Like Puppet, Except It Doesn’t Suck by stfp on Tuesday June 25, 2013 @01:36AM (#5937732)
Maybe you want to tell the load balancer before stopping a service, and actually wait for it to drain before going ahead. Or you want to disable alerts for services while they're being restarted.

Maybe puppet has hooks to integrate with the rest of your setup, I don't know - either way, caring about how things are restarted isn't that crazy imo.

Re:Salt: Like Puppet, Except It Doesn’t Suck by rahoulb on Tuesday June 25, 2013 @07:01AM (#5938597)
Your ultimate goal is to ensure that the service is at the latest version.

There are numerous dependencies to that task - one of which may be stopping the service before upgrading. There are dependencies to stopping the service - maybe telling the load-balancers or your monitoring system. When the service has been upgraded, you can trigger notifications that other items within your config can depend upon (for example, when an upgrade is complete, restart the service, when the service restarts, add it back to the monitoring system etc).

All of these can be modelled in these config-management tools, as explicit dependencies within your manifest file - as opposed to implicit and ad-hoc dependencies within your script.

Re:Salt: Like Puppet, Except It Doesn’t Suck by nigelk on Monday June 24, 2013 @11:42PM (#5937380)
This is a very ordinary problem, and it's usually solved like this with Puppet:

Specify the service declaratively, and subscribe it to the package that provides the payload.

  service { 'myservice':
     ensure    => running,
     enable    => true,
     subscribe => Package['myservice'],
  }

  
Then when you upgrade the package on that node, either by using ensure => latest, or by manually specifying the new version, Puppet will automatically restart the service.
Re:Salt: Like Puppet, Except It Doesn’t Suck by avtar on Monday June 24, 2013 @04:02PM (#5935296)
But consider this one use case. I want to stop a service, upgrade it to a new version, restart that service. The service is an application which I wrote that runs in apache tomcat.

Perhaps I'm missing some obvious detail but I would think you would just update your repository with the new version of your application and/or Tomcat package and that would cause the service to restart on the next Puppet run, after the new version has been installed.

Re:Salt: Like Puppet, Except It Doesn’t Suck by Goladus on Monday June 24, 2013 @09:55PM (#5937008)
The last web company I worked for had an app that required a little extra care and feeding to deploy, and we just didn't use configuration management for that. There were plenty of other uses for config management (changes to rewrites in httpd.conf, for example). We used bash scripts for handling deployments, which primarily relied on distributed ssh and rsync to perform upgrades. (I believe this is the fabric use case, though it didn't exist at the time and I've never used it)

The app was already documented, source-controlled, version-controlled, and tested by developers and QA. There wasn't much benefit to adding anything to the configuration management repository unless there were platform/infrastructure changes.

Re:Salt: Like Puppet, Except It Doesn’t Suck by saintx on Monday June 24, 2013 @03:34PM (#5935142)
Reading through many of the responses, they're almost all phrased in terms of "X does Y better than Z" comparisons, directly ignoring your amusing and insightful comment.

At this point, the only thing that could save ordinary users from the melee of competing Open Source configuration management frameworks is an illustration by Randall Munroe.

(My hacker senses are tingling. If you listen very carefully, you can just barely hear a new eponymous law being born.)

Re:Salt: Like Puppet, Except It Doesn’t Suck by crdoconnor on Monday June 24, 2013 @11:44AM (#5933631)
They basically let you write, using a declarative language, what state the server should be in. The software figures out how to set that up for you.

When you want to change the state, you edit the file - say, to add a package.

At any point you can set up an entirely new server from scratch using that same code.

You can't do that easily with bash scripts.

(you could if they worked like virtualenv requirements files but that only works for python's virtualenv...)

Re:Salt: Like Puppet, Except It Doesn’t Suck by coolsunglasses on Monday June 24, 2013 @01:35PM (#5934415)
Fabric can make for a nice midway point between a pile of scripts and using Chef/Puppet.
[deleted]
Re:Salt: Like Puppet, Except It Doesn’t Suck by danudey on Monday June 24, 2013 @12:08PM (#5933812)
This is a pretty reductionist explanation, and it misses a lot of the benefits of state management. You make it sound like you just write a bunch of lines of shell script and you can sub in some variables, which is not at all their major strength.

The benefit of Salt, which it has over Ansible, is that it doesn't have to use SSH (which, as mentioned in the article, doesn't scale well to large deploys), and it can do a great deal more things than just 'run shell scripts from a file'.

If someone were to read only your comment they wouldn't see the benefit of these systems at all, which is unfortunate.

Re:Salt: Like Puppet, Except It Doesn’t Suck by tr4656 on Monday June 24, 2013 @12:14PM (#5933864)
Ansible with Fireball wouldn't use SSH but rather 0mq.
Re:Salt: Like Puppet, Except It Doesn’t Suck by StavrosK on Monday June 24, 2013 @09:11PM (#5936856)
Here's a small, concrete example I wrote to showcase ansible: http://www.stavros.io/posts/example-provisioning-and-deploym...
Re:Salt: Like Puppet, Except It Doesn’t Suck by nodesocket on Monday June 24, 2013 @01:32PM (#5934396)
Founder of https://commando.io here. We are a web based interface for doing remote executions via SSH. Our approach is a beautiful web interface with no external dependencies (agents). Salt and Ansible are amazing, but they still have a bit of a learning curve and setup "costs". Our target market also tends to be less technically proficient, and thus not willing to dive into more robust solutions. Think cPanel for operations. SandBOx, if you'd like to try out Commando.io, let me know, and I'll get you a private beta invite.
Re:Salt: Like Puppet, Except It Doesn’t Suck by dsl on Monday June 24, 2013 @02:34PM (#5934781)
A giant database of SSH keys from people who can't setup basic operational tools?

Jesus, and I thought the CDCs "big vault full of things that will kill you" was a terrible idea...

Re:Salt: Like Puppet, Except It Doesn’t Suck by halayli on Monday June 24, 2013 @01:40PM (#5934447)
My Ansible learning curve was 5 minutes.
Re:Salt: Like Puppet, Except It Doesn’t Suck by StavrosK on Monday June 24, 2013 @09:17PM (#5936885)
I'm betting it would have been 2 if there were better examples. The concept is trivial to get and the reference is great, but a few more fleshed-out examples would be nice.

After having used it for a while, I adore it. One minute and one command to go from a new project to a full deployment, what more can you ask.

Re:Salt: Like Puppet, Except It Doesn’t Suck by grandalf on Tuesday June 25, 2013 @07:51AM (#5938757)
The tools are overly complicated and offer little value for installations with fewer than hundreds of servers.

Checkout fabric.py and cuisine.py, both are small, simple, elegant approaches.

Combined with a native package manager (like apt), fabric+cuisine is nearly as powerful as puppet or chef.

Re:Salt: Like Puppet, Except It Doesn’t Suck by the1 on Monday June 24, 2013 @01:15PM (#5934271)
if you're using EC2, why not just create an AMI and forget about configuration tools?
Re:Salt: Like Puppet, Except It Doesn’t Suck by billeh on Monday June 24, 2013 @02:12PM (#5934644)
You can, certainly create an AMI preconfigured with all of your libraries, packages and services ready to go, but the issues arise over time with package updates, system updates, one-off configuration changes .. the list goes on.

The actual configuration of your system will drift further and further away from that templated AMI, leaving you to constantly have to build a new template every time you deploy a new machine, or manually make all of those differential changes to your new system.

Config management can be tailored to rapidly update the configurations of certain classes of systems at a greater interval than the constant cycle of blowing away machines, updating templates, redeploying, etc , etc.

Re:Salt: Like Puppet, Except It Doesn’t Suck by ef4 on Monday June 24, 2013 @04:33PM (#5935482)
That doesn't really solve the problem, it just moves it.

If AMIs are your deployment method of choice, you still need to build a repeatable process for applying updates and changes to your previous base AMI, testing that it still works under all your realistic configurations, and then gracefully deploying it to your production infrastructure.

Which is all doable, but not trivial. And the processes you build will be very Amazon-centric.

Re:Salt: Like Puppet, Except It Doesn’t Suck by bfrog on Monday June 24, 2013 @01:20PM (#5934306)
Having done this a dozen or more times... can you package your ami for your developers to use? Can you remake your image exactly the same way again as it was when you first imaged it should it be lost in the cloud (100% reliability isn't something AWS provides).

Provisioning tools let you create it, and incrementally update your image in a way that lets you redo it from scratch at any time.

That alone is the reason why I like the idea, not necessarily the resulting applications that have been created so far for the task.

Shell scripts could do the same and have for years if your only interested in from scratch setups.

Re:Salt: Like Puppet, Except It Doesn’t Suck by gyepi on Monday June 24, 2013 @03:47PM (#5935214)
This is not a difficult problem. I recently had to stand up a cluster of EC2 instances for a job that required a cluster of them and used these three steps:

1. Write a script to configure an instance and run it when the instance starts.

2. Clone the instance to an image

3. Run instances based on the image.

It's quite straightforward to do. See http://github.com/gyepisam/fcc-textify for more details.

Re:Salt: Like Puppet, Except It Doesn’t Suck by pestaa on Monday June 24, 2013 @01:48PM (#5934497)
> can you package your ami for your developers to use

SuSE Studio lets you do exactly that. (Though exporting to AMIs is just a feature, not the main objective.)

Re:Salt: Like Puppet, Except It Doesn’t Suck by penguindev on Monday June 24, 2013 @05:46PM (#5935917)
Because a lot of people don't use their brain, and realize that linux package management / image creation has been a solved problem since forever (I've been doing this since redhat kickstart circa 2001, and I'm a young guy).

However, there are some common sense tiers:

3rd party dependencies that changes infrequently = put in ami Common ops daemons and boot scripts = put in ami your application code and your configs = deploy via python/ssh client side

Also, one simply has to use ec2 instance tags to name things.

Result, you can have bit-for-bit identical instances fired up in no time with high confidence without need for a full OS package mirror. Without, of course, a ridiculously over-engineered configuration server framework, DSL, SPOF, security holes...

Re:Salt: Like Puppet, Except It Doesn’t Suck by Goladus on Monday June 24, 2013 @11:20PM (#5937320)
Why not just use linux packages + scripts?

I asked myself this same question several years ago. The basic advantages chef and puppet (and salt, etc.) offer over client-side python alone are:

A thin abstraction layer for basic system/platform information (facter/ohai). System information that you'd obtain using various tools like dmidecode, uname, df, /proc, ip, are all gathered and made available in a single data structure. Overkill? Maybe, but makes for much cleaner scripts.

A library for performing common tasks: package installation/upgrade, directories, files and templates, services, and shell execution. A full list: http://docs.opscode.com/chef/resources.html#resources.

Finally, a framework for organizing your configuration in a standardized way, with most of it in one place. With chef, for example, the idea is to put all the configuration for a single application in one "cookbook" and then if you have two different servers that both use that application in different ways, you define two different roles that pass different parameters to the basic recipes. Obviously the extent to which this one a benefit depends somewhat on your needs and personal preferences.

But I do agree that both chef and puppet are over-engineered. Puppet's DSL and chef's server are mostly overkill that I don't have much use for. But the DSL can be dealt with and the chef server is optional. There doesn't have to be a single point of failure.

Re:Salt: Like Puppet, Except It Doesn’t Suck by joelhooks on Monday June 24, 2013 @02:26PM (#5934728)
We use Chef for distributed team. They download a very basic VM, run Chef, and are off to the races in minutes. When updates or config changes, they update from VCS and everything is configured and good to go. This is especially awesome for more UI focused devs that aren't as comfortable with Unixy tools.