Skip to main content

Ansible Automation Platform Python Module

This is unofficial wrapper for Ansible Automation Platform (AAP) API.

To see an example how this module can be used please view __main__.py

Executing jobs from CLI

Python module can be invoked directly to execute job in aap and report status to terminal. AAP Credentials need to be specified either via CLI arguments or env variables

Usage:

usage: python3 -m aap [-h] [--insecure] [-p PASSWORD] [-u USERNAME] [-r RETRIES] [-s URL] {job,grep} ...

Trigger jobs and workflows from terminal

options:
  -h, --help            show this help message and exit
  --insecure            Dont verify ssl certificate
  -p PASSWORD, --password PASSWORD
                        Password used for authentication to AAP API (env: AAP_PASSWORD)
  -u USERNAME, --username USERNAME
                        Username used for authentication to AAP API (env: AAP_USERNAME)
  -r RETRIES, --retries RETRIES
                        Number of retries on API error
  -s URL, --url URL     URL of AAP instance (env: AAP_URL)

subcommands:
  {job,grep}            commands help
    job                 job help
    grep                grep help
usage: python3 -m aap job [-h] -i ID [-f] [-l LIMIT] [-j TAGS] [-e EXTRA] [-t TIMEOUT] [--ignore-fail] {run-job}

positional arguments:
  {run-job}

options:
  -h, --help            show this help message and exit
  -i ID, --id ID        ID of job to run
  -f, --follow          Wait for job to finish execution and report its status
  -l LIMIT, --limit LIMIT
                        Limit as comma separated list
  -j TAGS, --tags TAGS  Job tags as comma separated list
  -e EXTRA, --extra-vars EXTRA
                        json formatted extra variables
  -t TIMEOUT, --poll-timeout TIMEOUT
                        Number of seconds between 2 polling requests to aap
  --ignore-fail         Program will return successfull even if job fails
usage: python3 -m aap grep [-h] -s NEEDLE [-o ORGID]

options:
  -h, --help            show this help message and exit
  -s NEEDLE, --search NEEDLE
                        Look for string $string in configuration
  -o ORGID, --orgid ORGID
                        ID or Name of organization to look for $string in configurations

Example run

$ python3 -m aap job --insecure run-job --id 7848 -l sw01-dist.itdev -f
Searching job 7848
Job: Juniper - gather facts
        limit: ['sw01-dist.itdev']
        extra variables: {}
        job id: 2161058
----------------------------------------
Job is running
[DEPRECATION WARNING]: COMMAND_WARNINGS option, the command warnings feature is
 being removed. This feature will be removed from ansible-core in version 2.14.
 Deprecation warnings can be disabled by setting deprecation_warnings=False in 
ansible.cfg.
[DEPRECATION WARNING]: [defaults]callback_whitelist option, normalizing names 
to new standard, use callbacks_enabled instead. This feature will be removed 
from ansible-core in version 2.15. Deprecation warnings can be disabled by 
setting deprecation_warnings=False in ansible.cfg.

PLAY [all] *********************************************************************

TASK [Set tower run variable] **************************************************
ok: [sw01-dist.itdev]

TASK [Set manip if oob] ********************************************************
skipping: [sw01-dist.itdev]

TASK [Check inbound management IP] *********************************************
skipping: [sw01-dist.itdev]

TASK [Check inbound management IP] *********************************************
ok: [sw01-dist.itdev]

TASK [Set username] ************************************************************
skipping: [sw01-dist.itdev]

TASK [set_fact] ****************************************************************
skipping: [sw01-dist.itdev]

TASK [set_fact] ****************************************************************
skipping: [sw01-dist.itdev]

TASK [set_fact] ****************************************************************
ok: [sw01-dist.itdev]

TASK [Check management IP] *****************************************************
skipping: [sw01-dist.itdev]

TASK [Check management IP] *****************************************************
skipping: [sw01-dist.itdev]

TASK [set_fact] ****************************************************************
skipping: [sw01-dist.itdev]

TASK [set_fact] ****************************************************************
skipping: [sw01-dist.itdev]

TASK [set_fact] ****************************************************************
skipping: [sw01-dist.itdev]

TASK [set_fact] ****************************************************************
skipping: [sw01-dist.itdev]

TASK [Set connection variables] ************************************************
ok: [sw01-dist.itdev]

TASK [Get Facts] ***************************************************************
ok: [sw01-dist.itdev]
Playbook run took 0 days, 0 hours, 0 minutes, 12 seconds
PLAY RECAP *********************************************************************
sw01-dist.itdev            : ok=5    changed=0    unreachable=0    failed=0    skipped=11   rescued=0    ignored=0   
Playbook run took 0 days, 0 hours, 0 minutes, 12 seconds

Release files for python-aap 0.0.12

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for python-aap 0.0.12
File Size Uploaded
python_aap-0.0.12.tar.gz 18.4 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for python-aap 0.0.12
File Interpreter ABI Platform
python_aap-0.0.12-py3-none-any.whl Python 3 none any Details

Total release size: 34.7 kB

Release files / python_aap-0.0.12.tar.gz

Download URL python_aap-0.0.12.tar.gz
Size 18.4 kB
Tags Source
SHA-256 checksum
How to use checksums
295f4dc5bf242b4700732f20f29b166a8f8727d07447694f771bec70eac8a173
BLAKE2b-256 checksum
How to use checksums
613cb7ff2fafe152a6e1f9c2ed44fa0074d1c2d1bd447c61851862429a9c26da
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.1.1 CPython/3.8.18

Release files / python_aap-0.0.12-py3-none-any.whl

Download URL python_aap-0.0.12-py3-none-any.whl
Size 16.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
bd90fcd1dbf7f7de03deeb71db9321afb2bcc99da6bb7c577f36d3a4c42eb2d7
BLAKE2b-256 checksum
How to use checksums
a947a3411b6667a11ab1da0091177237f7480b30ffffc27c0c25e4a7c88e3fbe
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.1.1 CPython/3.8.18

Release history Release notifications | RSS feed

This release

0.0.12 This release

2 release files

0.0.10

2 release files

0.0.9

2 release files

0.0.8

2 release files

0.0.7

2 release files

0.0.6

2 release files

0.0.5

2 release files

0.0.4

2 release files

0.0.3

2 release files

0.0.2

2 release files

0.0.1

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page