3

So, I have a dozen of CentOS Linux servers. By and large, their configuration is mostly the same.

Sometimes I need to add extra cron job (separate crontab file in /etc/cron.d/), and/or copy over a new BASH/Perl script to 10+ servers, or run sed expression to do minor changes in a script that essentially is on every single 10+ servers.

I've grown really tired of doing it on a per single host basis real fast. So, how do you guys deal with this challenge? Any tricks up your sleeves? Any software I should know about (free and proven to work reliably)?

I'm looking for a way to do this over SSH, but I'm also curious about other approaches.

4 Answers 4

11

You are opening a huge can of worms here. :) There is a large number of various approaches and solutions to this (very common) problem. It can be something as basic as parallel-ssh. But what you are really looking for (but don't know it yet ;) is a configuration management system. The 2 increasingly popular competing products/projects are: Puppet and Chef. There are also many other products that ultimately allow you to accomplish the same task. I recently found out about Ansible and it looks really promising. If properly implemented, all these solutions will allow you to much better administer many more systems. Wikipedia has an article with a list of such products http://en.wikipedia.org/wiki/Comparison_of_open_source_configuration_management_software

1
  • 1
    I'd add Ansible is an awesome alternative
    – ILIV
    Jan 21, 2013 at 6:48
1

You need configuration management, like puppet or chef. There is a fair old learning curve (getting used to the imperative idempotent style takes a little time), but once you're over the initial hump it's wonderful for managing lots of similarly configured servers, and keeping their config up to date.

You could also look at writing scripts using fabric - a python framework that can execute commands over ssh, as well as copy files to and from servers. And the host variable can have a list of hosts, making that easier. Well worth looking into.

Then there's salt - a remote execution engine that scales very well.

But I'd just take your pick of the configuration management tools and run with it.

0

What I myself would do is create a list of servers that the commands need to run on. Setup ssh certificates between the machine running the commands, and the servers that the commands are being run on. Then add the commands you need to run to the script, and have the script cycle through the list of servers running the command. You might want to think up a logging system however, mistakes could cause a headache.

ie:

list of servers:

10.0.0.1
10.0.0.2
10.0.0.3

script that runs commands

#!/bin/bash
for server in `cat servers.lst`
do
ssh server some-command >> log.txt
done
1
  • ssh certificates in my humble opinion would be the way to go. but you could do the same with an expect script
    – steve
    May 14, 2012 at 19:17
0

CFEngine has been around a long time for exactly this purpose.

The best Configuration Management Solution if you need:

  • The Fastest and most Scalable Solution
  • To know the Actual State of your Systems
  • The Solution with the Best Security Track-record
  • Full Flexibility and Granular Control
  • A Mature and Enterprise ready Solution

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .