RundeckRun¶
[Version 0.2.2]
This is a lightweight wrapper written in Python to interact with the Rundeck API. It uses the awesome requests library.
- READ FIRST
- If you’re new to RundeckRun and are interacting with newer versions of Rundeck (>=2.1.3), you should consider using the command line tools included with Rundeck (since at least Rundeck version 2.0.4). RundeckRun should work well for the Rundeck API up to version 11 (Rundeck <=2.1.3). It currently does not support Rundeck API versions greater than 11 for no other reason the project maintainer not having enough time to put into making the necessary changes. Pull requests welcome!
Basic Example¶
Initialize¶
>>> from rundeck.client import Rundeck
>>> rd = Rundeck('rundeck.server.com', api_token='SECRET_API_TOKEN')
List Projects¶
>>> rd.projects()
[{
'description': None,
'name': 'TestProject',
'resources': {'providerURL': 'http://localhost:8000/resources.xml'},
}]
List Jobs for a Project¶
>>> rd.jobs('TestProject')
[{'description': 'Hello World!',
'group': None,
'id': 'a6e1e0f7-ad32-4b93-ba2c-9387be06a146',
'name': 'HelloWorld',
'project': 'TestProject'}]
Execute a Job¶
>>> rd.job_run('HelloWorld', 'TestProject', argString={'from':'rundeckrun'})
{'argstring': '-from rundeckrun',
'date-started': datetime.datetime(2013, 7, 11, 18, 4, 24),
'description': 'Plugin[localexec, nodeStep: true]',
'href': 'http://rundeck.server.com/execution/follow/123',
'id': '123',
'job': None,
'status': 'running',
'user': 'rundeckrun'}