Add task to modify 1 client

This commit is contained in:
Laurent Gourvenec 2023-07-24 16:07:28 +02:00
parent fe88269c9f
commit a9e6253449
1 changed files with 23 additions and 0 deletions

View File

@ -0,0 +1,23 @@
---
# Simple task to update 1 client for hydra.
# Parameter: client_id
- fail: msg='Error, client does not exist. Please define the client first'
when: hydra_clients|selectattr("client_id", "equalto", client_id)|list|length == 0
- name: Create or overwrite hydra-client
template:
src: hydra-client.json.j2
dest: "/etc/hydra/clients.d/{{ item.client_id }}.json"
with_items: "{{ hydra_clients }}"
when: item.client_id == client_id
become: true
- name: Delete client
command: podman exec -t cadoles-pod-hydra-v1 /bin/sh -c "hydra clients delete {{ client_id }} --endpoint http://127.0.0.1:4445"
ignore_errors: true
become: true
- name: Import client
command: podman exec -t cadoles-pod-hydra-v1 /bin/sh -c "hydra clients import /etc/hydra/clients.d/{{ client_id }}.json --endpoint http://127.0.0.1:4445"
become: true