ansible-security-automation-collection icon indicating copy to clipboard operation
ansible-security-automation-collection copied to clipboard

Update cyberark_credential Documentation with Usable Example

Open jamesmarshall24 opened this issue 3 years ago • 0 comments

Is your feature request related to a problem? Please describe.

The README for cyberark_credential does not provide steps on how to use the results returned from the module in subsequent tasks. The README currently suggests that the module itself will return a URI to do the lookup, not that the module returns values from the module that can be used in tasks later in the playbook:

See: cyberark_credential.md

Creates a URI for retrieving a credential from a password object stored in the Cyberark Vault.

Describe the solution you would like

  • Fix the description of the module to say "returns values to be consumed in the playbook" rather than saying the module returns a URI
  • Correctly comment the "result" section that is not in YAML format which exists in the task playbook example from the README. Example provided below:

result: { api_base_url }"/AIMWebService/api/Accounts?AppId="{ app_id }"&Query="{ query }

and

result: { api_base_url }"/AIMWebService/api/Accounts?AppId="{ app_id }"&Query="{ query }"&ConnectionTimeout="{ connection_timeout }"&QueryFormat="{ query_format }"&FailRequestOnPasswordChange="{ fail_request_on_password_change }

If these two lines incorrectly copied into a playbook, the yaml parser will fail. These should be separated from the task examples to prevent confusion.

Additionally, the task examples should accompany some example module that uses the secret:

- name: credential retrieval basic
  cyberark_credential:
    api_base_url: "http://10.10.0.1"
    app_id: "TestID"
    query: "Safe=test;UserName=admin"
  register: result
  
##  result:
#     { api_base_url }"/AIMWebService/api/Accounts?AppId="{ app_id }"&Query="{ query }

- name: Using the secret
  shell: 'some_command --some-arg {{ result.content }}'
  no_log: true

jamesmarshall24 avatar May 24 '21 21:05 jamesmarshall24