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.
Regards;
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.
Regards;
You can follow this guide
https://docs.ansible.com/ansible-tower/latest/html/administration/oauth2_token_auth.html
Second method,
Export these env:
export CONTROLLER_PASSWORD='abcaxxxxxxx'
export CONTROLLER_USERNAME=awx
export CONTROLLER_HOST='https://awx-testing.com'
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
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.).
Sample playbook create a couple inventories:
# Filename pb_inventories.yml
- name: ========== Configure Inventories ==========
connection: local
hosts: lab
gather_facts: no
environment:
CONTROLLER_USERNAME: "{{ controller_username }}"
CONTROLLER_PASSWORD: "{{ controller_password }}"
CONTROLLER_HOST: "{{ awx_url }}"
tasks:
- name: A10 Dev
awx.awx.inventory:
name: A10 Dev
description: Non-production A10s
organization: Connectivity Services
state: present
- name: A10 Prod
awx.awx.inventory:
name: A10 Prod
description: Production A10s
organization: Connectivity Services
state: present
- name: AWXLab
awx.awx.inventory:
name: AWXLab
description: Lab AWX Instances
organization: Connectivity Services
state: present
- name: LocalHost
awx.awx.inventory:
name: localhost
description: localhost for execution from the execution environment
organization: Connectivity Services
state: present