Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/pschmitt/pyrundeck
Python REST API client for Rundeck 2.6+
https://github.com/pschmitt/pyrundeck
library python rundeck
Last synced: 5 days ago
JSON representation
Python REST API client for Rundeck 2.6+
- Host: GitHub
- URL: https://github.com/pschmitt/pyrundeck
- Owner: pschmitt
- License: gpl-3.0
- Created: 2016-05-19T14:11:04.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2024-08-28T14:46:18.000Z (5 months ago)
- Last Synced: 2024-10-13T02:09:57.429Z (4 months ago)
- Topics: library, python, rundeck
- Language: Python
- Homepage: https://pypi.org/project/pyrundeck/
- Size: 104 KB
- Stars: 36
- Watchers: 6
- Forks: 29
- Open Issues: 12
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# 🚮 Archived!
If you're interested in maintaining this package please get in touch with me at:
https://github.com/pschmitt/contact/issues/new
# Rundeck REST API client
![PyPI](https://img.shields.io/pypi/v/pyrundeck)
![PyPI - Downloads](https://img.shields.io/pypi/dm/pyrundeck)
![PyPI - License](https://img.shields.io/pypi/l/pyrundeck)
![Python Lint](https://github.com/pschmitt/pyrundeck/workflows/Python%20Lint/badge.svg)This is a Python REST API client for Rundeck 2.6+
## Example
```python
from pyrundeck import Rundeckrundeck = Rundeck('http://rundeck-url',
token='sometoken',
api_version=32, # this is not mandatory, it defaults to 18
)run = rundeck.run_job(RUNDECK_JOB_ID, options={'option1': 'foo'})
running_jobs = rundeck.get_executions_for_job(job_id=RUNDECK_JOB_ID, status='running')
for job in running_jobs['executions']:
print("%s is running" % job['id'])
```A token can be generated in the 'profile' page of Rundeck. Alternatively you
can login with a username and password.Example using the file upload option
```python
from pyrundeck import rundeckrd = Rundeck(
rundeck_url,
username=username,
password=password,
verify=False,
api_version=19 # Required for file upload option
)
# Use the file_key returned in the response to reference the file when running a job
# Per documentation at https://docs.rundeck.com/docs/api/rundeck-api.html#upload-a-file-for-a-job-option
response = rd.upload_file(RUNDECK_JOB_ID, OPTION_NAME, FILE_NAME_STRING_OR_IOFILEWRAPPER)
file_key = response['options'][OPTION_NAME]
rd.run_job(RUNDECK_JOB_ID, options={OPTION_NAME: file_key})
```## See also
- https://github.com/marklap/rundeckrun
## LICENSE
GPL3