rhub.rhub.rhub_api module – Interacts with Resource Hub API.

Note

This module is part of the rhub.rhub collection.

To install it, use: ansible-galaxy collection install rhub.rhub.

To use it in a playbook, specify: rhub.rhub.rhub_api.

Synopsis

  • Interacts with Resource Hub API.

Parameters

Parameter

Comments

addr

string / required

Resource Hub base address.

If not set the environment variable RHUB_API_ADDR will be used.

body

any

Resource Hub base address.

method

string

HTTP API method.

Choices:

  • "GET" ← (default)

  • "POST"

  • "PATCH"

  • "DELETE"

path

string / required

API endpoint path.

token

string / required

API auth token.

If not set the environment variable RHUB_API_TOKEN will be used.

Examples

- name: get region info
  rhub.rhub.rhub_api:
    addr: https://rhub.example.com
    token: s3cr3t_t0k3n
    method: GET
    path: /v0/lab/region/1

- name: launch tower template
  rhub.rhub.rhub_api:
    addr: https://rhub.example.com
    token: s3cr3t_t0k3n
    method: POST
    path: /v0/tower/template/123/launch
    body:
      extra_vars:
        cluster_id: 1

Return Values

Common return values are documented here, the following are the fields unique to this module:

Key

Description

data

string

Response data

when request succeeded and API returned data (ie. DELETE doesn’t return any data)

Returned: success

problem

string

Problem data (RFC 7807)

Returned: failure