pssh () {
    HOSTFILES="hosts ips.txt /tmp/hosts"
    for HOSTFILE in $HOSTFILES; do
        [ -f $HOSTFILE ] && break
    done
    [ -f $HOSTFILE ] || {
        echo "No hostfile found (tried $HOSTFILES)"
        return
    }        
    parallel-ssh -h $HOSTFILE -l docker \
    -O UserKnownHostsFile=/dev/null -O StrictHostKeyChecking=no \
    -O ForwardAgent=yes \
    "$@"
}

pcopykey () {
    ssh-add -L | pssh --askpass --send-input \
    "mkdir -p .ssh; tee .ssh/authorized_keys"
    ssh-add -L | pssh --send-input \
    "sudo mkdir -p /root/.ssh; sudo tee /root/.ssh/authorized_keys"
}


