2022-11-07 23:07:06 +01:00

21 lines
667 B
YAML

- 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 }}"