Skip to content

Commit 670f507

Browse files
authored
IBM Spectrum Virtualize Collection v1.10.0 (ansible-collections#70)
* IBM Spectrum Virtualize Collection v1.10.0 IBM Spectrum Virtualize Collection v1.10.0 * IBM Spectrum Virtualize Collection v1.10.0 IBM Spectrum Virtualize Collection v1.10.0 * IBM Spectrum Virtualize Collection v1.10.0 * IBM Spectrum Virtualize Collection v1.10.0 Validation Issues fixed * IBM Spectrum Virtualize Collection v1.10.0 Unit tests added for the new release 1.10.0
1 parent 10fb1a7 commit 670f507

31 files changed

+3833
-287
lines changed

README.md

Lines changed: 39 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
[![Code of conduct](https://img.shields.io/badge/code%20of%20conduct-Ansible-silver.svg)](https://docs.ansible.com/ansible/latest/community/code_of_conduct.html )
44

5-
This collection provides a series of Ansible modules and plugins for interacting with the IBM Spectrum Virtualize family storage products. These products include the IBM SAN Volume Controller, IBM FlashSystem family members built with IBM Spectrum Virtualize (FlashSystem 5xxx, 7xxx, 9xxx), IBM Storwize family, and IBM Spectrum Virtualize for Public Cloud. For more information regarding these products, see [IBM Documentation](https://www.ibm.com/docs/en ).
5+
This collection provides a series of Ansible modules and plugins for interacting with the IBM Spectrum Virtualize family storage products. These products include the IBM SAN Volume Controller, IBM FlashSystem family members built with IBM Spectrum Virtualize (FlashSystem 5xxx, 7xxx, 9xxx), IBM Storwize family, and IBM Spectrum Virtualize for Public Cloud. For more information regarding these products, see [IBM Documentation](https://www.ibm.com/docs/).
66

77
## Requirements
88

@@ -68,39 +68,44 @@ Alternatively, you can add a full namepsace and collection name in the `collecti
6868

6969
### Modules
7070

71-
- ibm_svc_auth - Generates an authentication token for a user on IBM Spectrum Virtualize family storage system
71+
- ibm_svc_auth - Generates an authentication token for a user on Spectrum Virtualize storage systems
7272
- ibm_svc_complete_initial_setup - Completes the initial setup configuration for LMC systems
73-
- ibm_svc_host - Manages hosts on IBM Spectrum Virtualize system
74-
- ibm_svc_hostcluster - Manages host cluster on IBM Spectrum Virtualize system
75-
- ibm_svc_info - Collects information on IBM Spectrum Virtualize system
76-
- ibm_svc_initial_setup - Manages initial setup configuration on IBM Spectrum Virtualize system
77-
- ibm_svc_manage_callhome - Manages configuration of Call Home feature on IBM Spectrum Virtualize system
78-
- ibm_svc_manage_consistgrp_flashcopy - Manages FlashCopy consistency groups on IBM Spectrum Virtualize system
79-
- ibm_svc_manage_cv - Manages the change volume in remote copy replication on IBM Spectrum Virtualize system
80-
- ibm_svc_manage_flashcopy - Manages FlashCopy mappings on IBM Spectrum Virtualize system
81-
- ibm_svc_manage_ip - Manages IP provisioning on IBM Spectrum Virtualize system
82-
- ibm_svc_manage_mirrored_volume - Manages mirrored volumes on IBM Spectrum Virtualize system
83-
- ibm_svc_manage_migration - Manages volume migration between clusters on IBM Spectrum Virtualize system
84-
- ibm_svc_manage_ownershipgroup - Manages ownership groups on IBM Spectrum Virtualize system
85-
- ibm_svc_manage_portset - Manages IP portset on IBM Spectrum Virtualize system
86-
- ibm_svc_manage_replication - Manages remote copy replication on IBM Spectrum Virtualize system
87-
- ibm_svc_manage_replicationgroup - Manages remote copy consistency groups on IBM Spectrum Virtualize system
88-
- ibm_svc_manage_safeguarded_policy - Manages safeguarded policy configuration on IBM Spectrum Virtualize system
89-
- ibm_svc_manage_sra - Manages the remote support assistance configuration on IBM Spectrum Virtualize system
90-
- ibm_svc_manage_user - Manages user on IBM Spectrum Virtualize system
91-
- ibm_svc_manage_usergroup - Manages user groups on IBM Spectrum Virtualize system
92-
- ibm_svc_manage_volume - Manages standard volumes on IBM Spectrum Virtualize system
93-
- ibm_svc_manage_volumegroup - Manages volume groups on IBM Spectrum Virtualize system
94-
- ibm_svc_mdisk - Manages MDisks for IBM Spectrum Virtualize system
95-
- ibm_svc_mdiskgrp - Manages pools for IBM Spectrum Virtualize system
96-
- ibm_svc_start_stop_flashcopy - Starts or stops FlashCopy mapping and consistency groups on IBM Spectrum Virtualize system
97-
- ibm_svc_start_stop_replication - Starts or stops remote-copy independent relationships or consistency groups on IBM Spectrum Virtualize system
98-
- ibm_svc_vol_map - Manages volume mapping for IBM Spectrum Virtualize system
99-
- ibm_svcinfo_command - Runs svcinfo CLI command on IBM Spectrum Virtualize system over SSH session
100-
- ibm_svctask_command - Runs svctask CLI command(s) on IBM Spectrum Virtualize system over SSH session
101-
- ibm_sv_manage_ip_partnership - Manages IP partnership configuration on IBM Spectrum Virtualize systems
102-
- ibm_sv_manage_snapshot - Manages snapshots (mutual consistent images of a volume) on IBM Spectrum Virtualize systems
103-
- ibm_sv_manage_snapshotpolicy - Manages snapshot policy configuration on IBM Spectrum Virtualize systems
73+
- ibm_svc_host - Manages hosts on Spectrum Virtualize storage systems
74+
- ibm_svc_hostcluster - Manages host cluster on Spectrum Virtualize storage systems
75+
- ibm_svc_info - Collects information on Spectrum Virtualize storage systems
76+
- ibm_svc_initial_setup - Manages initial setup configuration on Spectrum Virtualize storage systems
77+
- ibm_svc_manage_callhome - Manages configuration of Call Home feature on Spectrum Virtualize storage systems
78+
- ibm_svc_manage_consistgrp_flashcopy - Manages FlashCopy consistency groups on Spectrum Virtualize storage systems
79+
- ibm_svc_manage_cv - Manages the change volume in remote copy replication on Spectrum Virtualize storage systems
80+
- ibm_svc_manage_flashcopy - Manages FlashCopy mappings on Spectrum Virtualize storage systems
81+
- ibm_svc_manage_ip - Manages IP provisioning on Spectrum Virtualize storage systems
82+
- ibm_svc_manage_migration - Manages volume migration between clusters on Spectrum Virtualize storage systems
83+
- ibm_svc_manage_mirrored_volume - Manages mirrored volumes on Spectrum Virtualize storage systems
84+
- ibm_svc_manage_ownershipgroup - Manages ownership groups on Spectrum Virtualize storage systems
85+
- ibm_svc_manage_portset - Manages IP portset on Spectrum Virtualize storage systems
86+
- ibm_svc_manage_replication - Manages remote copy replication on Spectrum Virtualize storage systems
87+
- ibm_svc_manage_replicationgroup - Manages remote copy consistency groups on Spectrum Virtualize storage systems
88+
- ibm_svc_manage_safeguarded_policy - Manages safeguarded policy configuration on Spectrum Virtualize storage systems
89+
- ibm_svc_manage_sra - Manages the remote support assistance configuration on Spectrum Virtualize storage systems
90+
- ibm_svc_manage_user - Manages user on Spectrum Virtualize storage systems
91+
- ibm_svc_manage_usergroup - Manages user groups on Spectrum Virtualize storage systems
92+
- ibm_svc_manage_volume - Manages standard volumes on Spectrum Virtualize storage systems
93+
- ibm_svc_manage_volumegroup - Manages volume groups on Spectrum Virtualize storage systems
94+
- ibm_svc_mdisk - Manages MDisks for Spectrum Virtualize storage systems
95+
- ibm_svc_mdiskgrp - Manages pools for Spectrum Virtualize storage systems
96+
- ibm_svc_start_stop_flashcopy - Starts or stops FlashCopy mapping and consistency groups on Spectrum Virtualize storage systems
97+
- ibm_svc_start_stop_replication - Starts or stops remote-copy independent relationships or consistency groups on Spectrum Virtualize storage systems
98+
- ibm_svc_vol_map - Manages volume mapping for Spectrum Virtualize storage systems
99+
- ibm_svcinfo_command - Runs svcinfo CLI command on Spectrum Virtualize storage systems over SSH session
100+
- ibm_svctask_command - Runs svctask CLI command(s) on Spectrum Virtualize storage systems over SSH session
101+
- ibm_sv_manage_ip_partnership - Manages IP partnership configuration on Spectrum Virtualize storage systems
102+
- ibm_sv_manage_provisioning_policy - Manages provisioning policy configuration on Spectrum Virtualize storage systems
103+
- ibm_sv_manage_replication_policy - Manages policy-based replication configuration on Spectrum Virtualize storage systems
104+
- ibm_sv_manage_snapshot - Manages snapshots (mutual consistent images of a volume) on Spectrum Virtualize storage systems
105+
- ibm_sv_manage_snapshotpolicy - Manages snapshot policy configuration on Spectrum Virtualize storage systems
106+
- ibm_sv_manage_SSL_certificate - Exports an existing system certificate on to Spectrum Virtualize storage systems
107+
- ibm_sv_manage_truststore_for_replication - Manages certificate trust stores for replication on Spectrum Virtualize family storage systems
108+
- ibm_sv_switch_replication_direction - Switches the replication direction on Spectrum Virtualize storage systems
104109

105110
### Other Feature Information
106111
- SV Ansible Collection v1.8.0 provides the new 'ibm_svc_complete_initial_setup' module, to complete the automation of Day 0 configuration on Licensed Machine Code (LMC) systems.
@@ -121,7 +126,7 @@ Alternatively, you can add a full namepsace and collection name in the `collecti
121126
The modules in the IBM Spectrum Virtualize Ansible collection leverage REST APIs to connect to the IBM Spectrum Virtualize storage system. This has following limitations:
122127
1. Using the REST APIs to list more than 2000 objects may create a loss of service from the API side, as it automatically restarts due to memory constraints.
123128
2. It is not possible to access REST APIs using an IPv6 address on a cluster.
124-
3. The Ansible collection can run on all IBM Spectrum Virtualize storage versions above 8.1.3, except versions 8.3.1.3 and 8.3.1.4.
129+
3. The Ansible collection can run on all IBM Spectrum Virtualize storage system versions above 8.1.3, except versions 8.3.1.3 and 8.3.1.4.
125130
4. At time of release of the SV Ansible v1.8.0 collection, no module is available for non LMC systems to automate license agreements acceptance, including EULA.
126131
User will be presented with a GUI setup wizard upon user-interface login, whether the Ansible modules have been used for initial configuration or not.
127132

changelogs/changelog.yaml

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,3 +82,24 @@ releases:
8282
- description: Manages snapshot policy configuration on Spectrum Virtualize storage systems
8383
name: ibm_sv_manage_snapshotpolicy
8484
namespace: ''
85+
1.10.0:
86+
release_date: '2022-9-30'
87+
changes:
88+
release_summary: Added new modules for managing provisioning policy and managing policy based replication.
89+
Also added support to use an existing SSL certificate to create mTLS partnership between partner systems.
90+
modules:
91+
- description: Manages provisioning policy on Spectrum Virtualize systems
92+
name: ibm_sv_manage_provisioning_policy
93+
namespace: ''
94+
- description: Manages policy based replication on Spectrum Virtualize systems
95+
name: ibm_sv_manage_replication_policy
96+
namespace: ''
97+
- description: Allows user to switch replication direction in case of DR on Spectrum Virtualize storage systems
98+
name: ibm_sv_switch_replication_direction
99+
namespace: ''
100+
- description: Allows user to export an existing system certificate on Spectrum Virtualize storage systems
101+
name: ibm_sv_manage_SSL_certificate
102+
namespace: ''
103+
- description: Manages the certificates trust store on Spectrum Virtualize storage systems
104+
name: ibm_sv_manage_truststore_for_replication
105+
namespace: ''

galaxy.yml

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,19 +9,17 @@ namespace: ibm
99
name: spectrum_virtualize
1010

1111
# The version of the collection. Must be compatible with semantic versioning
12-
version: 1.9.0
12+
version: 1.10.0
1313

1414
# The path to the Markdown (.md) readme file. This path is relative to the root of the collection
1515
readme: README.md
1616

1717
# A list of the collection's content authors. Can be just the name or in the format 'Full Name <email> (url)
1818
# @nicks:irc/im.site#channel'
1919
authors:
20-
- Peng Wang <wangpww@cn.ibm.com>
2120
- Shilpi Jain <shilpi.jain1@ibm.com>
22-
- Rohit Kumar <rohit.kumar6@ibm.com>
23-
- Sreshtant Bohidar <sreshtant.bohidar@ibm.com>
2421
- Sanjaikumaar M <sanjaikumaar.m@ibm.com>
22+
- Rohit Kumar <rohit.kumar6@ibm.com>
2523

2624

2725
### OPTIONAL but strongly recommended

plugins/module_utils/ibm_svc_utils.py

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,22 @@ def svc_ssh_argument_spec():
5151
)
5252

5353

54+
def strtobool(val):
55+
'''
56+
Converts a string representation to boolean.
57+
58+
This is a built-in function available in python till the version 3.9 under disutils.util
59+
but this has been deprecated in 3.10 and may not be available in future python releases
60+
so adding the source code here.
61+
'''
62+
if val in {'y', 'yes', 't', 'true', 'on', '1'}:
63+
return 1
64+
elif val in {'n', 'no', 'f', 'false', 'off', '0'}:
65+
return 0
66+
else:
67+
raise ValueError("invalid truth value %r" % (val,))
68+
69+
5470
def get_logger(module_name, log_file_name, log_level=logging.INFO):
5571
FORMAT = '%(asctime)s.%(msecs)03d %(levelname)5s %(thread)d %(filename)s:%(funcName)s():%(lineno)s %(message)s'
5672
DATEFORMAT = '%Y-%m-%dT%H:%M:%S'
Lines changed: 158 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,158 @@
1+
#!/usr/bin/python
2+
# -*- coding: utf-8 -*-
3+
4+
# Copyright (C) 2022 IBM CORPORATION
5+
# Author(s): Sanjaikumaar M <sanjaikumaar.m@ibm.com>
6+
#
7+
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
8+
9+
from __future__ import absolute_import, division, print_function
10+
__metaclass__ = type
11+
12+
DOCUMENTATION = '''
13+
---
14+
module: ibm_sv_manage_SSL_certificate
15+
short_description: This module exports existing system-signed certificate on to IBM Spectrum Virtualize family storage systems
16+
version_added: '1.10.0'
17+
description:
18+
- Only existing system-signed certificates can be exported. External authority certificate generation is not supported.
19+
options:
20+
clustername:
21+
description:
22+
- The hostname or management IP of the Spectrum Virtualize storage system.
23+
required: true
24+
type: str
25+
domain:
26+
description:
27+
- Domain for the Spectrum Virtualize storage system.
28+
- Valid when the hostname is used for the parameter I(clustername).
29+
type: str
30+
username:
31+
description:
32+
- REST API username for the Spectrum Virtualize storage system.
33+
- The parameters I(username) and I(password) are required if not using I(token) to authenticate a user.
34+
type: str
35+
password:
36+
description:
37+
- REST API password for the Spectrum Virtualize storage system.
38+
- The parameters I(username) and I(password) are required if not using I(token) to authenticate a user.
39+
type: str
40+
token:
41+
description:
42+
- The authentication token to verify a user on the Spectrum Virtualize storage system.
43+
- To generate a token, use the M(ibm.spectrum_virtualize.ibm_svc_auth) module.
44+
type: str
45+
log_path:
46+
description:
47+
- Path of debug log file.
48+
type: str
49+
certificate_type:
50+
description:
51+
- Specify the certificate type to be exported.
52+
choices: [ 'system' ]
53+
default: 'system'
54+
type: str
55+
validate_certs:
56+
description:
57+
- Validates certification.
58+
default: false
59+
type: bool
60+
author:
61+
- Sanjaikumaar M(@sanjaikumaar)
62+
notes:
63+
- This module supports C(check_mode).
64+
'''
65+
66+
EXAMPLES = '''
67+
- name: Export SSL certificate internally
68+
ibm_sv_manage_SSL_certificate:
69+
clustername: "x.x.x.x"
70+
username: "username"
71+
password: "password"
72+
certificate_type: "system"
73+
'''
74+
75+
RETURN = '''#'''
76+
77+
from traceback import format_exc
78+
from ansible.module_utils.basic import AnsibleModule
79+
from ansible_collections.ibm.spectrum_virtualize.plugins.module_utils.ibm_svc_utils import (
80+
IBMSVCRestApi, svc_argument_spec,
81+
get_logger
82+
)
83+
from ansible.module_utils._text import to_native
84+
85+
86+
class IBMSVSSLCertificate:
87+
88+
def __init__(self):
89+
argument_spec = svc_argument_spec()
90+
argument_spec.update(
91+
dict(
92+
certificate_type=dict(
93+
type='str',
94+
choices=['system'],
95+
default='system'
96+
)
97+
)
98+
)
99+
100+
self.module = AnsibleModule(argument_spec=argument_spec,
101+
supports_check_mode=True)
102+
# Default parameters
103+
self.certificate_type = self.module.params['certificate_type']
104+
105+
# logging setup
106+
self.log_path = self.module.params['log_path']
107+
log = get_logger(self.__class__.__name__, self.log_path)
108+
self.log = log.info
109+
110+
# Dynamic variables
111+
self.changed = False
112+
self.msg = ''
113+
114+
self.restapi = IBMSVCRestApi(
115+
module=self.module,
116+
clustername=self.module.params['clustername'],
117+
domain=self.module.params['domain'],
118+
username=self.module.params['username'],
119+
password=self.module.params['password'],
120+
validate_certs=self.module.params['validate_certs'],
121+
log_path=self.log_path,
122+
token=self.module.params['token']
123+
)
124+
125+
def export_cert(self):
126+
if self.module.check_mode:
127+
self.changed = True
128+
return
129+
130+
self.restapi.svc_run_command('chsystemcert', cmdopts=None, cmdargs=['-export'])
131+
self.log('Certificate exported')
132+
self.changed = True
133+
134+
def apply(self):
135+
if self.certificate_type == 'system':
136+
self.export_cert()
137+
self.msg = 'Certificate exported.'
138+
139+
if self.module.check_mode:
140+
self.msg = 'skipping changes due to check mode.'
141+
142+
self.module.exit_json(
143+
changed=self.changed,
144+
msg=self.msg
145+
)
146+
147+
148+
def main():
149+
v = IBMSVSSLCertificate()
150+
try:
151+
v.apply()
152+
except Exception as e:
153+
v.log('Exception in apply(): \n%s', format_exc())
154+
v.module.fail_json(msg='Module failed. Error [%s].' % to_native(e))
155+
156+
157+
if __name__ == '__main__':
158+
main()

0 commit comments

Comments
 (0)