Using the REST API in Ansible Playbooks und Modules

[Pages:14]IBM Spectrum Scale:

Using the REST API

in Ansible Playbooks und Modules

-- Markus Rohwedder Spectrum Scale GUI Development

Agenda

? Spectrum Scale REST API: ? What ist Ansible? ? Communicating with the REST API in Playbooks using the URI module ? Ansible Module ? Questions, Feedback

REST API und GUI Overview

Browser



REST Client

...

PSQL

Websphere Liberty

Cache

only

Execution Layer

GUI Users LDAP/AD

xCAT

RAID only

OS audit Callbacks

mmcommon

mm*

Perf

CCR Configuration

Information about die Spectrum Scale REST API:

API Explorer (swagger)



Knowledge Center

. scale.v5r04.doc/bl1adm_restapi_main.htm

Getting started with the REST API

(2019 Presentation by Andreas K?ninger using Jupyter Notebooks)



IBM Spectrum Scale / / ? 2020 IBM Corporation

Ansible

Ansible is an open-source software provisioning, configuration management, and application deployment tool Written in Python - Started in 2012 - RedHat required AnsibleWorks in 2015

IBM Spectrum Scale / / ? 2020 IBM Corporation

Ansible Playbooks

Playbooks are Ansible's configuration, deployment, and orchestration language.

The use a declarative languate to describe how systems should be, using the YAML markup languagte

Ansible prior art in Spectrum Scale land: Deployment - will be extended:

CSI:

IBM Spectrum Scale / / ? 2020 IBM Corporation

Ansible Playbook Example:

Ansible Playbook

Ansible Module

Spectrum Scale REST API

Spectrum Scale + OS CLI

fileset.yml

uri

POST .../filesets/fset1 GET .../jobs/jobID

Ansible Playbook that creates filesets

mmcrfileset mmlinkfileset mmputacl chown

- Uses the uri module for REST communication

IBM Spectrum Scale / / ? 2020 IBM Corporation

Ansible Playbook: Create Fileset Code Example

--- hosts: localhost

vars:

configuration: {

"filesetconfig" : {

"filesetName" : "fset23",

"path" : "/mnt/gpfs0/fset23",

"owner" : "root",

"inodeSpace" : "new",

"maxNumInodes" : "2000", "allocInodes" : "2000" ,

job Endpoint, inorder to

"comment" : "my fileset comment" }

check progress

filesystem: "gpfs0"

}

- name: check job

tasks:

uri:

url: {{ response.json.jobs[0].jobId }}

- name: create fileset

user: admin

uri:

password: admin001

Request Body as json url:

user: admin password: admin001

method: GET validate_certs: no return_content: yes

"until" keyword triggers

method: POST validate_certs: no

body_format: json force_basic_auth: yes

polling

return_content: yes

register: jobinfo

body_format: json

until: jobinfo.json.jobs[0].status != 'RUNNING'

body: "{{ configuration.filesetconfig }}"

retries: 5

force_basic_auth: yes

delay: 10

status_code: 202

failed_when: jobinfo.json.jobs[0].status == 'FAILED'

register: response

- name: Print details

debug:

var: jobinfo.json.jobs[0]

IBM Spectrum Scale / / ? 2020 IBM Corporation

................
................

In order to avoid copyright disputes, this page is only a partial summary.

Google Online Preview   Download