1

I need to install a few programs on around 40 Kubuntu 13.04 machines, and would like to know what options I have to do it as efficiently as possible.

EDIT: I have the repositories already set and the machines are all identical clones, with no LDAP auth or centralized server.

Beefy_Swain
  • 111
  • 1
  • 1
  • 3

3 Answers3

3

Any configuration management software will do, that's what they are for, i would suggest to take look at chef. This is the blurb from their webpage:

Chef is an automation platform that transforms infrastructure into code. Stop thinking in terms of physical and virtual servers. With Chef, your real asset is the code that brings those servers and the services they provide to life. An automated infrastructure can accelerate your time to market, help you manage scale and complexity, and safeguard your systems.

Whether your network is in the cloud, on-site, or a hybrid, Chef can automate how you configure, deploy and scale your servers and applications, whether you manage 5 servers, 5,000 servers or 500,000 servers. It's no wonder that Chef has been chosen by companies like Facebook and Amazon for mission-critical challenges.

this video will help a lot: http://www.youtube.com/watch?v=0UXh5EnFZrM

home page: http://www.opscode.com/chef/

terdon
  • 234,489
  • 66
  • 447
  • 667
Armin
  • 43
  • 3
  • All of these solutions seem to talk about runninng the tasks on servers. Does this mean running the task *from* a server, or that it is only designed to be used on servers? – Beefy_Swain Sep 27 '13 at 16:49
  • It actually means running on the server :) – Armin Sep 27 '13 at 17:03
2

For long term goal

If you want automation tool that allows you to centralize management of the various *nix flavors running on your network and manage every aspect of the configuration that you can, then you can look at :

  1. puppet
  2. chef
  3. cfengine3

For short term goal

If you want temporary solution for just to install some package through apt-get or yum, then you can use shell or perl, python script.

If you have already set password-less authentication then you can just use following script :

#!/usr/bin/env bash

Servers_list=/opt/servers_list
PackageName="package-name"

for Host in $(< $Servers_list )
do
    echo "Installing package on $Host"
    ssh "${Host}"  apt-get -y install "${PackageName}"

done

If you don't have password less authentication then you can use expect tool or paramiko module in python.

Rahul Patil
  • 24,281
  • 25
  • 80
  • 96
2

Just to expand Rahul's very good answer, you can set up passwordless access to each of the machines easily enough using this approach:

  1. install sshpass on your local machine:

    sudo apt-get install sshpass
    

    This will allow you to pass the password as a command line argument:

     sshpass -p '<password>' ssh user@server
    
  2. Create an ssh key

    ssh-keygen -t rsa
    

    You can simplify things by allowing an empty passphrase (the rest of this answer will assume you have done so, let me know if your security concerns prohibit this and I will modify accordingly).

  3. Create a file with all the IPs you are interested in and their respective username and passwords, one per line:

    1.2.3.4 bob bobs_password
    11.22.33.44 hary harrys_password 
    

    Now, use sshpass to copy your key files and --as long as you've used an empty passphrase-- allow passwordless access to all machines:

    while read ip user pass; do 
      sshpass -p "$pass" ssh ssh-copy-id -i ~/.ssh/id_rsa.pub $user@$ip;
    done < ips.txt
    
  4. Now that you have passwordless access set up, install your software on each machine (this assumes that $user can run apt-get, basically that $user is root):

     while read ip user pass; do 
       ssh $user@$ip "apt-get install package; 
     done < ips.txt
    
terdon
  • 234,489
  • 66
  • 447
  • 667
  • 1
    +1 "Now that you have passwordless access set up..." install a configuration management tool on all your clients and don't look back :) – Joseph R. Sep 27 '13 at 17:39