infra.eda_configuration.eda_api (1.1.0) — lookup

Search the API for objects

Authors: Tom Page (@Tompage1994)

Install collection

Install with ansible-galaxy collection install infra.eda_configuration:==1.1.0


Add to requirements.yml

  collections:
    - name: infra.eda_configuration
      version: 1.1.0

Description

Returns GET requests from the EDA Controller API.


Requirements

Usage examples

  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Report the usernames of all users
  debug:
    msg: "Users: {{ query('infra.eda_configuration.eda_api', 'users', return_all=true) | map(attribute='username') | list }}"
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: List all projects which use the ansible/eda github repo
  debug:
    msg: "{{ lookup('infra.eda_configuration.eda_api', 'project', host='https://eda.example.com', username='ansible',
              password='Passw0rd123', verify_ssl=false, query_params={'url': 'https://github.com/ansible/event-driven-ansible.git'}) }}"

Inputs

    
host:
    description: The network address of your EDA Controller host.
    env:
    - name: EDA_HOST

_terms:
    description:
    - The endpoint to query, i.e. credentials, decision_environments, projects, etc.
    required: true

password:
    description: The password for your EDA Controller user.
    env:
    - name: EDA_PASSWORD

username:
    description: The user that you plan to use to access EDA Controller.
    env:
    - name: EDA_USERNAME

expect_one:
    default: false
    description:
    - Error if the response contains more than one object.
    type: boolean

return_all:
    default: false
    description:
    - If the response is paginated, return all pages.
    type: boolean

return_ids:
    aliases:
    - return_id
    default: false
    description:
    - If response contains objects, promote the id key to the top-level entries in the
      list.
    - Allows looking up a related object and passing it as a parameter to another module.
    - This will convert the return to a string or list of strings depending on the number
      of selected items.
    type: boolean

verify_ssl:
    aliases:
    - validate_certs
    description:
    - Specify whether Ansible should verify the SSL certificate of the EDA Controller
      host.
    - Defaults to True, but this is handled by the shared module_utils code
    env:
    - name: EDA_VERIFY_SSL
    type: bool

max_objects:
    default: 1000
    description:
    - if C(return_all) is true, this is the maximum of number of objects to return from
      the list.
    - If a list view returns more an max_objects an exception will be raised
    type: integer

query_params:
    aliases:
    - query
    - data
    - filter
    - params
    description:
    - The query parameters to search for in the form of key/value pairs.
    required: false
    type: dict

expect_objects:
    aliases:
    - expect_object
    default: false
    description:
    - Error if the response does not contain either a detail view or a list view.
    type: boolean

return_objects:
    default: true
    description:
    - If a list view is returned, promote the list of data to the top-level of list returned.
    - Allows using this lookup plugin to loop over objects without additional work.
    type: boolean

request_timeout:
    description:
    - Specify the timeout Ansible should use in requests to the EDA Controller host.
    - Defaults to 10 seconds
    env:
    - name: EDA_REQUEST_TIMEOUT
    type: float

Outputs

_raw:
  description:
  - Response from the API
  returned: on successful request
  type: dict