get content from api scaleway
This commit is contained in:
parent
b9c54eff60
commit
bbb3e03651
@ -7,5 +7,4 @@
|
|||||||
- hosts: local
|
- hosts: local
|
||||||
remote_user: valentin
|
remote_user: valentin
|
||||||
roles:
|
roles:
|
||||||
- scaleway-k8s
|
- scaleway-k8s
|
||||||
tags: ["create-cluster"]
|
|
16
scaleway-k8s/tasks/k8s.yml
Normal file
16
scaleway-k8s/tasks/k8s.yml
Normal 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[*]')
|
@ -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"]
|
32
scaleway-k8s/tasks/terraform.yml
Normal file
32
scaleway-k8s/tasks/terraform.yml
Normal 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
|
||||||
|
|
Loading…
x
Reference in New Issue
Block a user