Created
October 8, 2020 07:53
-
-
Save kalemontes/61b9fbe34f44a14b6ec2da5320f9306b to your computer and use it in GitHub Desktop.
Ansible role to update one property of ISAM API Protection Definition
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- | |
- name: "Get OAuth 2.0 Definition '{{update_oauth_definition_name}}'" | |
isam: | |
appliance: "{{ inventory_hostname }}" | |
adminProxyProtocol: "{{ adminProxyProtocol | default(omit) }}" | |
adminProxyHostname: "{{ adminProxyHostname | default(omit) }}" | |
adminProxyPort: "{{ adminProxyPort | default(omit) }}" | |
adminProxyApplianceShortName: "{{ adminProxyApplianceShortName | default(omit) }}" | |
omitAdminProxy: "{{ omitAdminProxy | default(omit) }}" | |
username: "{{ username }}" | |
password: "{{ password }}" | |
lmi_port: "{{ port | default(omit) }}" | |
log: "{{ log_level | default(omit) }}" | |
force: "{{ force | default(omit) }}" | |
action: ibmsecurity.isam.aac.api_protection.definitions.get | |
isamapi: | |
name: "{{update_oauth_definition_name}}" | |
register: "oauth_def_before_update" | |
- debug: | |
var: "oauth_def_before_update" | |
- name: "Build isamapi request object for OAuth 2.0 Definition" | |
set_fact: | |
isamapi_request_obj: "{{ oauth_def_before_update.data | |
| combine({update_oauth_definition_param:update_oauth_definition_value}, recursive=True) }}" | |
- name: "Clean isam request object for OAuth 2.0 Definition" | |
set_fact: | |
isamapi_request_clean_obj: "{{ isamapi_request_clean_obj | default({}) | combine({item.key: item.value}) }}" | |
when: "{{item.key not in ['id', 'datecreated', 'lastmodified', 'mappingRules', 'accessPolicyId']}}" | |
with_dict: "{{isamapi_request_obj}}" | |
- debug: | |
var: "isamapi_request_clean_obj" | |
- name: "Update OAuth 2.0 Definition '{{update_oauth_definition_name}}' parameter '{{update_oauth_definition_param}}'" | |
isam: | |
appliance: "{{ inventory_hostname }}" | |
adminProxyProtocol: "{{ adminProxyProtocol | default(omit) }}" | |
adminProxyHostname: "{{ adminProxyHostname | default(omit) }}" | |
adminProxyPort: "{{ adminProxyPort | default(omit) }}" | |
adminProxyApplianceShortName: "{{ adminProxyApplianceShortName | default(omit) }}" | |
omitAdminProxy: "{{ omitAdminProxy | default(omit) }}" | |
username: "{{ username }}" | |
password: "{{ password }}" | |
lmi_port: "{{ port | default(omit) }}" | |
log: "{{ log_level | default(omit) }}" | |
force: "{{ force | default(omit) }}" | |
action: ibmsecurity.isam.aac.api_protection.definitions.update | |
isamapi: "{{isamapi_request_clean_obj}}" | |
notify: | |
- Commit Changes |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment