Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/irunasroot/pyawx-client
API library for interacting with Ansible AWX
https://github.com/irunasroot/pyawx-client
ansible ansible-playbook ansible-playbooks ansible-project api awx awx-ansible awx-cli python tower tower-cli
Last synced: about 1 month ago
JSON representation
API library for interacting with Ansible AWX
- Host: GitHub
- URL: https://github.com/irunasroot/pyawx-client
- Owner: irunasroot
- License: apache-2.0
- Created: 2021-03-03T05:21:12.000Z (almost 4 years ago)
- Default Branch: master
- Last Pushed: 2022-11-13T22:00:03.000Z (about 2 years ago)
- Last Synced: 2024-11-13T09:27:10.037Z (about 2 months ago)
- Topics: ansible, ansible-playbook, ansible-playbooks, ansible-project, api, awx, awx-ansible, awx-cli, python, tower, tower-cli
- Language: Python
- Homepage:
- Size: 102 KB
- Stars: 2
- Watchers: 2
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE.txt
Awesome Lists containing this project
README
# pyawx-client
A python library for interacting with Ansible AWX instances![Unittest - master](https://github.com/irunasroot/pyawx-client/workflows/Python%20package/badge.svg?branch=master)
# Installation
You can install from pypi using pip
``bash
pip install pyawx-client
``# Usage
AWX provides an API v2 for interacting with it. Most of the API is supported but keep in mind this is in alpha
and not everything will be built yetThe Client object sort of works in the idea of SQLAlchemy... at least for now.
Also, please be aware that models, or the python API could change since this project is still in Apha.
Get a list of Jobs
```python
from pyawx import Client
from pyawx.models.jobs import Jobclient = Client("https://awx.mycompany.com", username="me", password="password")
jobs = client.get_data(Job)
```Create a job template
```python
from pyawx import Client
from pyawx.models.jobs import JobTemplateclient = Client("https://awx.mycompany.com", username="me", password="password")
new_job = JobTemplate(name="My Job", description="Do some stuff", project=1)
client.add(new_job)
client.commit()
```Delete a job template
```python
from pyawx import Client
from pyawx.models.jobs import JobTemplateclient = Client("https://awx.mycompany.com", username="me", password="password")
job_template = client.get_data(JobTemplate)[0]
client.delete(job_template)
client.commit()
```