Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ Provided Modules
- **cyberark_user**: Module for CyberArk User Management using Privileged Account Security Web Services SDK
- **cyberark_credential**: Module for CyberArk credential retrieval using Cyberark Central Credential Provider.

**NOTE**: For access to the cyberark_credential functionality, the **library/cyberark_credential.py** file will need to be added to the Ansible modules directory of the Ansible server.
**NOTE**: For access to the cyberark_credential functionality, the **library/cyberark_credential.py** file will need to be added to the Ansible modules directory of the Ansible server, e.g. **~/.ansible/plugins/modules/** or **/usr/share/ansible/plugins/modules/**


Example Playbook
Expand Down Expand Up @@ -244,13 +244,13 @@ Example Playbook
api_base_url: "http://10.10.0.1"
app_id: "TestID"
query: "Safe=test;UserName=admin"
register: {{ result }}
register: result
no_log: true


- name: Debug message
debug:
var: {{ result }}
var: result
```


Expand Down
7 changes: 4 additions & 3 deletions library/cyberark_credential.py
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,8 @@
from ansible.module_utils.urls import open_url
from ansible.module_utils.six.moves.urllib.error import HTTPError
import json
import urllib
# Python3 split urllib into urllib.request, urllib.parse, and urllib.error
import urllib.parse
try:
import httplib
except ImportError:
Expand All @@ -210,10 +211,10 @@ def retrieveCredential(module):
if "client_key" in module.params:
client_key = module.params["client_key"]

end_point = "/AIMWebService/api/Accounts?AppId=%s&Query=%s&ConnectionTimeout=%s&QueryFormat=%s&FailRequestOnPasswordChange=%s" % (urllib.quote(app_id), urllib.quote(query), connection_timeout, query_format, fail_request_on_password_change)
end_point = "/AIMWebService/api/Accounts?AppId=%s&Query=%s&ConnectionTimeout=%s&QueryFormat=%s&FailRequestOnPasswordChange=%s" % (urllib.parse.quote(app_id), urllib.parse.quote(query), connection_timeout, query_format, fail_request_on_password_change)

if "reason" in module.params and module.params["reason"] != None:
reason = urllib.quote(module.params["reason"])
reason = urllib.parse.quote(module.params["reason"])
end_point = end_point + "&reason=%s" % reason

result = None
Expand Down