Redp 5736
Redp 5736
Vasfi Gucer
Sergei Kubin
Uwe Schreiber
Redpaper
IBM Redbooks
October 2024
REDP-5736-00
Note: Before using this information and the product it supports, read the information in “Notices” on page v.
Notices . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .v
Trademarks . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . vi
Preface . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . vii
Authors . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . vii
Now you can become a published author, too! . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . viii
Comments welcome. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . viii
Stay connected to IBM Redbooks . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ix
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.2.6 Conclusion . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4
1.3 Infrastructure as Code. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4
1.3.1 Role of IaC in automation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5
1.4 Storage Virtualize automation opportunities . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5
Related publications . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 63
IBM Redbooks . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 63
Online resources . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 63
Help from IBM . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 63
iv Do More with Less: Automating IBM Storage FlashSystem Tasks with REST APIs, Scripting, and Ansible
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.
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 Security® Redbooks (logo) ®
IBM® QRadar® Storwize®
IBM FlashSystem® 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.
Red Hat and Ansible 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.
vi Do More with Less: Automating IBM Storage FlashSystem Tasks with REST APIs, Scripting, and Ansible
Preface
This IBM® Redpaper describes how to automate essential IBM 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
viii Do More with Less: Automating IBM Storage FlashSystem Tasks with REST APIs, Scripting, and Ansible
Stay connected to IBM Redbooks
Find us on LinkedIn:
https://www.linkedin.com/groups/2130806
Explore new Redbooks publications, residencies, and workshops with the IBM Redbooks
weekly newsletter:
https://www.redbooks.ibm.com/subscribe
Stay current on recent Redbooks publications with RSS Feeds:
https://www.redbooks.ibm.com/rss.html
Preface ix
x Do More with Less: Automating IBM Storage FlashSystem Tasks with REST APIs, Scripting, and Ansible
1
Chapter 1. Introduction
This chapter includes the following topics:
1.1, “Introduction” on page 2
1.2, “Example use cases” on page 3
1.3, “Infrastructure as Code” on page 4
1.4, “Storage Virtualize automation opportunities” on page 5
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, helping ensure agility and
responsiveness.
Scalability
Automated storage management helps businesses scale effortlessly. As data needs evolve,
storage scales automatically, preventing disruptions and helping ensure consistent
performance for your applications. This translates to uninterrupted business operations and a
competitive edge.
Adaptability
You can use automation with IBM Storage FlashSystem to handle new workloads and
applications quickly. This streamlined approach helps ensure efficient storage support for
your ever-changing business needs.
Standardized procedures
The use of automation streamlines storage management tasks and helps guarantee
consistent execution every time. Scripts and workflows eliminate the inconsistencies inherent
in manual processes, which leads to standardized configurations and smoother operations.
Error reduction
Manual storage management can be prone to human error and can cause downtime and data
loss. Automation offers a reliable solution by minimizing errors through automating repetitive
and complex tasks. This helps ensure consistent and reliable storage operations.
2 Do More with Less: Automating IBM Storage FlashSystem Tasks with REST APIs, Scripting, and Ansible
1.1.3 Simplified management of complex storage tasks
Simplified management of complex storage tasks can provide the following benefits.
Task automation
Automating complex storage tasks like replication, backups, and tiered storage management
streamlines IT operations. This frees up valuable IT staff time, so the IT staff can focus on
strategic initiatives that drive business value.
Centralized control
Automation tools transform storage management by offering centralized interfaces. This
approach allows administrators to more easily 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
1.2.5 Automated user access control
Automation can be used to manage user access to storage resources and enforce security
policies.
1.2.6 Conclusion
Automating IBM Storage FlashSystem management delivers agility, speed, and reduced
errors. This translates to efficient, reliable storage that empowers you to excel in today's
data-driven world.
Imperative IaC describes the exact commands that are needed to achieve the wanted
configuration. This approach involves specifying step-by-step instructions.
Version control
IaC files are treated as code and stored in version control systems, such as Git. This allows
for tracking changes, collaboration, and rollback capabilities in case of issues.
Idempotency
Idempotent operations help ensure that applying the same configuration multiple times has
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
1.3.1 Role of IaC in automation
IaC has an important role in automation.
Scalability
IaC enables the scaling of infrastructure. By defining configurations in code, additional
resources can be provisioned automatically based on demand.
Improved collaboration
Because 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 configured and managed, providing clear and up-to-date
documentation.
All the methods are available and consistent through all of the Storage Virtualize portfolio
Scripts or playbooks can be written once and used for all members of the family.
Chapter 1. Introduction 5
6 Do More with Less: Automating IBM Storage FlashSystem Tasks with REST APIs, Scripting, and Ansible
2
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), disabling access to the
command-line interface (CLI), graphical user interface (GUI), and Representational State
Transfer interface (REST) API.
These features help ensure the system's data is protected against theft, loss, or attack.
Although 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. This chapter
explores how to improve default configurations for enhanced security.
8 Do More with Less: Automating IBM Storage FlashSystem Tasks with REST APIs, Scripting, and Ansible
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 them to
fulfill their duties. For example, a user created to run scripts or make REST API calls solely for
extracting performance statistics is assigned to a group with Monitor permissions. Table 2-1
shows use cases, user roles, and their main characteristics.
Read the system’s status and Monitor role Cannot make any changes on
configured objects states, the system and can run
check system performance commands that only show
system information
Read states and run Copy operator, Same as monitor plus run
specialized tasks IBM FlashSystem administrator commands that create or
role change objects related to the
role
Maintenance tasks; Restricted Admin role All that an admin can do, but
Administrative tasks without a cannot remove volumes, hosts
permission to delete objects or mappings
TPI when managing users and Security Admin + TPI = Can do everything as a Security
Safeguarded snapshots Restricted Security Admin, but requires approval
Administrator from another Security Admin to
complete risky or critical tasks
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
In addition to the role’s restrictions, by using the commands mkusergrp and chusergrp, 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 (Example 2-1). For more information, see User management and access
control commands.
Example 2-1 Creating a user group with monitor role that 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
cim_disabled yes
10 Do More with Less: Automating IBM Storage FlashSystem Tasks with REST APIs, Scripting, and Ansible
Note: The built-in account of superuser 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. For more information, see chsecurity.
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 for file transfer by 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 cannot use CLI or REST API. For
more information, see Single Sign-On.
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 until they change their
password, they cannot run any commands that modify configuration, which includes svctask
group commands or the commands that do not start with ls*.
Complete the following steps to set the password policy in the GUI:
1. Select Settings → Security.
3. Set required password parameters in Password creation and Password expiration and
account lockout sections. Additional input windows are shown when you click a feature
enable checkbox.
4. After all attributes are set, click Save.
5. You can also command the system to expire all existing local user passwords immediately,
so all users are forced to create a new password at their next login.
Alternatively, you can use the chsecurity command, as demonstrated in Example 2-2. For
more information, see chsecurity.
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
This same interface panel also manages the validity period of REST API security tokens.
When a token expires, it becomes invalid and requires regeneration for continued API access.
In the CLI, the chsecurity command with guitimeout, clitimeout, and restapitimeout
parameters is used to control user authorization timeout settings. For more information, see
chsecurity.
Figure 2-2 Setting session timeouts and REST API token timeout
For cluster maintenance and recovery tasks that are 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. The system
enforces the change and you cannot perform the configuration before it is done. The
superuser password cannot be set or reset to match the default value until the cluster
configuration is intentionally deleted. 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 the Service Assistant prefixes,
satask and sainfo. The following tasks can be performed exclusively by superuser:
For other superuser Service Assistant tasks, equivalent cluster commands exist that start with
svctask or svcinfo. 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 can still do it.
14 Do More with Less: Automating IBM Storage FlashSystem Tasks with REST APIs, Scripting, and Ansible
2.3.2 Locking and unlocking the superuser account
As an additional measure to increase the security level and to minimize the attack surface, the
superuser account can be locked. A good use case includes the use of a remote
authentication-only system and disabling local account access:
1. Configure remote authentication
2. Create a remote security administrator
3. Disable the local superuser
Note: Disabling the superuser account and session timeouts are available only on plat-
forms with a dedicated Technician port.
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
follows 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 the superuser account, log in with another Security Administrator user account. The
Security Administrator account must be configured before 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).
If it is not possible to log in with a remote or local Security Administrator account, you must
have physical access to the system hardware to reset the superuser password. You see the
If the superuser account is locked, it is 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 the superuser password is lost, if
there are no other Security Administrators, and if the password cannot be reset, then you
cannot recover superuser access to the cluster. In such a scenario, recovering access
requires the following steps:
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 the
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
cannot be used with REST API.
16 Do More with Less: Automating IBM Storage FlashSystem Tasks with REST APIs, Scripting, and Ansible
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, cannot perform them. TPI limits only several
tasks that are normally performed by the Security Administrator and works in GUI and CLI.
TPI does not affect REST API usage.
For a list of supported MFA providers, see IBM Storage Virtualize Supported Authentication
Providers.
MFA uses OpenID Connect (OIDC) authentication protocol for GUI authentication and
provides an API for CLI access.
For detailed configuration instructions, which include the configuration information from the
authentication provider, see Multifactor authentication.
The MFA failback policy defines system behavior when the authentication provider cannot be
contacted. It can be set to allow or deny users that are configured to use MFA. By default, it
denies logins. Therefore, if MFA is configured for all users including superuser, and if
communication to the provider fails, then you must have physical access to the system to
access the system’s management interfaces. With physical access to the system, 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
For more information, which includes configuration instructions, see Two person integrity.
Note that if you are logged in as superuser to enable the feature, you cannot continue as the
changes are applied immediately, as Example 2-6 shows.
When TPI is enabled, all Security Administrator users are switched to the Restricted Security
Administrator role. Restricted SecurityAdmin can issue a request for privilege elevation.
Another Restricted SecAdmin approves this request but can limit the approved time. After the
request is approved, the role immediately changes to Security Administrator. See
Example 2-7.
18 Do More with Less: Automating IBM Storage FlashSystem Tasks with REST APIs, Scripting, and Ansible
### 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 ....
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 expired.
Your organization’s policy might restrict usage of certificates not signed by a trusted Root CA.
The certificate might 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 that
no security warning is 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 on page 20. 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 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.
20 Do More with Less: Automating IBM Storage FlashSystem Tasks with REST APIs, Scripting, and Ansible
3. Install the certificate chain on the Storage Virtualize system.
4. If required, export certificate and install it to the services that must be aware of the
updated system’s certificate (for example, if MFA with IBM Security® Verify is in use).
The chapter also describes management methods that can be used to control and monitor
the IBM Storage Virtualize system by using the CLI and basic scripts.
Scripting can be used to automate management tasks or for reporting and monitoring. For
complex management tasks, the use of Ansible or REST API is usually preferred.
To authenticate on the system, a user ID and password or an SSH key pair is used. For
scripting purposes, an SSH key is the recommended method.
IBM Storage Virtualize provides SSH clients with a functional Unix bash-like shell, running in
a restricted environment. For more information, see Command-line interface.
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 an SSH client to run a command on
the remote system, and forward the output to the local computer.
You can use SSH for remote command execution so that you can write scripts for
IBM Storage Virtualize. The following list provides examples of functions of a script:
1. Collect data from the storage system
2. Transfer the collected data to your local machine
3. Process the data on your local computer by using a wider range of tools and utilities
available at your disposal
Example 3-1 shows how to use SSH to run the command svcinfo lssystem on the
IBM Storage Virtualize system called 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
With effective error checking and handling, the script can adapt its behavior in case of issues,
which includes the following actions:
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 can ensure that 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, such as taking specific
actions or stopping script execution.
When running a command by using SSH from a host over a non-interactive shell, the host
displays the exit code. Any error text is sent to the host's standard error (STDERR).
Example 3-2 shows command exit codes.
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 function.
Service-level task commands and information commands require sainfo and satask prefixes.
It cannot be omitted or replaced with svcinfo or svctask.
The ls* commands support -delim parameter so that you can provide a single, selectable
character to insert between columns of the output instead of spaces. The colon (:) or tilde (~)
is often used as delimiters because they are not found in most of the data fields, so they do
not interfere with parsing the results.
Many ls* commands in IBM Storage Virtualize can use the -gui parameter. You can use the
-gui parameter 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 comparison, see Example 3-3, which shows 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
IBM_FlashSystem:ITSO:redbooks>mkvdisk -mdiskgrp 0 -size 1 -unit gb -nomsg
4
Key point: This flexibility allows you to choose the approach that best suits your needs.
You can use your existing scripting environment or write scripts directly on the storage
system by using the provided internal commands.
While loops run until the given statement is no longer true. Example 3-5 shows a loop that
prints numbers 1 to 5.
For loops provide the same output. It iterates over the provided set of values and changes
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 such as in the following
example:
for i in {1..5}; do ... .
Space-separated list
Separating values with a space such as in the following example:
for i in Monday Tuesday Wednesday; do ...
Command substitution
Running a command and using its output as the list as in the following example
for i in $(lsdrive -nohdr -delim : | cut -d : -f 1); do ...
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
then immediately maps them to the existing host with ID 0.
Example 3-7 shows a script that monitors the system code update process.
28 Do More with Less: Automating IBM Storage FlashSystem Tasks with REST APIs, Scripting, and Ansible
done
Example 3-8 demonstrates a script that extracts Used Capacity data for virtual disks (vdisks),
which isn't available in the standard or extended object listing view.
It describes the 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. Rate limiting is implemented at second granularity
and creates a return code of 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 on page 33
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.
Figure 4-1 on page 33 also shows the following outputs after successful authentication:
The curl command that is required to perform the action
Request URL, which was addressed during the running of the action
Server response, which includes the Response body and the response headers
32 Do More with Less: Automating IBM Storage FlashSystem Tasks with REST APIs, Scripting, and Ansible
Figure 4-1 REST API Explorer authentication
After a token is generated, more actions can be completed in the REST API Explorer.
Figure 4-2 on page 34 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
For the command, the following definitions apply:
-k parameter is required is self-signed certificates are used on the Storage Virtualize
system;
-L parameter allows curl to follow redirects;
-X POST instructs curl to use the only HTTPS method that the Storage Virtualize REST
API supports;
Headers <header_1> and <header_2> are individually specified HTTP headers, such as,
Content-Type and X-Auth-Username.
Parameter -d followed by the input in Java script Object Notation (JSON) is used to
provide command parameters, if they are required, such as ‘{“raid_level”: “raid5”}’.
<StorageVirtualize_ip_address> is the IP address of the IBM Storage Virtualize system
to which you are sending requests.
<api_version> specifies which version of the API should get used. v1 is recommended.
<target> is the target command to be run.
<ID> is an object id, against which a command given in target is run.
Authentication
Other than 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 demonstrates how to obtain an authentication token by using a user ID and
password, how to parse the received JSON response with jq, and how to store the token in a
variable for subsequent 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 command, that is, commands that do not need
sainfo or satask prefixes, there is a REST target. Also, with REST API it is possible to
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, the command requires
one parameter -node, and one argument, which is a numeric ID of the port, which is port id 2
in the example.
To convert that into a REST API query, parameters must be provided in json notation. Also,
include a Content-Type header to specify the kind of provided POST data. The command’s
argument is converted to the endpoint ID and specified in the URL. See Example 4-3.
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 does 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
The examples in this chapter are 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.
Although the Invoke-RestMethod cmdlet from PowerShell Core provides dedicated options
for this, using the cmdlet with Windows PowerShell requires a separate command or
additional scripting.
"@
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 on page 39 shows an example of the authentication
and creation of an access token by using the PowerShell Core cmdlet Invoke-RestMethod.
Because the PowerShell Core cmdlet offers the SslProtocol and SkipCertificateCheck
parameters, there is no need for additional code to address SSL-related concerns within the
38 Do More with Less: Automating IBM Storage FlashSystem Tasks with REST APIs, Scripting, and Ansible
script. The example assumes that credential variables are already set as in the 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
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 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 is almost the same. As it was previously mentioned, the only
difference is that you can specify the SSL version and skip certificate check. An example is
shown in Example 4-9 on page 40 where it is assumed that the token was previously 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()
40 Do More with Less: Automating IBM Storage FlashSystem Tasks with REST APIs, Scripting, and Ansible
token = _token['token']
_mdisks = json.loads(mdiskRequest.text)
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 is 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
5
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 run tasks.
Idempotency
Ansible helps ensure that applying the same configuration multiple times results in the same
state, preventing unintended changes and ensuring consistency across deployments.
Extensive respository
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 as your infrastructure grows.
44 Do More with Less: Automating IBM Storage FlashSystem Tasks with REST APIs, Scripting, and Ansible
5.1.2 Common use cases for Ansible
The following list describes some common use cases for Ansible:
Provisioning
Automatically setting up new servers and cloud instances with the necessary software and
configurations
Configuration management
Helping ensure that systems remain in the wanted state by managing configuration files,
packages, and services
Application deployment
Automating the deployment of applications, helping ensure consistency across different
environments (development, testing, production)
Orchestration
Coordinating complex workflows and interdependencies between multiple systems and
services
Security and compliance
Implementing security policies and helping ensure compliance with industry standards by
automating audits and enforcement
Red Hat Ansible and other third-party automation tools are being used more often in
enterprise IT environments, and their use might increase as they become more popular.
Ansible is an agentless automation management tool that uses primarily the SSH protocol.
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. You can use Windows Subsystem for Linux (WSL) to run a Linux environment
within Windows 10 or later versions. It can be used for some basic Ansible tasks, but it might
not be ideal for production environments because of potential performance limitations or
compatibility issues.
5.2.3 Requirements
The Ansible server (Control Node) features the following requirements:
Python 3 versions 3.9 and later.
Note: Certain control node plug-ins might have additional requirements. Refer to the
plug-in documentation for details.
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.
46 Do More with Less: Automating IBM Storage FlashSystem Tasks with REST APIs, Scripting, and Ansible
5.2.4 Essential terminology in an Ansible environment
The Ansible environment features the following essential terminology:
Ansible Galaxy A hub for finding and sharing Ansible content.
Ansible server The machine with Ansible installed, which runs all tasks and
playbooks.
Playbook A framework where Ansible automation tasks are defined (written in
YAML).
Task A section that contains a single procedure that you want to be run.
Tag A name that you can assign to a task.
Play The execution of a playbook.
Hosts The devices that you manage with Ansible.
Modules A command or set of commands that are made for execution on the
client side.
Handler A task that is called only if a notifier is present.
Notifier A section that is assigned to a task that calls a handler if the output is
changed.
Inventory A file that contains Ansible client/server data.
Fact Information that is retrieved from the client from global variables by
using the gather-facts operation.
Roles A structured way of grouping tasks, handlers, variables, and other
properties.
Container Ansible Container uses Ansible roles to build images, initialize
projects, and add services to projects.
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.
As a Red Hat-certified support module vendor, IBM provides simplified management for the
following commands within the IBM Storage Virtualize Ansible Collection:
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,
which includes the following products:
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 later is required. For more
information about IBM Storage Virtualize modules, see the Ansible web page
ibm.spectrum_virtualize. Also, see Using Ansible.
48 Do More with Less: Automating IBM Storage FlashSystem Tasks with REST APIs, Scripting, and Ansible
5.2.6 Getting started
The Ansible Collection (ibm.storage_virtualize) provides a series of Ansible modules and
plug-ins for interacting with the IBM Storage Virtualize family storage products,.
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 SSH v2 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.
User-developed code. Users might be able to write custom scripts or programs for the storage
system by using supported APIs. These user-developed codes are not considered to be LMC.
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
Name of module Description
52 Do More with Less: Automating IBM Storage FlashSystem Tasks with REST APIs, Scripting, and Ansible
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
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 that is only required for optimization purposes
because all modules accept username and password for authentication.
54 Do More with Less: Automating IBM Storage FlashSystem Tasks with REST APIs, Scripting, and Ansible
- name: Obtain an authentication token
register: result
ibm_svc_auth:
clustername: "{{ clustername }}"
domain: "{{ domain }}"
username: "{{ username }}"
password: "{{ password }}"
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
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
name: "{{ volume2_name }}"
state: "present"
pool: "{{ pool1_name }}:{{ pool2_name }}"
size: "{{ volume2_size }}"
unit: "{{ volume2_size_unit }}"
thin: true
buffersize: 10%
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.
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
REDP-5736-00
ISBN 073846175X
Printed in U.S.A.
®
ibm.com/redbooks