- name: Get id of cluster ansible.builtin.uri: url: "https://api.scaleway.com/k8s/v1/regions/{{ region_k8s }}/clusters" status_code: 200 return_content: yes method: GET headers: X-Auth-Token: "{{ scw_secret_key }}" register: output - name: Download kubeconfig ansible.builtin.uri: url: "https://api.scaleway.com/k8s/v1/regions/{{ region_k8s }}/clusters/{{ item.id }}/kubeconfig?dl=1" status_code: 200 dest: "{{ project_terraform }}/kubeconfig" method: GET headers: X-Auth-Token: "{{ scw_secret_key }}" when: item.name == "{{ project_name_tf }}" with_items: "{{ (output.content |from_json).clusters }}" - name: Copy kubeconfig copy: src: "{{ project_terraform }}/kubeconfig" dest: "{{ project_kubeconfig }}"