download kubeconfig

This commit is contained in:
Valentin CZERYBA 2022-10-09 13:27:16 +02:00
parent a30ab86b4f
commit 30d3b2bfee
2 changed files with 21 additions and 16 deletions

View File

@ -1,16 +0,0 @@
- name: Get id of cluster
ansible.builtin.uri:
url: https://api.scaleway.com/k8s/v1/regions/fr-par/clusters
status_code: 200
return_content: yes
method: GET
headers:
X-Auth-Token: "{{ scw_secret_key }}"
register: output
- name: Display content GET scaleway
debug:
msg: "{{ item }}"
with_items: "{{ output.content |to_json }}"
# | from_json | community.general.json_query('clusters[*]')

View File

@ -0,0 +1,21 @@
- name: Get id of cluster
ansible.builtin.uri:
url: https://api.scaleway.com/k8s/v1/regions/fr-par/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/fr-par/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 == "terraform-test"
with_items: "{{ (output.content |from_json).clusters }}"