darthsoup/rundeck-php

rundeck php api

0.2 2018-01-11 02:26 UTC

README

Latest Version on Packagist Software License Total Downloads

PHP API Wrapper for Rundeck

This package is work in progress, not all api features are currently included.

The currently tested API version of Rundeck is 20, other versions may work but they are untested.

Install

You can install the package via composer:

composer require darthsoup/rundeck-php

Usage

Init API Wrapper

To init the API wrapper, register a HTTP adapter and create the Rundeck base class.

require_once '../vendor/autoload.php';

$adapter = new DarthSoup\Rundeck\Adapter\GuzzleHttpAdapter('<yourRundeckApiToken>');

$rundeck = new DarthSoup\Rundeck\Rundeck($adapter, 'https://<yourRundeckUrl>/api/20');

You are now ready to start.

Start a Job

Jobs are started by runJob with the Job UUID as first parameter. You also can add a argString to include some options.

$job = $rundeck->job()->runJob('<YourJobUuid></YourJobUuid>', ['argString' => '-ArgTest1 yourstring'])
var_dump($job);

Execution Info of a Job

The Output of a Execution can returned by this command.

$execution = $rundeck->execution()->output(<ExecutionId>)
var_dump($execution);

Rundeck System Info

Get current Rundeck System Info

$systeminfo = $rundeck->system()->info()
var_dump(systeminfo);

Support

Please open an issue in github

License

This package is released under the MIT License. See the bundled LICENSE file for details.