redhat_cop / redhat_cop.ah_configuration / 0.9.2 / lookup / ah_api Search the API for objects Authors: Tom Page (@Tompage1994)redhat_cop.ah_configuration.ah_api (0.9.2) — lookup
Install with ansible-galaxy collection install redhat_cop.ah_configuration:==0.9.2
collections: - name: redhat_cop.ah_configuration version: 0.9.2
Returns GET requests from the Automation Hub or GalaxyNG API.
- name: Report the usernames of all users debug: msg: "Users: {{ query('redhat_cop.ah_configuration.ah_api', 'users', return_all=true) | map(attribute='username') | list }}"
- name: List all collection namespaces by the devops team debug: msg: "{{ lookup('redhat_cop.ah_configuration.ah_api', 'namespaces', host='https://ah.example.com', username='ansible', password='Passw0rd123', verify_ssl=false, query_params={'company': 'Devops'}) }}"
- name: Get the list of tags for my_ee set_fact: my_ee_tags: "{{ lookup('redhat_cop.ah_configuration.ah_api', 'ee_images', 'my_ee') | map(attribute='tags') | list | flatten }}"
- name: Get the list of versions for redhat_cop.ah_configuration in the published repo set_fact: collection_versions: "{{ lookup('redhat_cop.ah_configuration.ah_api', 'collection', 'published', 'redhat_cop', 'ah_configuration').all_versions | map(attribute='version') | list }}"
host: description: The network address of your Automation Hub host. env: - name: AH_HOST _terms: choices: - '''ee_images'', [ee_image_repository_name]' - '''ee_namespaces''' - '''ee_registries''' - '''ee_repositories''' - '''collections''' - '''collection'', [repository={published, rh_certified, community}], [collection_namespace], [collection_name]' - '''groups''' - '''namespaces''' - '''repository_community''' - '''repository_rh_certified''' - '''users''' description: - The endpoint to query. required: true password: description: The password for your controller user. env: - name: AH_PASSWORD username: description: The user that you plan to use to access inventories on the AH. env: - name: AH_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 AH host. - Defaults to True, but this is handled by the shared module_utils code env: - name: AH_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 oauth_token: description: - The OAuth token to use. env: - name: AH_OAUTH_TOKEN path_prefix: description: - API path used to access the api. - For galaxy_ng this is either 'automation-hub' or the custom prefix used on install with GALAXY_API_PATH_PREFIX - For Automation Hub this is 'galaxy' 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
_raw: description: - Response from the API returned: on successful request type: dict