AUTH LDAP TEAM MAP is not able to update with REST API
I am trying to automate the mapping of new teams in LDAP (AUTH_LDAP_TEAM_MAP) configuration,
I am using ansible "uri" module to get all the team map configuration and i am trying to append with new team
I can able to append using "combine" but after it got appended, I am getting ouputs with unicode json character like "u' " so i am improper json format which will be used as body content to do "PATCH"
Here is my code
GET LDAP
- name: Get LDAP Settings
uri:
url: https://URL/api/v2/settings/ldap/
method: "GET"
validate_certs: no
headers:
Authorization: "Bearer {{ token.json.access_token }}"
Content-Type: "application/json"
status_code: [200, 201]
register: list_ldap
- set_fact:
ldap_settings: "{{ list_ldap.json.AUTH_LDAP_TEAM_MAP }}"
Append the new team with result reterived above output
- set_fact:
content1: "{{ ldap_settings | default([]) | combine({ new_team: { 'organization': 'CAPOs', 'remove': false, 'users': 'CN=IT-PAAS-CLOUD-AUTOMATION-TEAM,OU=Team Groups,OU=Access Management,DC=ey,DC=net' } }) }}"
Then i am adding this
- name: Print Whole Content
set_fact:
jsonbody: '{ "AUTH_LDAP_TEAM_MAP": "{{ content1 }}" }'
register: new1
Here i am getting unicode character instead of json formation
Please help me on this