Manage a few Linux servers at once

I have a small cluster that consists of a few Linux nodes. There's a shared NFS, and I have the same user account with shared SSH keys on all nodes, but other than that each node has it's-own file system and configuration.

I want to be able to control the configuration of all nodes from a central node. A typical configuration consists mostly of config files, both in the user dir and in /etc or /opt. Occasionally I also need to install the same packages on all nodes or run other shell commands.

This is a small cluster that hardly justifies enterprise-level automation systems or other complex installations. Is there a different way that you have tried and tested, preferably lightweight and open-source? Or even based on BASH/SSH hacks directly? Thanks.


Solution 1:

I highly recommend Saltstack. It's flexible, scalable, lightweight and free.

http://www.saltstack.com

Solution 2:

Ansible should do the trick if you're controlling them from Linux or Mac OS X with homebrew. Windows isn’t supported for the control machine. The Linux nodes need to have SSH and Python, but since most Linux distributions install Python by default, you're probably already covered. All you'll need to do is to install ansible on the master, which should be easy.

Watch the 23 minutes quick start video to get a better idea. I also recommend having a look at the Introduction To Ad-Hoc Commands section from the documentation:

  • Run the command on all servers in a group, in this case, atlanta, in 10 parallel forks:

    $ ansible atlanta -a "/sbin/reboot" -f 10
    
  • Ensure a package is installed, but don't update it:

    $ ansible webservers -m yum -a "name=acme state=installed"
    
  • To transfer a file directly to many different servers:

    $ ansible atlanta -m copy -a "src=/etc/hosts dest=/tmp/hosts"
    
  • Ensure a service is started on all webservers:

    $ ansible webservers -m service -a "name=httpd state=started"
    

There are also some examples of playbooks.

Solution 3:

For running commands you can use a tool that can run a command on multiple SSH servers

There are some of them:

  1. pssh
  2. Cluster SSH

Both available in Debian and Ubuntu.