项目作者: mdiniz97

项目描述 :
This is a unofficial python API client for Ansible AWX.
高级语言: Python
项目地址: git://github.com/mdiniz97/AnsibleAWX-Client.git
创建时间: 2020-07-23T19:22:10Z
项目社区:https://github.com/mdiniz97/AnsibleAWX-Client

开源协议:MIT License

下载


Ansible AWX Client

Donate to help keep this project maintained


Donate with PayPal button

Summary

This is a unofficial python API client for Ansible AWX.

Requirements

  • requests

Quick Start Guide

Install Ansible AWX Client

  1. pip install ansibleawx-client

Initialize API Client

You can do this with your username and password or using your Token.

Initialize client with your username and password

  1. import ansibleawx
  2. API_URL = "http://my-ansibleawx.com/api/v2"
  3. client = ansibleawx.Api("username", "password", api_url=API_URL)

Initialize client with your token

  1. import ansibleawx
  2. API_URL = "http://my-ansibleawx.com/api/v2"
  3. TOKEN = "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"
  4. client = ansibleawx.Api(api_url=API_URL, token=TOKEN)

Examples

Get Inventories

  1. # to get all inventories
  2. response = client.get_inventories()
  3. # to get specific inventory by id
  4. response = client.get_inventories(1)

Get Jobs Templates

  1. # to get all jobs templates
  2. response = client.get_jobs_templates()
  3. # to get specific job template by id
  4. response = client.get_jobs_templates(1)

Launch Job Template by id

  1. response = client.launch_job_template(1)

Relaunch Job by id

  1. response = client.relaunch_job(1)

Cancel Job by id

  1. response = client.cancel_job(1)

Function Reference

Consult the Ansible Tower documentation for more details.