Do More With Less - Automating IBM Storage FlashSystem Tasks With REST APIs Scripting and Ansible
Do More With Less - Automating IBM Storage FlashSystem Tasks With REST APIs Scripting and Ansible
Sergei Kubin
Uwe Schreiber
Vasfi Gucer
Redpaper
Draft Document for Review July 23, 2024 8:08 am 5736TOC.fm
Contents
Notices . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . iii
Trademarks . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . iv
Preface . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .v
Authors . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .v
Now you can become a published author, too! . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . vi
Comments welcome. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . vi
Stay connected to IBM Redbooks . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . vi
Chapter 1. Introduction. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1
1.1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2
1.1.1 Increased agility and faster storage provisioning . . . . . . . . . . . . . . . . . . . . . . . . . . 2
1.1.2 Reduced human error and improved consistency. . . . . . . . . . . . . . . . . . . . . . . . . . 2
1.1.3 Simplified management of complex storage tasks . . . . . . . . . . . . . . . . . . . . . . . . . 3
1.2 Example use cases . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3
1.2.1 Automated provisioning . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3
1.2.2 Automated backup and recovery . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3
1.2.3 Performance optimization . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3
1.2.4 Automating storage reporting . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3
1.2.5 Automated user access control. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4
1.3 Infrastructure as Code (IaC) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4
1.3.1 Role of IaC in automation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4
1.4 Storage Virtualize automation opportunities . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5
Related publications . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 61
IBM Redbooks . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 61
Online resources . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 61
Help from IBM . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 61
4 Do More with Less: Automating IBM Storage FlashSystem Tasks with REST APIs, Scripting, and Ansible
Draft Document for Review July 15, 2024 1:54 pm 5736edno.fm
IBM Redbooks
July 2024
REDP-5736-00
5736edno.fm Draft Document for Review July 15, 2024 1:54 pm
Note: Before using this information and the product it supports, read the information in “Notices” on page iii.
Notices
This information was developed for products and services offered in the US. This material might be available
from IBM in other languages. However, you may be required to own a copy of the product or product version in
that language in order to access it.
IBM may not offer the products, services, or features discussed in this document in other countries. Consult
your local IBM representative for information on the products and services currently available in your area. Any
reference to an IBM product, program, or service is not intended to state or imply that only that IBM product,
program, or service may be used. Any functionally equivalent product, program, or service that does not
infringe any IBM intellectual property right may be used instead. However, it is the user’s responsibility to
evaluate and verify the operation of any non-IBM product, program, or service.
IBM may have patents or pending patent applications covering subject matter described in this document. The
furnishing of this document does not grant you any license to these patents. You can send license inquiries, in
writing, to:
IBM Director of Licensing, IBM Corporation, North Castle Drive, MD-NC119, Armonk, NY 10504-1785, US
This information could include technical inaccuracies or typographical errors. Changes are periodically made
to the information herein; these changes will be incorporated in new editions of the publication. IBM may make
improvements and/or changes in the product(s) and/or the program(s) described in this publication at any time
without notice.
Any references in this information to non-IBM websites are provided for convenience only and do not in any
manner serve as an endorsement of those websites. The materials at those websites are not part of the
materials for this IBM product and use of those websites is at your own risk.
IBM may use or distribute any of the information you provide in any way it believes appropriate without
incurring any obligation to you.
The performance data and client examples cited are presented for illustrative purposes only. Actual
performance results may vary depending on specific configurations and operating conditions.
Information concerning non-IBM products was obtained from the suppliers of those products, their published
announcements or other publicly available sources. IBM has not tested those products and cannot confirm the
accuracy of performance, compatibility or any other claims related to non-IBM products. Questions on the
capabilities of non-IBM products should be addressed to the suppliers of those products.
Statements regarding IBM’s future direction or intent are subject to change or withdrawal without notice, and
represent goals and objectives only.
This information contains examples of data and reports used in daily business operations. To illustrate them
as completely as possible, the examples include the names of individuals, companies, brands, and products.
All of these names are fictitious and any similarity to actual people or business enterprises is entirely
coincidental.
COPYRIGHT LICENSE:
This information contains sample application programs in source language, which illustrate programming
techniques on various operating platforms. You may copy, modify, and distribute these sample programs in
any form without payment to IBM, for the purposes of developing, using, marketing or distributing application
programs conforming to the application programming interface for the operating platform for which the sample
programs are written. These examples have not been thoroughly tested under all conditions. IBM, therefore,
cannot guarantee or imply reliability, serviceability, or function of these programs. The sample programs are
provided “AS IS”, without warranty of any kind. IBM shall not be liable for any damages arising out of your use
of the sample programs.
Trademarks
IBM, the IBM logo, and ibm.com are trademarks or registered trademarks of International Business Machines
Corporation, registered in many jurisdictions worldwide. Other product and service names might be
trademarks of IBM or other companies. A current list of IBM trademarks is available on the web at “Copyright
and trademark information” at https://www.ibm.com/legal/copytrade.shtml
The following terms are trademarks or registered trademarks of International Business Machines Corporation,
and might also be trademarks or registered trademarks in other countries.
FlashCopy® IBM Spectrum® Redbooks (logo) ®
IBM® Orchestrate® Storwize®
IBM FlashSystem® QRadar®
IBM Security® Redbooks®
The registered trademark Linux® is used pursuant to a sublicense from the Linux Foundation, the exclusive
licensee of Linus Torvalds, owner of the mark on a worldwide basis.
Microsoft, Windows, and the Windows logo are trademarks of Microsoft Corporation in the United States,
other countries, or both.
Java, and all Java-based trademarks and logos are trademarks or registered trademarks of Oracle and/or its
affiliates.
Ansible, Red Hat, are trademarks or registered trademarks of Red Hat, Inc. or its subsidiaries in the United
States and other countries.
VMware, and the VMware logo are registered trademarks or trademarks of VMware, Inc. or its subsidiaries in
the United States and/or other jurisdictions.
Other company, product, or service names may be trademarks or service marks of others.
iv Do More with Less: Automating IBM Storage FlashSystem Tasks with REST APIs, Scripting, and Ansible
Draft Document for Review July 15, 2024 1:54 pm 5736pref.fm
Preface
This IBM Redpaper equips you with the knowledge and skills to automate essential IBM
Storage FlashSystem and IBM SAN Volume Controller tasks through the implementation of
REST APIs, scripting languages, and Ansible. Practical examples are provided to illustrate
the concepts and guide your learning process.
The target audience of this book is IBM Storage FlashSystem administrators and Storage
Automation Professionals.
Authors
This paper was produced by a team of specialists from around the world.
Elias Luna
IBM USA
Find out more about the residency program, browse the residency index, and apply online at:
ibm.com/redbooks/residencies.html
Comments welcome
Your comments are important to us!
We want our papers to be as helpful as possible. Send us your comments about this paper or
other IBM Redbooks publications in one of the following ways:
Use the online Contact us review Redbooks form found at:
ibm.com/redbooks
Send your comments in an email to:
[email protected]
Mail your comments to:
IBM Corporation, IBM Redbooks
Dept. HYTD Mail Station P099
2455 South Road
Poughkeepsie, NY 12601-5400
vi Do More with Less: Automating IBM Storage FlashSystem Tasks with REST APIs, Scripting, and Ansible
Draft Document for Review July 15, 2024 1:54 pm 5736pref.fm
https://www.redbooks.ibm.com/rss.html
Preface vii
5736pref.fm Draft Document for Review July 15, 2024 1:54 pm
viii Do More with Less: Automating IBM Storage FlashSystem Tasks with REST APIs, Scripting, and Ansible
Draft Document for Review July 15, 2024 1:54 pm 5736ch01.fm
Chapter 1. Introduction
In this chapter we discuss the following topics:
“Introduction”
“Example use cases”
“Infrastructure as Code (IaC)”
“Storage Virtualize automation opportunities”
1.1 Introduction
Automating the management of IBM Storage Virtualize systems (IBM Storage FlashSystem
and IBM SAN Volume Controller) offers numerous benefits that can significantly enhance the
efficiency and reliability of storage operations.
Rapid deployment
Automation enables the quick deployment of storage resources, empowering organizations to
adapt swiftly to evolving business needs. Instead of time-consuming manual provisioning,
automation scripts and tools configure storage systems in minutes, ensuring agility and
responsiveness.
Scalability
Automated storage management helps businesses scale effortlessly. As data needs evolve,
storage scales automatically, preventing disruptions and ensuring consistent performance for
your applications. This translates to uninterrupted business operations and a competitive
edge.
Adaptability
Automation empowers IBM Storage FlashSystem to handle new workloads and applications
with impressive speed. This streamlined approach ensures efficient storage support for your
ever-changing business needs.
Standardized procedures
Automation streamlines storage management tasks, guaranteeing consistent execution every
time. Scripts and workflows eliminate the inconsistencies inherent in manual processes,
leading to standardized configurations and smoother operations.
Error reduction
Manual storage management can be prone to human error, leading to downtime and data
loss. Automation offers a reliable solution by minimizing errors through automating repetitive
and complex tasks. This ensures consistent and reliable storage operations.
2 Do More with Less: Automating IBM Storage FlashSystem Tasks with REST APIs, Scripting, and Ansible
Draft Document for Review July 15, 2024 1:54 pm 5736ch01.fm
Task automation
Automating complex storage tasks like replication, backups, and tiered storage management
streamlines IT operations. This frees up valuable IT staff time, allowing them to focus on
strategic initiatives that drive business value.
Centralized control
Automation tools transform storage management by offering centralized interfaces. This
user-friendly approach allows administrators to effortlessly monitor and control multiple
storage systems and tasks from a single console. The unified view simplifies management,
saving time and minimizing potential errors.
Chapter 1. Introduction 3
5736ch01.fm Draft Document for Review July 15, 2024 1:54 pm
Imperative IaC describes the exact commands needed to achieve the desired configuration.
This approach involves specifying step-by-step instructions.
Version control
IaC files are treated as code and stored in version control systems (for example, Git). This
allows for tracking changes, collaboration, and rollback capabilities in case of issues.
Idempotency
Idempotent operations ensure that applying the same configuration multiple times will have
the same effect, preventing unintended changes and maintaining consistency.
4 Do More with Less: Automating IBM Storage FlashSystem Tasks with REST APIs, Scripting, and Ansible
Draft Document for Review July 15, 2024 1:54 pm 5736ch01.fm
Scalability
IaC enables the easy scaling of infrastructure. By defining configurations in code, additional
resources can be provisioned automatically based on demand.
Improved collaboration
Since IaC files are stored in version control systems, they facilitate better collaboration among
teams. Changes can be reviewed, tested, and approved in a controlled manner.
Documentation
IaC serves as a form of living documentation for the infrastructure. The code itself describes
how the infrastructure is set up and managed, providing clear and up-to-date documentation.
All the methods are available and consistent through all the Storage Virtualize portfolio,
scripts or playbooks can be written once and used for all members of the family.
Chapter 1. Introduction 5
5736ch01.fm Draft Document for Review July 15, 2024 1:54 pm
6 Do More with Less: Automating IBM Storage FlashSystem Tasks with REST APIs, Scripting, and Ansible
Draft Document for Review July 15, 2024 1:54 pm 5736ch02.fm
Security measures available on the system can be broadly divided into two categories:
System security and data security.
These features include, but are not limited to, multifactor authentication (MFA), role-based
access control (RBAC), object-based access control (OBAC), or disabling access to the
command line interface (CLI), graphical user interface (GUI), and Representational State
Transfer interface (REST) API.
These features ensure the system's data is protected against theft, loss, or attack. While data
security features like Data-at-Rest Encryption (EDAR) and IBM Safeguarded Snapshot also
play a crucial role, they are outside the scope of this chapter. Here, we will explore how to
improve default configurations for enhanced security.
8 Do More with Less: Automating IBM Storage FlashSystem Tasks with REST APIs, Scripting, and Ansible
Draft Document for Review July 15, 2024 1:54 pm 5736ch02.fm
system. Remote users are defined and maintained in an authentication service external to the
Storage Virtualize system, for example in your organization’s LDAP directory.
Each user belongs to a user group. Each user group is assigned a role that is associated with
a set of privileges The user group privileges determine which configuration commands can be
run by the users that are members of this group.
As a general best practice, every user must have the most restrictive role that allows him to
fulfill his duties. For example, a user created to run scripts or make REST API calls solely for
extracting performance statistics should be assigned to a group with Monitor permissions.
Table 2-1 on page 9 shows use cases, user roles and their main characteristics.
Read system’s status and Monitor role Can not make any changes on
configured objects states, the system, can only run
check system performance. commands that show system
information.
Read states and execute Copy operator, FlashCopy® Same as monitor plus run
specialized tasks. administrator role commands that create or
change objects related to the
role.
Maintenance tasks; Restricted Admin role All that Admin can do, but can
Administrative tasks without a not remove volumes, hosts or
permission to delete objects. mappings.
User and Security Administrator role All that an admin can do, plus:
authentication User management: create
management; manage and delete user and user
Safeguarded groups.
snapshots. Change system date time
settings and time.
Not recommended for using Change security settings.
with automation. LDAP server settings.
Change certificates.
Password rules.
MFA settings.
Change Safeguarded
snapshot configuration.
Delete Safeguarded
snapshots.
Two person integrity when Security Admin + TPI = Can do everything as a Security
managing users and Restricted Security Admin, but requires approve
Safeguarded snapshots. Administrator from another Security Admin to
complete risky or critical tasks.
In addition to the role’s restrictions, a user group can be configured to prohibit some of the
access methods. For example, It is possible to configure a user group to accept only REST
API calls, or restrict GUI access and leave only REST and CLI. For instructions, refer to User
management commands, mkusergrp and chusergrp, and to Example 2-1.
Example 2-1 Creating a user group with monitor role which allows only REST API access
IBM_FlashSystem:ITSO:securityadmin>mkusergrp -name REST_only -role Monitor
-disablegui yes -disablecli yes
Modifying the authentication setting for this user group will affect logins for
all users in the group. Are you sure you want to continue? (y/yes to confirm) y
User Group, id [6], successfully created
IBM_FlashSystem:ITSO:securityadmin>lsusergrp REST_only
id 6
name REST_only
role Monitor
remote no
owner_id
owner_name
multi_factor no
password_sshkey_required no
gui_disabled yes
cli_disabled yes
rest_disabled no
10 Do More with Less: Automating IBM Storage FlashSystem Tasks with REST APIs, Scripting, and Ansible
Draft Document for Review July 15, 2024 1:54 pm 5736ch02.fm
cim_disabled yes
Note: superuser built-in account does not follow settings for the default SecurityAdmin
group and has separate controls to enable or disable GUI and REST API access, MFA and
SSH key requirements. Refer to chsecurity CLI command for details.
A local user is a user whose account is managed entirely within the system itself. A local user
can belong to one user group only. It must have a password, an SSH public key, or both. Each
user has a username, which must be unique across all users in a system.
When you connect to the CLI by using an SSH client, SSH public key authentication is
attempted first, with the username and password combination available as an alternative. The
SSH key authentication method is available for CLI access and file transfer using Secure copy
protocol (SCP). For GUI access, only the combination of username and password is used.
Locally administered users can coexist with remote authentication.
Remote users are administered in the organization’s LDAP directory infrastructure, where the
actual authentication of remote users is done. The LDAP infrastructure can be a single,
dedicated LDAP server, or part of a more complex environment, such as Microsoft Active
Directory Services (MSAD) or Red Hat Directory Server.
Another way to delegate user management from the Storage Virtualize system is to configure
authentication with Single Sign-On (SSO). In distinction to remote users authenticating with
LDAP, SSO-authenticated users can log in only to GUI, and can not use CLI or REST API.
See Single Sign-On in IBM Documentation for use difference between SSO and LDAP
methods and for configuration instructions.
Only Security Administrator group member or Restricted Security Administrator with an active
privilege escalation can set password policy.
A user with an expired password can log in to the system, but cannot run any commands that
modify configuration (svctask group commands, or the commands that do no start with ls*),
until they change their password.
Complete the following steps to set the password policy in the GUI:
1. Select Settings → Security.
2. Select the Password Policies tab, as shown in Figure 2-1.
3. Set required password parameters in Password creation and Password expiration and
account lockout sections. Additional input windows will be shown as you click on a
feature enable checkbox.
4. After all attributes are set, click Save.
5. You can also command the system to explore all existing local user passwords
immediately, so all users are forced to create a new password at their next login.
Alternatively, you can use CLI chsecurity command, as demonstrated in Example 2-2 on
page 12.
The chsecurity command with the maxfailedlogins and lockoutperiod parameters controls
user account locking. When a user exceeds the maximum number of allowed failed login
attempts, their account gets locked, preventing them from logging in to the system. This
lockout period determines how long the account remains inaccessible. If the lockoutperiod is
set to 0, the account becomes permanently locked and requires manual unlocking by a
Security Administrator.
Example 2-3 shows CLI commands for manual locking and unlocking of a user account.
12 Do More with Less: Automating IBM Storage FlashSystem Tasks with REST APIs, Scripting, and Ansible
Draft Document for Review July 15, 2024 1:54 pm 5736ch02.fm
This same interface panel also manages the validity period of REST API security tokens.
Once a token expires, it becomes invalid and requires regeneration for continued API access.
Figure 2-2 on page 13 shows the settings including the allowed values:
A configurable CLI time-out of 5–240 minutes
A configurable GUI time-out of 5–240 minutes
A REST API token time-out of 10–120 minutes
Figure 2-2 Setting session time-outs and REST API token time-out
For cluster maintenance and recovery tasks performed through Service Assistant, only the
superuser login account has the necessary permissions. This superuser account has a
higher level of access than a Security Administrator.
A superuser password must be changed immediately after the cluster is created. System
enforces the change and will not allow you to perform configuration before it is done.
Superuser password can't be set or reset to match the default value until cluster configuration
is intentionally destroyed. It is crucial to set a strong password and to store it securely.
If you choose to leave the superuser account enabled, implement the strongest possible
security measures to protect it. Use a complex password and limit knowledge of the
password.
Superuser is the only account that can run commands with Service Assistant prefixes, satask
and sainfo. Tasks that can be performed exclusively by superuser are:
Initial system setup
Rebooting nodes in a failure state
Installing software in a failure or service state
Cluster recovery (T3 recovery)
For other superuser Service Assistant tasks, equivalent cluster (svctask or svcinfo)
command exists. Refer to Table 2-2 for a list of commands that can be used to replace
superuser-only commands in Storage Virtualize 8.6.0 and later.
Tip: Cluster commands include the word “node” on SVC and “nodecanister” on
enclosure-based systems, for example, lsnodestatus and lsnodecanisterstatus. By
adding the optional prefix svctask or svcinfo to the SVC commands (for example, svctask
lsnodestatus), you can make them work on both SVC and enclosure-based platforms.
Superuser is a member of the default SecurityAdmin user group. However access settings for
the group do not apply to superuser: for example, even if you set up SecurityAdmin group to
reject GUI logins, superuser will still be able to do it.
14 Do More with Less: Automating IBM Storage FlashSystem Tasks with REST APIs, Scripting, and Ansible
Draft Document for Review July 15, 2024 1:54 pm 5736ch02.fm
Note: Disabling the superuser account and session time-outs are available only on plat-
forms with a dedicated Technician port.
Locking superuser account is a two-step process. First, you need to enable superuser
locking, then run a command to lock it. Steps to disable the superuser account by using the
CLI are shown in Example 2-4:
A user cannot lock their own account, so the second step must be done from a non-superuser
Security Administrator account.
Note: If superuser locking is enabled, but the account is not explicitly locked, superuser will
follow the defined password policy for account expiration and locking. This means it can be
locked automatically, for example, after several unsuccessful login attempts.
To unlock superuser:
Log in with another Security Administrator user account. Such an account must be
configured prior to locking superuser. It can be a local account with additional security
measures (for example, configured to require both password and SSH key, or password
and MFA), or a remote account (LDAP).
In case it is not possible to log in with a remote or local Security Administrator account, you
need physical access to the system hardware to reset superuser password. You will see
superuser password reset link when accessing the system Service Assistant GUI through the
Technician port. Alternatively, you can use USB flash drive interface with satask
resetpassword command. This method is also suitable for systems that do not have a
dedicated Technician port. With the command you must specify new password and you can
not use the default one.
If superuser account is locked, it will be automatically unlocked when the password is reset.
Storage Virtualize offers the option to disable the superuser password reset function.
However, this decision requires careful consideration. If superuser password is lost, there are
no other Security Administrators, and password can not be reset, then there is no way recover
superuser access to the cluster. In such a scenario, recovering access would necessitate:
1. Migrating data off the system using host-side tools.
2. Destroying the existing cluster.
3. Recreating the cluster from scratch.
Note: If you disable password reset and you do not have local or remote Security
Administrator users except superuser, there is no way to restore management access if
superuser password is lost.
Multifactor authentication requires users to provide multiple pieces of information when they
log in to the system to prove their identity. MFA can be configured for both remote (LDAP) and
local user, it can also be configured for superuser. It supports both CLI and GUI interfaces,
but can not be used with REST API.
Two Person Integrity (TPI), also known as the four-eyes-principle, makes a defined set of
administration tasks require agreement between two administrators, so a single person, such
as a rogue user with administration permissions, can not perform them. TPI limits only several
tasks that are normally performed by Security Administrator and works in GUI and CLI, and
also does not affect REST API usage.
16 Do More with Less: Automating IBM Storage FlashSystem Tasks with REST APIs, Scripting, and Ansible
Draft Document for Review July 15, 2024 1:54 pm 5736ch02.fm
For a list of supported MFA providers, refer to the Supported Authentication Providers page
on IBM website.
MFA feature uses OpenID Connect (OIDC) authentication protocol for GUI authentication and
providers API for CLI access.
MFA failback policy defines system behavior in a situation, when authentication provider can
not be contacted. It can be set to allow or deny users, configured to use MFA. By default, it will
deny logins, which means that if MFA is configured for all users including superuser, and
communication to the provider fails, there is no way to access system’s management
interfaces without physical access to the hardware. With the hardware access, superuser is
able to log in with the technician port, regardless of the MFA configuration.
Note: Only local users and users authenticated through LDAP Remote Authentication with
Security Administrator privileges can request a role elevation. This functionality is not avail-
able to users who are authenticated through SSO, even if they have Security Administrator
privileges within SSO.
Enabling TPI is restricted to IBM Storage Virtualize systems featuring a Technician Port. This
is to avoid users locking themselves out of the system because a locked superuser account
can be unlocked from the Technician Port interface.
At least two local users with Security Administrator role (excluding superuser), or a remote
user group with this role, must be set up before TPI is configured.
The set of tasks that require privilege elevation is fixed and includes system-critical and
security-related tasks:
Create or change users or user groups.
Change security settings related to LDAP, MFA, SSO.
Change certificates.
Change the system time or NTP settings.
Remove and change Safeguarded backups and Safeguarded backup locations.
Delete Safeguarded snapshots.
Remove the Safeguarded snapshot policy association from a volume group.
Configuration instructions are provided in the Two person integrity section in IBM
Documentation.
Note, that if you are logged in as superuser to enable the feature, you will not be able to
continue as the changes are applied immediately, as Example 2-6 on page 18 shows.
When two person integrity feature is enabled, all Security Administrator users are switched to
Restricted Security Administrator role. Restricted SecAdmin can issue a request for privilege
elevation. Another Restricted SecAdmin approves this request, but can limit approved time, if
necessary. After request is approved, role immediately changes to Security Administrator.
See Example 2-7 for workflow.
### Another Restricted SecAdmin logs in and approves, but sets shorter limit
IBM_FlashSystem:ITSO:approver>lscurrentuser
name approver
role RestrictedSecurityAdmin
...
IBM_FlashSystem:ITSO:approver>lstwopersonintegrityrequest
request_id user_name is_remote minutes_requested minutes_approved ....
0 rsecadmin no 90 0 ....
IBM_FlashSystem:ITSO:approver>chtwopersonintegrityrequest -approve
-minutesapproved 30 -username rsecadmin
IBM_FlashSystem:ITSO:approver>lstwopersonintegrityrequest
request_id user_name is_remote minutes_requested minutes_approved ....
18 Do More with Less: Automating IBM Storage FlashSystem Tasks with REST APIs, Scripting, and Ansible
Draft Document for Review July 15, 2024 1:54 pm 5736ch02.fm
0 rsecadmin no 90 30 ....
The purpose of the internal Root CA of an IBM Storage Virtualize system is to add its
certificate to truststores on systems communicating through TLS-encrypted paths. This can
include administrator workstations that are used to access the management GUI, Encryption
Key Servers or other Storage Virtualize systems in a Policy Based Replication partnership.
The advantage of applying the internal root CA certificate over using the system’s certificate
is that the communication can seamlessly continue between these systems, even if the
certificate was renewed after it had expired.
Your organization’s policy might restrict usage of certificates, not signed by a trusted Root CA,
which can be either an internal one, for example part of your organization’s own Public Key
Infrastructure (PKI), or a public trusted CA such as GlobalSign, Let’s Encrypt, and others.
Web browsers maintain a list of trusted CAs that are identified by their root certificate. The
root certificate must be included in this list for the signed certificate to be trusted, so no
security warning will be raised.
Organization-internal Root CAs are usually configured as trusted authorities across your
company.
To see the details of your system’s certificate in the GUI, select Settings → Security and
then click System Certificates, as shown in Figure 2-3. In the CLI, you can use the
command lssystemcert.
Depending on your organization’s security policies and needs, you can create a new
certificate, which is a self-signed by the system. Another option is to create a Certificate
Signing Request (CSR), which can be submitted to be signed by a CA within your own
organization or by an external, trusted CA. Also, beginning with Storage Virtualize V8.5.3, the
option to use a system-internal root CA was added, which can be used to sign certificate
signing requests created for this system.
An internally signed system certificate can be renewed automatically 30 days before its
expiration date, if automatic renewal is enabled. You can also re-generate it manually, key
type requirements or any of the other certificate properties need to be changed. For
instructions, refer to Updating internally signed certificate in IBM Documentation.
20 Do More with Less: Automating IBM Storage FlashSystem Tasks with REST APIs, Scripting, and Ansible
Draft Document for Review July 15, 2024 1:54 pm 5736ch02.fm
22 Do More with Less: Automating IBM Storage FlashSystem Tasks with REST APIs, Scripting, and Ansible
Draft Document for Review July 15, 2024 1:54 pm 5736ch03.fm
Scripting can be used to automate management tasks or for reporting and monitoring. For
complex management tasks, using Ansible or REST API is preferred.
To authenticate on the system, login and password or SSH key pair is used. For scripting
purposes, SSH key is the recommended method.
IBM Storage Virtualize provides SSH clients a functional Unix bash-like shell, running in
restricted environment. General CLI usage instructions are provided in IBM Documentation.
Interactive shell
The use of an SSH client within a shell is a common way of running commands. When using
interactive shell, it is still possible to use scripts, but there is no way to save script source code
or script outputs on the system itself.
Non-interactive shell
Instead of opening an interactive session, you can use SSH client to run a command on the
remote system, and forward the output to the local computer.
Leveraging SSH for remote command execution empowers you to write powerful scripts for
IBM Storage Virtualize. These scripts can:
1. Collect data from the storage system.
2. Transfer the collected data to your local machine.
3. Process the data on your local computer using a wider range of tools and utilities available
at your disposal.
Example 3-1 shows how to use SSH to run a command (svcinfo lssystem) on the IBM
Storage Virtualize system (mystorage) with the privileges of myuser and piping the output to
the local system to filter only a line that shows system’s code version.
24 Do More with Less: Automating IBM Storage FlashSystem Tasks with REST APIs, Scripting, and Ansible
Draft Document for Review July 15, 2024 1:54 pm 5736ch03.fm
Effective error checking and handling allow the script to adapt its behavior in case of issues.
This includes:
Stopping execution: If an SSH connection problem arises, the script can terminate
gracefully.
Modifying execution logic: If the IBM Storage Virtualize response indicates an error, the
script can adjust its subsequent steps accordingly.
By incorporating error handling, you ensure your scripts are robust and can handle
unexpected situations.
In both interactive and non-interactive shells, IBM Storage Virtualize uses exit codes to
indicate command success or failure:
Exit code 0: Successful command execution.
Exit code 1: A CMMVC error message was encountered.
Exit codes 2-225: Other execution failures.
By checking the exit code, scripts can define logic to handle errors appropriately, such as
taking specific actions or stopping script execution.
When running a command via SSH from a host over a non-interactive shell, the host will
correctly display the exit code. Any error text will be sent to the host's standard error
(STDERR).
There might be slight variations in CLI commands between different IBM Storage Virtualize
products. For instance, the lsnode command is not available in IBM FlashSystem, which uses
lsnodecanister for the same functionality.
Generally, cluster commands that return information on the current state or start with ls, can
use svcinfo prefix. Commands that modify current state of the system, use svctask prefix.
Note that service-level task and information commands require sainfo and satask prefixes, it
can not be omitted or replaced with svcinfo/svctask.
ls-commands support -delim parameter, which allows to provide a single, selectable character
that will be inserted between columns of the output instead of spaces. The colon (:) or tilde (~)
are good choices for a delimiter, as they can not be found on most of the data fields and
therefore will not break result parsing.
Many ls commands in IBM Storage Virtualize can leverage the -gui parameter. This
parameter allows you to retrieve an extended data table similar to the output displayed in the
IBM Storage Virtualize GUI. It provides more detailed information for all objects of the
requested type. For a clear comparison, refer to Example 3-3, which showcases the output
headers of the lsdrive command with and without the -gui parameter.
26 Do More with Less: Automating IBM Storage FlashSystem Tasks with REST APIs, Scripting, and Ansible
Draft Document for Review July 15, 2024 1:54 pm 5736ch03.fm
Key point: This flexibility allows you to choose the approach that best suits your needs.
You can leverage your existing scripting environment or write scripts directly on the storage
system using the provided internal commands.
While loop runs until the given statement is no longer true. Example 3-5 shows a loop which
prints numbers 1 to 5.
For loop provides the same output. It iterates over the provided set of values and changing
the loop variable with each iteration. This set can be defined in several ways:
Range: Using curly braces {start..end} to specify a range of values (for example, for i in
{1..5}; do ... ).
Space-separated list: Separating values with spaces (for example, for i in Monday
Tuesday Wednesday; do ... ).
Command substitution: Executing a command and using its output as the list (for
example, for i in $(lsdrive -nohdr -delim : | cut -d : -f 1); do ... ).
Data parsing
There is a set of data filtering and parsing tools available in the CLI.
grep is a GNU grep command implementation. When a command output is piped to grep,
it will process it string by string and search for the specified pattern.
cut is a GNU cut, it is used to print only selected parts of the line with delimiters;
For available command options, issue the command with --help parameter in the system’s
CLI, or refer to the appropriate Unix documentation.
Example 3-6 shows a script that creates four 100 GB vdisks with the provided names and
immediately maps them to the existing host with ID 0.
Example 3-7 on page 28 showcases a script that monitors the system code update process.
Example 3-8 demonstrates a script that extracts "Used Capacity" data for virtual disks
(vdisks), which isn't available in the standard or even extended object listing view.
28 Do More with Less: Automating IBM Storage FlashSystem Tasks with REST APIs, Scripting, and Ansible
Draft Document for Review July 15, 2024 1:54 pm 5736ch03.fm
30 Do More with Less: Automating IBM Storage FlashSystem Tasks with REST APIs, Scripting, and Ansible
Draft Document for Review July 23, 2024 8:08 am 5736ch04.fm
It describes REST API interface and provides several examples of how to interact with it.
API limits
Rate limiting helps with security and the prevention of an attack, such as a denial of service in
which unlimited work is sent to the system. The rate limiting is implemented at second
granularity and creates a return code (429 - too many requests) when a violation occurs.
REST API rate limits are listed in the documentation Storage Virtualize RESTful API.
The use of the REST API Explorer requires authentication with login and password, that are
used for generating a token, which is needed for all further actions. Figure 4-1 shows how to
create an authentication token within the IBM SAN Volume Controller information and IBM
SAN Volume Controller Task actions.
To access the REST API Explorer, enter the following URL in a browser:
https://<management_ip>:7443/rest/explorer
To view the REST API documentation, see Storage Virtualize RESTful API. Support can also
be found directly on the system within the REST API Explorer.
32 Do More with Less: Automating IBM Storage FlashSystem Tasks with REST APIs, Scripting, and Ansible
Draft Document for Review July 23, 2024 8:08 am 5736ch04.fm
Figure 4-1 also shows the following outputs after successful authentication:
The curl command that is required to carry out the action
Request URL, which was addressed during the execution of the action
Server response in from of the Response body and the response header
After a token is generated, more actions can be completed in the REST API Explorer.
Figure 4-2 shows an example for the request body boilerplate, modified to create a mirrored
vdisk with the required parameters and the output within the response body.
34 Do More with Less: Automating IBM Storage FlashSystem Tasks with REST APIs, Scripting, and Ansible
Draft Document for Review July 23, 2024 8:08 am 5736ch04.fm
Authentication
Aside from data encryption, the HTTPS server requires authentication of a valid username
and password for each API session. It is required to specify two authentication header fields
for your credentials: X-Auth-Username and X-Auth-Password.
Initial authentication requires that you POST the authentication target (/auth) with the
username and password. The REST API server returns a JWT token. The token remains
authorized only for the configured time, 10 to 120 minutes. You can also set a limit for how
long an unused token is valid
Example 4-1 shows a process of getting an authentication token using login and password,
parsing received json with jq, and save token in the variable for further use:
The X-Auth-Token header in combination with the authentication token replaces the
username and password for all further actions.
Technically, for almost every cluster-level (i.e. commands that do not need sainfo or satask
prefixes) there is a REST target. Also, with REST API it is possible to download files such as
performance statistics, IP quorum apps and support packages (snaps) from the node’s
internal locations.
Review the following examples to see how commands can be converted to REST API
queries. According to the command syntax shown in Example 4-2. command requires one
parameter -node, and one argument, which is a numeric ID of the port, which is port id 2 here.
To translate that into REST API query, parameters must be provided in a json notation. Also, a
Content-Type header to specify the kind of provided POST data is needed. Command’s
argument is translated to the endpoint ID and specified in the URL. Example 4-3
demonstrates this.
The same approach is used if you want to refer an object by its name instead of the id.
If you need to supply parameters to a command that do not require a value, such as -bytes,
they need to be set to true in the json.
Example 4-4 Requesting object details by its name with REST API
IBM_FlashSystem:ITSO:redbooks>lsmdisk -bytes MDisk1
... output truncated ...
During deployment you can choose to use the same certificates or replace them with CA
signed certificates. Additional consideration is required in the PowerShell script when working
with self-signed certificates.
36 Do More with Less: Automating IBM Storage FlashSystem Tasks with REST APIs, Scripting, and Ansible
Draft Document for Review July 23, 2024 8:08 am 5736ch04.fm
The examples in this chapter are very basic because the intention is mainly to demonstrate
the command syntax for different use cases with PowerShell.
For an actual deployment of a script, use recommended practices. For example, use
PowerShell credentials, secure strings or hash files on disk for credentials, instead of having
them in plain text in the script.
Table 4-1 shows a syntax comparison of Curl, PowerShell, and PowerShell Core
There are some differences in the PowerShell language between Windows PowerShell and
PowerShell (Core). The differences are most notable in the availability and behavior of
PowerShell cmdlets between Windows and non-Windows platforms and the changes
resulting from the differences between the .NET Framework and the .NET Core.
PowerShell on Linux and macOS uses .NET Core, which is a subset of the full .NET
Framework on Microsoft Windows. This is important because PowerShell provides direct
access to the underlying framework types and methods.
This difference becomes visible when using the Invoke-RestMethod cmdlet to determine a
specific SSL/TLS version or SSL verification behavior.
While the Invoke-RestMethod cmdlet from PowerShell Core provides dedicated options for
this, using the cmdlet in conjunction with Windows PowerShell requires a separate command
or additional scripting.
4.2.1 Authentication
The script that is shown in Example 4-5 shows an example of the authentication and creation
of an access token using the Windows PowerShell cmdlet Invoke-RestMethod.
$myUser = 'myUser'
$myPassword = 'myUserPassword'
"@
Add-Type $certCallback
}
[ServerCertificateValidationCallback]::Ignore()
# Get auth token
$token = Invoke-RestMethod -Method 'Post' -Headers @{'X-Auth-Username' = $($myUser);
'X-Auth-Password' = $($myPassword)} -ContentType 'application/json' -Uri
https://$($myStorage):7443/rest/v1/auth
The script that is shown in Example 4-6 shows an example of the authentication and creation
of an access token using the PowerShell Core cmdlet Invoke-RestMethod.
As the cmdlet of PowerShell Core does provide the parameters SslProtocol and
SkipCeritificateCheck, there is no need for additional code within the script to workaround
that circumstances. Example assumes that credential variables are already set as in previous
example.
Example 4-6 Using the REST API to get a token by using PowerShell Core
# Get auth token
$token = Invoke-RestMethod -SslProtocol Tls12 -SkipCertificateCheck-Method 'Post' -Headers
@{'X-Auth-Username' = $($myUser); 'X-Auth-Password' = $($myPassword)} -ContentType
'application/json' -Uri https://$($myStorage):7443/rest/auth
38 Do More with Less: Automating IBM Storage FlashSystem Tasks with REST APIs, Scripting, and Ansible
Draft Document for Review July 23, 2024 8:08 am 5736ch04.fm
Example 4-7 Using the REST API by using Windows PowerShell - providing data as body
#Define a hash table with the parameters that you would like to pass to the REST API call
in "-body"
$body = @{
"mdiskgrp" = 1
"unit" = "gb"
"size" = 100
"name" = "my_vDisk_01"
}
#It is required to convert the content defined within the body to JSON format
$body_json = $body | ConvertTo-Json
# Create vdisk
Invoke-RestMethod -Method 'Post' -Headers @{'X-Auth-Token' = $Token.token} -ContentType
'application/json' -Body $body_json -Uri https://$($myStorage):7443/rest/v1/mkvdisk
The script that is shown in Example 4-8 shows an API request to list pool properties. This
example demonstrates how to pass a Boolean value to -Body from a dictionary, for example a
parameter like‚ -bytes does not have an argument so passing of a boolean value is required.
Example 4-8 Using the REST API by using Windows PowerShell - passing boolean values
#Define a hash table with the parameters for passing to the REST API call in "-body"
$body = @{
"bytes" = [bool]::Parse('true')
}
#It is required to convert the content defined within the body to JSON format
$body_json = $body | ConvertTo-Json
# Get mdisksgroups
Invoke-RestMethod -Method 'Post' -Headers @{'X-Auth-Token' = $Token.token} -ContentType
'application/json' -Body $body_json -Uri https://$($myStorage):7443/rest/v1/lsmdiskgrp
With PowerShell core, the script will be almost the same, the only difference is that as it was
explained before you can specify SSL version and skip certificate check. Example is shown in
Example 4-9 on page 39. It assumes that token is already created and saved as a variable.
4.3.1 Python
The script that is shown in Example 4-10 shows an authentication and creation of an access
token for further use in the context of querying all available MDisks with a python script.
The output of the script provides the following information about each MDisk:
Name
Name of the providing controller
Name of the MDisk group
Capacity
Status
The script uses the getpass module to prompt for the password and prevent the storage of the
credentials in clear text within the script.
import json
import requests
import getpass
myStorage = 'myStorage'
myUser = 'myUser'
myPassword = getpass.getpass()
_mdisks = json.loads(mdiskRequest.text)
40 Do More with Less: Automating IBM Storage FlashSystem Tasks with REST APIs, Scripting, and Ansible
Draft Document for Review July 23, 2024 8:08 am 5736ch04.fm
The use of the verify=False option allows insecure SSL connections. By default, every SSL
connection is verified to be secure. This option allows the request to get proceed; otherwise,
the connection is considered insecure. If you use a signed SSL certificate, you do not need
this option.
4.3.2 Perl
The script that is shown in Example 4-11 shows an example of the authentication and
creation of an access token for further use in the context of querying all available MDisks.
The output of the script provides the following information about each MDisk:
Name
Name of the providing controller
Name of the MDisk group
Capacity
Status
The script uses the IO::Prompter module to prompt for the password and prevent the storage
of the credentials in clear text within the script.
use strict;
use JSON;
use REST::Client;
use IO::Prompter;
my $myStorage = 'myStorage';
my $myUser = 'myUser';
my $mdiskList = $mdiskRequest->responseContent();
my @mdiskListJSON = @{decode_json($mdiskList)};
42 Do More with Less: Automating IBM Storage FlashSystem Tasks with REST APIs, Scripting, and Ansible
Draft Document for Review July 15, 2024 1:54 pm 5736ch05.fm
Agentless architecture
Unlike many other automation tools, Ansible operates without requiring agents to be installed
on remote systems. It uses SSH for Linux/Unix systems and WinRM for Windows systems to
communicate and execute tasks.
Idempotency
Ansible ensures that applying the same configuration multiple times will result in the same
state, preventing unintended changes and ensuring consistency across deployments.
Extensive ecosystem
Ansible has a vast collection of modules that cover a wide range of tasks, from provisioning
and configuration management to application deployment and orchestration. The Ansible
Galaxy is a community-driven repository where users can share and access pre-written roles
and playbooks.
Cross-platform support
Ansible supports a wide range of operating systems and cloud providers, making it a versatile
tool for managing diverse IT environments, including on-premises servers, cloud instances,
and containerized applications.
Scalability
Designed to handle both small and large-scale environments, Ansible can manage everything
from a few servers to thousands of nodes, scaling seamlessly as your infrastructure grows.
44 Do More with Less: Automating IBM Storage FlashSystem Tasks with REST APIs, Scripting, and Ansible
Draft Document for Review July 15, 2024 1:54 pm 5736ch05.fm
Provisioning
Automatically setting up new servers and cloud instances with the necessary software and
configurations.
Configuration management
Ensuring that systems remain in the desired state by managing configuration files, packages,
and services.
Application deployment
Automating the deployment of applications, ensuring consistency across different
environments (development, testing, production).
Orchestration
Coordinating complex workflows and interdependencies between multiple systems and
services.
Red Hat Ansible and other third-party automation tools are becoming increasingly used
across the enterprise IT environments. It is not unexpected that their use in storage
environments is to become more popular.
Ansible is an agentless automation management tool that uses primarily the SSH protocol.
REST API support: Ansible itself does not have a built-in REST API, but you can achieve
interaction with external REST APIs over HTTPS within Ansible playbooks using the
following methods:
URI (Uniform Resource Identifier) module: Ansible provides the uri module which
allows you to make HTTP/HTTPS requests to external APIs. This module can be used
within playbooks to interact with various REST APIs secured with HTTPS. The uri
module allows you to specify the URL, method (GET, POST, PUT, etc.), headers, and
body for the HTTP/HTTPS request.
Community modules: Community modules offer additional functionality specific to the
API they are designed for, such as authentication handling or automatic data parsing.
Some of the modules in SpecV Ansible collection use REST API over HTTPS.
Supported platforms for Ansible include Red Hat, SUSE, Debian, CentOS, macOS, and any
of the Berkeley Software Distribution (BSD) versions.
Windows support: The recommended and officially supported platform for the Ansible
control node is a Linux distribution. Windows Subsystem for Linux (WSL) allows you to run
a Linux environment within Windows 10 or later versions. While it can be used for some
basic Ansible tasks, it might not be ideal for production environments due to potential
performance limitations or compatibility issues.
5.2.3 Requirements
Ansible server (Control Node) features the following requirements:
Python 3 (versions 3.9 and higher).
Note: Certain control node plugins may have additional requirements. Refer to the
plugin documentation for details.
46 Do More with Less: Automating IBM Storage FlashSystem Tasks with REST APIs, Scripting, and Ansible
Draft Document for Review July 15, 2024 1:54 pm 5736ch05.fm
Host requirements:
– Although you do not need a daemon on your managed nodes, you need a way for
Ansible to communicate with them.
– For most managed nodes, Ansible makes a connection over SSH and transfers
modules by using SFTP. If SSH works but SFTP is not available on some of your
managed nodes, you can switch to SCP in ansible.cfg.
– For any machine or device that can run Python, you also need Python 2 (version 2.7 or
later) or Python 3 (version 3.5 or later).
– In addition for non-Python machines, PowerShell 3 - 5.1 can be used.
Note: Some modules feature more requirements that must be met on the target machine
(the managed node). These requirements are listed in ibm.spectrum_virtualize.
With the speed, scale, and complexity of hybrid multicloud and even traditional on-premises
environments, automation became a priority.
IBM Storage FlashSystem family for hybrid multicloud includes integration with Red Hat
Ansible Automation Platform. It allows IT to create an Ansible playbook that automates the
tasks that are repeated across an organization in a consistent way, which helps improve
outcomes and reduces risk.
It also standardizes how IT and application owners interact together and features the
following benefits:
With Red Hat Ansible Automation Platform and IBM Storage, customers can easily
automate tasks, such as configuration management, provisioning, workflow orchestration,
application deployment, and lifecycle management.
By using Red Hat Ansible Automation Platform and IBM Storage, customers can reduce
system inconsistencies with the automation modules.
Red Hat Ansible Automation Platform can also be used to configure end-to-end
infrastructure in an orchestrated fashion.
Ansible provides a single pane of glass visibility to multicluster, multicloud environments,
which allows lines of business to use playbooks to accomplish their goals without needing
to understand the details of how the work is being done.
IBM is a Red Hat-certified support module vendor that provides simple management for the
following commands that are used in the IBM Storage Virtualize Ansible Collection (This is
not a complete list. For most up-to-date information refer to this link)
Collect facts: Collect basic information, including hosts, host groups, snapshots,
consistency groups, and volumes.
Manage hosts: Create, delete, or modify hosts.
Manage volumes: Create, delete, or extend the capacity of volumes.
Manage MDisk: Create or delete a managed disk.
Manage pool: Create or delete a pool (managed disk group).
Manage volume map: Create or delete a volume map.
Manage consistency group snapshot: Create or delete consistency group snapshots.
Manage snapshot: Create or delete snapshots.
Manage volume clones: Create or delete volume clones.
This collection provides a series of Ansible modules and plug-ins for interacting with the IBM
Storage Virtualize family storage products. The modules in the IBM Storage Virtualize Ansible
collection use the REST API to connect to the IBM Storage Virtualize storage system. These
products include:
IBM SAN Volume Controller
IBM Storage FlashSystem family members that are built with IBM Storage Virtualize
IBM Storwize® family
IBM Storage Virtualize for Public Cloud
For more information, see Automate and Orchestrate® Your IBM FlashSystem Hybrid Cloud
with Red Hat Ansible, REDP-5598.
For IBM Storage Virtualize modules, Ansible version 2.14 or higher is required. For more
information about IBM Storage Virtualize modules, see the Ansible web page
ibm.spectrum_virtualize. Also, see IBM Documentation - Using Ansible.
48 Do More with Less: Automating IBM Storage FlashSystem Tasks with REST APIs, Scripting, and Ansible
Draft Document for Review July 15, 2024 1:54 pm 5736ch05.fm
As of this writing, the Ansible collection for IBM Storage Virtualize is available in version 2.4.
Paramiko is a Python (2.7, 3.4+) implementation of the SSHv2 protocol, and provides client
and server functions.
Current limitations
The modules in the IBM Storage Virtualize Ansible collection use the REST API to connect to
the IBM Storage Virtualize storage system.
Prerequisites
Ensure that the following prerequisites are met:
Ansible is installed and configured on a controller node.
Ansible Galaxy Collection ibm.storage_virtualize is installed on the same controller
node.
Network access is available from the controller node to IBM Storage Virtualize
Management IP.
A user with sufficient authorization to create or delete objects on IBM Storage Virtualize.
IBM Storage Virtualize operates at version 8.1.3 or higher above 8.1.3, with the exceptions
of versions 8.3.1.3, 8.3.1.4, and 8.3.1.5.
To upgrade to the latest version of the IBM Storage Virtualize collection, use the following
command:
ansible-galaxy collection install ibm.storage_virtualize --force
50 Do More with Less: Automating IBM Storage FlashSystem Tasks with REST APIs, Scripting, and Ansible
Draft Document for Review July 15, 2024 1:54 pm 5736ch05.fm
52 Do More with Less: Automating IBM Storage FlashSystem Tasks with REST APIs, Scripting, and Ansible
Draft Document for Review July 15, 2024 1:54 pm 5736ch05.fm
Note: Beginning with version 1.6.0, the ibm_svc_vdisk module is considered a deprecated
feature. A new module (ibm_svc_manage_volume) was introduced to manage standard
volumes.
The output of the help includes all permissible options and some examples of how to use the
module (see Example 5-1).
> IBM_SVC_MANAGE_VOLUME
Ansible interface to manage 'mkvolume', 'rmvolume', and 'chvdisk' volume commands.
- buffersize
Specifies the pool capacity that the volume will reserve as a buffer for
thin-provissioned and compressed volumes.
Parameter 'thin' or 'compressed' must be specified to use this parameter.
The default buffer size is 2%.
`thin' or `compressed' is required when using `buffersize'.
Valid when `state=present' to create a volume.
[Default: (null)]
type: str
= clustername
The hostname or management IP of the Storage Virtualize storage system.
type: str
In this section, we discuss creating an Ansible playbook. The creation of the playbook is
based on the use case that is used here.
For a new VMware ESX cluster that consists of two new servers, two vdisks are to be created
and mapped to the host cluster object.
The IBM Storage Virtualize Ansible modules provide idempotency in Ansible playbooks.
The IBM Storage Virtualize Ansible modules check whether the object to be created exists
in the defined state and does not attempt to create it again.
Table 5-2 lists the variable parameters and their values for the example playbook.
Table 5-2 Variable parameters and their values for the example playbook
Attribute Value
The steps that are used to create an Ansible playbook are described next.
Step 1: Authentication
Example 5-2 shows the required YAML notation for the part of the playbook to authenticate at
the IBM Storage Virtualize REST API to obtain a token for further use. To avoid storing the
password in clear text within the playbook, the password was encrypted in a vault.
The generation of a token is an optional task only required for optimization purposes, as all
modules accept username and password to authenticate by itself.
54 Do More with Less: Automating IBM Storage FlashSystem Tasks with REST APIs, Scripting, and Ansible
Draft Document for Review July 15, 2024 1:54 pm 5736ch05.fm
Note: It is valid to use the parameter <domain> when a hostname is used for the
parameter <clustername>.
For more information about how to work with Ansible vaults, see Protecting sensitive data with
Ansible vault.
56 Do More with Less: Automating IBM Storage FlashSystem Tasks with REST APIs, Scripting, and Ansible
Draft Document for Review July 15, 2024 1:54 pm 5736ch05.fm
domain: mydomain.com
username: myuser
password: !vault |
$ANSIBLE_VAULT;1.1;AES256
62653531313434393266646438306537396264306433653638343439643136333238383139616561
6530373430636265316639626234376336306630343333640a326332626564656233323336333239
39633132656631353030386430663736363631656438343364346235653534316333333233333531
3166343263626538360a633664616264326133643339336333363638323232373962393839356637
6138
log_path: /tmp/redbook-example.log
# host 1
host1_name: ESX-Host-1
host1_fcwwpn: 100000109C400798{{":"}}1000001AB0440446
# host 2
host2_name: ESX-Host-2
host2_fcwwpn: 100000109B600424{{":"}}1000001BC0660146
# volume 1
volume1_name: Datastore1
volume1_size: '10'
volume1_size_unit: tb
# volume 2
volume2_name: Datastore2
volume2_size: '10'
volume2_size_unit: tb
tasks:
# creating an authentication token for further usage within the playbook
- name: Obtain an authentication token
register: result
ibm_svc_auth:
clustername: "{{ clustername }}"
domain: "{{ domain }}"
username: "{{ username }}"
password: "{{ password }}"
log_path: "{{ log_path }}"
58 Do More with Less: Automating IBM Storage FlashSystem Tasks with REST APIs, Scripting, and Ansible
Draft Document for Review July 15, 2024 1:54 pm 5736ch05.fm
For more information about the Brocade FOS FC collection on Ansible Galaxy, see the
Ansible web page brocade.fos.
For more information about the community.vmware Ansible Collection on Ansible Galaxy, see
this Ansible web page community.vmware.
60 Do More with Less: Automating IBM Storage FlashSystem Tasks with REST APIs, Scripting, and Ansible
Draft Document for Review July 15, 2024 1:54 pm 5736bibl.fm
Related publications
The publications listed in this section are considered particularly suitable for a more detailed
discussion of the topics covered in this paper.
IBM Redbooks
The following IBM Redbooks publications provide additional information about the topic in this
document. Note that some publications referenced in this list might be available in softcopy
only.
Unleash the Power of Flash: Getting Started with IBM Storage Virtualize Version 8.7 on
IBM Storage FlashSystem and IBM SAN Volume Controller, SG24-8561
Automate and Orchestrate® Your IBM FlashSystem Hybrid Cloud with Red Hat Ansible,
REDP-5598
You can search for, view, download or order these documents and other Redbooks,
Redpapers, Web Docs, draft and additional materials, at the following website:
ibm.com/redbooks
Online resources
These websites are also relevant as further information sources:
IBM Documentation - Using Ansible
https://www.ibm.com/docs/en/flashsystem-9x00/8.7.x?topic=started-using-ansible/
IBM Documentation - Storage Virtualize RESTful API
https://www.ibm.com/docs/en/flashsystem-9x00/8.7.x?topic=interface-storage-virt
ualize-restful-api
62 Do More with Less: Automating IBM Storage FlashSystem Tasks with REST APIs, Scripting, and Ansible
Back cover
Draft Document for Review July 23, 2024 8:13 am
REDP-5736-00
ISBN
Printed in U.S.A.
®
ibm.com/redbooks