From a9e625344927f03d0522a98fb1d69c174fca679d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Laurent=20Gourv=C3=A9nec?= Date: Mon, 24 Jul 2023 16:07:28 +0200 Subject: [PATCH] Add task to modify 1 client --- tasks/hydra-update-client.yml | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 tasks/hydra-update-client.yml diff --git a/tasks/hydra-update-client.yml b/tasks/hydra-update-client.yml new file mode 100644 index 0000000..47b6ffd --- /dev/null +++ b/tasks/hydra-update-client.yml @@ -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