API - Zolmeister/sprinkler GitHub Wiki

Client

On update (or add), send:
{
    "updateClient": {
        name: superserver,
        hostname: myhostname,
        id: mongoid,
        status: ready
    }
}
//Cases
//sshUser + publicKey
//sshUser + sshPassword + publicKey
//sshUser + sshPassword
//sshUser + sshPassword + rootPassword
//sshUser + rootPassword + publicKey
{
    "newClient": {
        name: nodename,
        hostname: superhost, //or IP
        sshUser: myuser,
        publicKey: true,
        sshPassword: myuserspassword,
        rootPassword: rootpassword
    }
}
{
    success: true
}
{
    "removeClient": clientId
}
{
    success: true
}
{
    "getClientList": {}
}
{
    "clientList": [
        {
            name: superserver,
            hostname: myhostname,
            id: mongoid,
            status: ready
        },
        {
            name: superserver,
            hostname: 12.34.56.78,
            id: mongoid,
            status: busy
        }
    ]
}

Client Jobs

{
    "getClientJobs": {
        id: clientId
    }
}
{
    "clientJobs":{
        clientId: clientId,
        "jobs": [
            {
                id: jobId,
                name: jobname,
                command: {
                    dir: dir,
                    user: user,
                    sh: 'cd roar; echo "hello"'
                }
            },
            {
                id: jobId,
                name: jobname,
                command: {
                    dir: dir,
                    user: user,
                    sh: 'cd roar; echo "hello"'
                }
            }
        ]
    }
}
{
    "getClientCurrentJob": {
        id: clientId
    }
}
{
    "clientCurrentJob": {
        "job": {
            id: jobId,
            name: jobname,
            command: {
                dir: dir,
                user: user,
                sh: 'cd roar; echo "hello"'
            },
            clientId: clientId
        }
    }
}

Job

{
    "newJob": {
        name: myamazingjob,
        command: {
            //dir: '/etc/init.d', not used
            user: localuser //optional, defaults to root user running job,
            sh: 'cd roar; echo "hello"'
        }
        clientId: clientId
    }
}
{
    success: true
}
{
    "removeJob": {
        id: jobmongoid
    }
}
{
    success: true
}

Auth

{
    "getPublicKey": {}
}
{
    "publicKey": 'publickeyhere'
}
⚠️ **GitHub.com Fallback** ⚠️