From a70dc5015f298094b125a9f1d64a2f69fb430538 Mon Sep 17 00:00:00 2001 From: Nikolai Rodionov Date: Fri, 22 Mar 2024 16:24:40 +0100 Subject: [PATCH] Allow downloading configs --- tasks/create-user.yaml | 6 ++++++ tasks/main.yml | 2 ++ 2 files changed, 8 insertions(+) diff --git a/tasks/create-user.yaml b/tasks/create-user.yaml index 61533af..bc36cd0 100644 --- a/tasks/create-user.yaml +++ b/tasks/create-user.yaml @@ -120,4 +120,10 @@ environment: KUBECONFIG: "{{ k8s_config_path }}" shell: "{{ working_dir }}/bin/kubectl apply -f {{ cert_dir }}/{{ username }}.yaml" + - name: Storing config on the local machine + when: download_config + ansible.builtin.fetch: + src: "{{ conf_dir }}/config" + dest: "{{ output_path }}/{{ username }}-{{ cluster }}-config" + flat: true tags: add_user diff --git a/tasks/main.yml b/tasks/main.yml index f268b98..d799ef7 100644 --- a/tasks/main.yml +++ b/tasks/main.yml @@ -87,3 +87,5 @@ user_k8s_cert_path: "{{ item.k8s_cert_path | default(k8s_cert_path) }}" user_k8s_cert_crt_file: "{{ item.k8s_cert_crt_file | default(k8s_cert_crt_file) }}" user_k8s_cert_key_file: "{{ item.k8s_cert_key_file | default(k8s_cert_key_file) }}" + download_config: "{{ item.download_config | default(false) }}" + output_path: "{{ item.output_path | default ('/tmp/outputs') }}"