<?php

function send_ssh_cmd($conf, $con, $ip_addr, $command){
    $ssh = ssh2_connect($ip_addr, 22);
    ssh2_auth_pubkey_file($ssh, "root", "/etc/openstack-cluster-installer/id_rsa.pub", "/etc/openstack-cluster-installer/id_rsa");
    $stream = ssh2_exec($ssh, $command);
    stream_set_blocking($stream, true);
    $data = "";
    while ($buf = fread($stream, 4096)) {
        $data .= $buf;
    }
    fclose($stream);
    return $data;
}

?>