I am trying to create a playbook to automate managing GCS server with ansible. Couldn't find anything up to date on the web, so decided to create my own modules. Ansible allows developing modules in python so using globus SDK seemed like a good fit.
First question is about credentials. I could connect to GCS endpoint with client_id and a secret created from an endpoint itself, after adding administrator role. Using an app credential even after assigning a role results in 401 error (invalid Bearer token). Is this the right way to authenticate?
client = globus_sdk.ConfidentialAppAuthClient(
client_id=client_id, client_secret=client_secret
)
# not sure what the right scope is but this one works
scopes = "urn:globus:auth:scope:transfer.api.globus.org:all"
cc_authorizer = globus_sdk.ClientCredentialsAuthorizer(client, scopes)
gcs = globus_sdk.GCSClient(gcs_address = ..., authorizer = cc_authorizer)
Would be good not having to hard code IDs. Is it possible to have more than one storage gateway of the same connector type on an endpoint? e.g. two or more posix gateways. So if I have a config that looks like the one below, is it possible to uniquely identify a gateway?
connector: Posix
....
And the same question about collections. Confusingly it seems possible to have two different collections with the same display_name, so I am not sure how to uniquely refer to one without hard coding IDs.
And the last question about connector IDs. I can see how to get a name from ID using sdk, but what about reverse? If an ansible playbook wants to specify "connector: Posix" how do I translate it to an ID? At the moment I just maintain reverse dictionary in the module, but it would be nice if SDK could do it.
Cheers,
Yuriy