Simple Examples

  1. PyDSH
  2. PyDCP
  3. Host Group File

Practical Examples

  1. Mass Apt-Get
  2. SSH Key Management

Mass Apt-Get:

  1. Remove any old packages from the caches.

    pydsh --user=root -n apt_hosts apt-get clean

  2. Update Apt databases.

    pydsh --user=root -n apt_hosts apt-get update

  3. Download all available updates to each system.

    pydsh --user=root -n apt_hosts apt-get -d upgrade

  4. SSH into each host in sequence and manually supervise each upgrade session.

    for host in $(cat /usr/local/etc/pydsh/groups/apt_hosts)
    do
    echo -e "\nAPT Session for $host"
    ssh root@$host apt-get upgrade
    done

  5. Clean up after ourselves.

    pydsh --user=root -n apt_hosts apt-get clean

SSH Key Management Examples:

  1. Generate new SSH keys:

    pydsh --ssh_pubkey=gen --ssh_keytype=dsa
    or
    pydsh --ssh_pubkey=gen --ssh_keytype=rsa

    Note: if ssh_keytype is not specified, then DSA will be used.

  2. Install SSH keys on Node01 and Node02:

    pydsh -n Node01-2 --ssh_pubkey=install

  3. Revoke SSH keys on the all group:

    pydsh -a --ssh_pubkey=revoke