40 lines
1.6 KiB
YAML
40 lines
1.6 KiB
YAML
|
|
---
|
||
|
|
# Reconcilie les mappeurs d'attributs de la federation. Keycloak en cree un jeu par
|
||
|
|
# defaut a la creation du fournisseur, et pour un annuaire « other » il fait pointer
|
||
|
|
# le prenom sur `cn` — qui, dans `inetOrgPerson`, porte le nom COMPLET. Resultat
|
||
|
|
# affiche au 2026-08-08 : « Administrateur systeme systeme », le nom entier suivi du
|
||
|
|
# nom de famille. Le prenom a son attribut, c'est `givenName`.
|
||
|
|
|
||
|
|
- name: Lire les mappeurs de la fédération
|
||
|
|
ansible.builtin.uri:
|
||
|
|
url: >-
|
||
|
|
http://localhost:8080/admin/realms/{{ serveur_keycloak_realm }}/components?parent={{
|
||
|
|
serveur_keycloak_pol_fed.json[0].id }}&type=org.keycloak.storage.ldap.mappers.LDAPStorageMapper
|
||
|
|
headers:
|
||
|
|
Authorization: "Bearer {{ serveur_keycloak_pol_jeton.json.access_token }}"
|
||
|
|
register: serveur_keycloak_mappeurs
|
||
|
|
no_log: true
|
||
|
|
|
||
|
|
- name: Corriger l'attribut LDAP des mappeurs qui divergent
|
||
|
|
ansible.builtin.uri:
|
||
|
|
url: >-
|
||
|
|
http://localhost:8080/admin/realms/{{ serveur_keycloak_realm
|
||
|
|
}}/components/{{ item.id }}
|
||
|
|
method: PUT
|
||
|
|
status_code: [204]
|
||
|
|
headers:
|
||
|
|
Authorization: "Bearer {{ serveur_keycloak_pol_jeton.json.access_token }}"
|
||
|
|
body_format: json
|
||
|
|
body: >-
|
||
|
|
{{ item | combine({'config': item.config | combine({
|
||
|
|
'ldap.attribute': [serveur_keycloak_ldap_attributs[item.name]]
|
||
|
|
})}) }}
|
||
|
|
loop: "{{ serveur_keycloak_mappeurs.json }}"
|
||
|
|
loop_control:
|
||
|
|
label: "{{ item.name }}"
|
||
|
|
no_log: true
|
||
|
|
changed_when: true
|
||
|
|
when:
|
||
|
|
- item.name in serveur_keycloak_ldap_attributs
|
||
|
|
- (item.config['ldap.attribute'] | default(['']) | first) != serveur_keycloak_ldap_attributs[item.name]
|