Connect to api ansible awx

Hello, I currently have ansible awx installed in kubernetes, I would like to know how to connect to the awx API?

for example connect to postman.


You can follow this guide

Second method,
Export these env:

export CONTROLLER_PASSWORD='abcaxxxxxxx'

Then you can communicate with your cluster from CLI.


There are docs on authenticating to the API here: AWX API Reference — Ansible AWX community documentation

And you can explore the actual endpoints and parameters they take by going to your AWX instance and looking at the /api/ endpoint in your browser and looking at the browsable API. The parameters should hopefully be pretty well documented, but of course feel free to ask (or submit a PR!) if something isn’t clear :slight_smile:

This works great, because then you can code your configuration into playbooks. This makes life a LOT easier if you need to wipe your AWX install and start over (lab, testing, etc.).

  1. Install ansible-core (cli python version of ansible) to your local computer
  2. Set those environment variables to the correct values
    Note: You can also set the values at runtime in the playbook if you do not want to worry about environment variables, as shown below.
  3. Install the awx.awx ansible-galaxy collection
  4. Write/Execute your playbooks to update your AWX installation.

Sample playbook create a couple inventories:

# Filename pb_inventories.yml
- name:  ========== Configure Inventories ==========
  connection: local
  hosts: lab
  gather_facts: no
    CONTROLLER_USERNAME: "{{ controller_username }}"
    CONTROLLER_PASSWORD: "{{ controller_password }}"
    CONTROLLER_HOST: "{{ awx_url }}"

    - name: A10 Dev
        name: A10 Dev
        description: Non-production A10s
        organization: Connectivity Services
        state: present

    - name: A10 Prod
        name: A10 Prod
        description: Production A10s
        organization: Connectivity Services
        state: present

    - name: AWXLab
        name: AWXLab
        description: Lab AWX Instances
        organization: Connectivity Services
        state: present

    - name: LocalHost
        name: localhost
        description: localhost for execution from the execution environment
        organization: Connectivity Services
        state: present