cyberark / ansible-security-automation-collection

CyberArk Ansible Security Automation Collection
MIT License
60 stars 37 forks source link

Update cyberark_credential Documentation with Usable Example #27

Open jamesmarshall24 opened 3 years ago

jamesmarshall24 commented 3 years ago

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

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