21 lines
664 B
YAML
Raw Normal View History

2022-10-09 13:27:16 +02:00
- name: Get id of cluster
ansible.builtin.uri:
2022-10-20 16:51:12 +02:00
url: "https://api.scaleway.com/k8s/v1/regions/{{ region_k8s }}/clusters"
2022-10-09 13:27:16 +02:00
status_code: 200
return_content: yes
method: GET
headers:
X-Auth-Token: "{{ scw_secret_key }}"
register: output
- name: Download kubeconfig
ansible.builtin.uri:
2022-10-20 16:51:12 +02:00
url: "https://api.scaleway.com/k8s/v1/regions/{{ region_k8s }}/clusters/{{ item.id }}/kubeconfig?dl=1"
2022-10-09 13:27:16 +02:00
status_code: 200
dest: "{{ project_terraform }}/kubeconfig"
method: GET
headers:
X-Auth-Token: "{{ scw_secret_key }}"
2022-10-20 16:51:12 +02:00
when: item.name == "{{ project_name }}"
2022-10-09 13:27:16 +02:00
with_items: "{{ (output.content |from_json).clusters }}"