#Endpoint tenant access through Ansible/API

1 messages · Page 1 of 1 (latest)

spice arch
#

How do I add Tenant access to a Load balancer endpoint through Ansible?
I can't even find it in the API.

tranquil forge
#

It can be found in the private API documentation. /private/gateway-configs/{id}/server-config

#

I don't think it is implemented in the Ansible module yet.

spice arch
#

How did you find that out?
I don't see anything about gateway in the Private API swagger.
Running 11.9.05 though.

tranquil forge
#

Running 11.9.0.6 I logged in, clicked on "?" -> API documentation -> Go to private API documentation (in the upper right corner) -> "load-balancer-endpoints-config"

spice arch
#

That is so confusing! Thank you 😅

spice arch
#

Do you perhaps also have something done already which manages the endpoint tenant access?

tranquil forge
#

No I didn't use that feature yet.

spice arch
#

Geez, that was not very fun to do but I got there.
The Tenant access seems to not handle very well when a tenant is removed, so that has to be fixed by NetApp I guess.

This is how I did it for others who are interested:

    - name: Get endpoints
      uri:
        url: "{{ storagegrid_api_url }}/api/v4/private/gateway-configs"
        method: GET
        headers:
          accept: "application/json"
          Authorization: "Bearer {{ auth_response.json.data }}"
      register: endpoints_result

    # - name: Show endpoints
    #   debug:
    #     var: endpoints_result.json.data

    - name: Filter id for endpoint {{ endpoint_name }}
      set_fact:
        endpoint_id: >-
          {{
            (endpoints_result.json.data
            | selectattr('displayName', 'equalto', endpoint_name)
            | map(attribute='id')
            | list)[0]
          }}

    # - name: Show endpoint id for {{ endpoint_name}}
    #   debug:
    #     var: endpoint_id

    - name: Get information about endpoint {{ endpoint_name}}
      uri:
        url: "{{ storagegrid_api_url }}/api/v4/private/gateway-configs/{{ endpoint_id }}/server-config"
        method: GET
        headers:
          accept: "application/json"
          Authorization: "Bearer {{ auth_response.json.data }}"
      register: endpoint_server_config_result

    # - name: Show information for {{ endpoint_name}}
    #   debug:
    #     var: endpoint_server_config_result.json.data

    # - name: Show accountRestrictions for endpoint {{ endpoint_name}}
    #   debug:
    #     var: endpoint_server_config_result.json.data.accountRestrictions```