get content from api scaleway

This commit is contained in:
Valentin CZERYBA 2022-10-08 23:40:59 +02:00
parent b9c54eff60
commit bbb3e03651
4 changed files with 55 additions and 33 deletions

View File

@ -8,4 +8,3 @@
remote_user: valentin remote_user: valentin
roles: roles:
- scaleway-k8s - scaleway-k8s
tags: ["create-cluster"]

View File

@ -0,0 +1,16 @@
- 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

@ -1,32 +1,7 @@
--- - name: Create cluster k8s scaleway via terraform
# tasks file for scaleway-k8s ansible.builtin.import_tasks: terraform.yml
tags: ["create-cluster"]
- name: Create directory {{ project_terraform }}
file:
path: "{{ project_terraform }}"
state: directory
- name: Copy main.tf
template:
src: main.tf.j2
dest: "{{ project_terraform }}/main.tf"
- name: display plan terraform
debug:
var: output
- name: Create cluster scaleway
community.general.terraform:
project_path: '{{ project_terraform }}'
state: present
force_init: yes
environment:
SCW_ACCESS_KEY: "{{ scw_access_key }}"
SCW_SECRET_KEY: "{{ scw_secret_key }}"
register: output
- name: display terraform result
debug:
var: output
- name: Get id Cluster
ansible.builtin.import_tasks: k8s.yml
tags: ["create-cluster", "api"]

View File

@ -0,0 +1,32 @@
---
# tasks file for create cluster k8s via terraform
- name: Create directory {{ project_terraform }}
file:
path: "{{ project_terraform }}"
state: directory
- name: Copy main.tf
template:
src: main.tf.j2
dest: "{{ project_terraform }}/main.tf"
- name: display plan terraform
debug:
var: output
- name: Create cluster scaleway
community.general.terraform:
project_path: '{{ project_terraform }}'
state: present
force_init: yes
environment:
SCW_ACCESS_KEY: "{{ scw_access_key }}"
SCW_SECRET_KEY: "{{ scw_secret_key }}"
register: output
- name: display terraform result
debug:
var: output