From a484b7bb06aecf71df322e20f10809c71d9b1dc9 Mon Sep 17 00:00:00 2001 From: Pavan-Mudunuri Date: Mon, 26 Jun 2023 11:33:51 +0530 Subject: [PATCH 1/4] Ansible modules for PowerStore release version 2.0.0 --- .ansible-lint | 5 + .github/.ansible-lint | 5 + .github/workflows/ansible-test.yml | 49 +- CHANGELOG.rst | 15 + README.md | 93 +- changelogs/.plugin-cache.yaml | 19 +- changelogs/changelog.yaml | 11 + docs/CONTRIBUTING.md | 8 +- docs/INSTALLATION.md | 4 +- docs/ISSUE_TRIAGE.md | 2 +- docs/MAINTAINER_GUIDE.md | 2 +- docs/Release Notes.md | 27 +- docs/SECURITY.md | 2 +- docs/modules/certificate.rst | 33 +- docs/modules/cluster.rst | 71 +- docs/modules/dns.rst | 29 +- docs/modules/email.rst | 61 +- docs/modules/filesystem.rst | 29 +- docs/modules/filesystem_snapshot.rst | 27 +- docs/modules/host.rst | 61 +- docs/modules/hostgroup.rst | 43 +- docs/modules/info.rst | 335 +++++-- docs/modules/job.rst | 15 +- docs/modules/ldap_account.rst | 27 +- docs/modules/ldap_domain.rst | 51 +- docs/modules/local_user.rst | 37 +- docs/modules/nasserver.rst | 29 +- docs/modules/network.rst | 37 +- docs/modules/nfs.rst | 47 +- docs/modules/ntp.rst | 29 +- docs/modules/protectionpolicy.rst | 45 +- docs/modules/quota.rst | 55 +- docs/modules/remote_support.rst | 77 +- docs/modules/remote_support_contact.rst | 31 +- docs/modules/remotesystem.rst | 59 +- docs/modules/replicationrule.rst | 39 +- docs/modules/replicationsession.rst | 49 +- docs/modules/role.rst | 21 +- docs/modules/security_config.rst | 17 +- docs/modules/smbshare.rst | 89 +- docs/modules/smtp_config.rst | 31 +- docs/modules/snapshot.rst | 35 +- docs/modules/snapshotrule.rst | 51 +- docs/modules/storage_container.rst | 396 ++++++++ docs/modules/vcenter.rst | 21 +- docs/modules/volume.rst | 95 +- docs/modules/volumegroup.rst | 59 +- galaxy.yml | 12 +- meta/runtime.yml | 42 +- playbooks/modules/certificate.yml | 78 ++ playbooks/modules/cluster.yml | 190 ++++ playbooks/modules/dns.yml | 43 + playbooks/modules/email.yml | 99 ++ playbooks/modules/filesystem.yml | 231 +++++ playbooks/modules/filesystem_snapshot.yml | 91 ++ playbooks/modules/host.yml | 232 +++++ playbooks/modules/hostgroup.yml | 132 +++ playbooks/modules/info.yml | 478 ++++++++++ playbooks/modules/job.yml | 18 + playbooks/modules/ldap_account.yml | 127 +++ playbooks/modules/ldap_domain.yml | 238 +++++ playbooks/modules/local_user.yml | 98 ++ playbooks/modules/nasserver.yml | 133 +++ playbooks/modules/network.yml | 122 +++ playbooks/modules/nfs.yml | 182 ++++ playbooks/modules/ntp.yml | 67 ++ playbooks/modules/protectionpolicy.yml | 165 ++++ playbooks/modules/quota.yml | 306 +++++++ playbooks/modules/remote_support.yml | 94 ++ playbooks/modules/remote_support_contact.yml | 43 + playbooks/modules/remotesystem.yml | 90 ++ playbooks/modules/replicationrule.yml | 108 +++ playbooks/modules/replicationsession.yml | 98 ++ playbooks/modules/role.yml | 28 + playbooks/modules/security_config.yml | 39 + playbooks/modules/smbshare.yml | 164 ++++ playbooks/modules/smtp_config.yml | 51 ++ playbooks/modules/snapshot.yml | 205 +++++ playbooks/modules/snapshotrule.yml | 218 +++++ playbooks/modules/storage_container.yml | 236 +++++ playbooks/modules/vcenter.yml | 91 ++ playbooks/modules/volume.yml | 308 +++++++ playbooks/modules/volumegroup.yml | 187 ++++ plugins/doc_fragments/powerstore.py | 25 +- plugins/module_utils/storage/dell/utils.py | 19 +- plugins/modules/certificate.py | 26 +- plugins/modules/cluster.py | 101 +- plugins/modules/dns.py | 22 +- plugins/modules/email.py | 48 +- plugins/modules/filesystem.py | 20 +- plugins/modules/filesystem_snapshot.py | 20 +- plugins/modules/host.py | 50 +- plugins/modules/hostgroup.py | 35 +- plugins/modules/info.py | 379 +++++--- plugins/modules/job.py | 6 +- plugins/modules/ldap_account.py | 18 +- plugins/modules/ldap_domain.py | 44 +- plugins/modules/local_user.py | 30 +- plugins/modules/nasserver.py | 22 +- plugins/modules/network.py | 44 +- plugins/modules/nfs.py | 41 +- plugins/modules/ntp.py | 22 +- plugins/modules/protectionpolicy.py | 35 +- plugins/modules/quota.py | 59 +- plugins/modules/remote_support.py | 66 +- plugins/modules/remote_support_contact.py | 22 +- plugins/modules/remotesystem.py | 46 +- plugins/modules/replicationrule.py | 38 +- plugins/modules/replicationsession.py | 341 ++++--- plugins/modules/role.py | 14 +- plugins/modules/security_config.py | 12 +- plugins/modules/smbshare.py | 86 +- plugins/modules/smtp_config.py | 22 +- plugins/modules/snapshot.py | 28 +- plugins/modules/snapshotrule.py | 52 +- plugins/modules/storage_container.py | 865 ++++++++++++++++++ plugins/modules/vcenter.py | 12 +- plugins/modules/volume.py | 138 ++- plugins/modules/volumegroup.py | 48 +- tests/sanity/ignore-2.13.txt | 13 + tests/sanity/ignore-2.14.txt | 13 + .../{ignore-2.12.txt => ignore-2.15.txt} | 17 +- .../plugins/module_utils/mock_fail_json.py | 21 + .../plugins/module_utils/mock_info_api.py | 4 +- .../mock_replicationsession_api.py | 236 +++-- .../mock_storage_container_api.py | 160 ++++ .../plugins/module_utils/mock_volume_api.py | 4 +- tests/unit/plugins/modules/test_cluster.py | 2 - tests/unit/plugins/modules/test_dns.py | 2 - tests/unit/plugins/modules/test_filesystem.py | 2 - .../modules/test_filesystem_snapshot.py | 2 - tests/unit/plugins/modules/test_host.py | 2 - tests/unit/plugins/modules/test_hostgroup.py | 2 - tests/unit/plugins/modules/test_info.py | 22 +- tests/unit/plugins/modules/test_job.py | 2 - .../unit/plugins/modules/test_ldap_account.py | 2 - .../unit/plugins/modules/test_ldap_domain.py | 2 - tests/unit/plugins/modules/test_local_user.py | 2 - tests/unit/plugins/modules/test_nasserver.py | 2 - tests/unit/plugins/modules/test_network.py | 2 - tests/unit/plugins/modules/test_nfs.py | 2 - tests/unit/plugins/modules/test_ntp.py | 2 - .../plugins/modules/test_protectionpolicy.py | 2 - tests/unit/plugins/modules/test_quota.py | 2 - .../plugins/modules/test_remote_support.py | 2 - .../modules/test_remote_support_contact.py | 2 - .../unit/plugins/modules/test_remotesystem.py | 2 - .../plugins/modules/test_replicationrule.py | 2 - .../modules/test_replicationsession.py | 488 +++++++--- tests/unit/plugins/modules/test_role.py | 2 - .../plugins/modules/test_security_config.py | 2 - tests/unit/plugins/modules/test_smbshare.py | 2 - .../unit/plugins/modules/test_smtp_config.py | 2 - tests/unit/plugins/modules/test_snapshot.py | 2 - .../unit/plugins/modules/test_snapshotrule.py | 2 - .../plugins/modules/test_storage_container.py | 331 +++++++ tests/unit/plugins/modules/test_vcenter.py | 2 - tests/unit/plugins/modules/test_volume.py | 5 +- .../unit/plugins/modules/test_volumegroup.py | 2 - 159 files changed, 9690 insertions(+), 1953 deletions(-) create mode 100644 .ansible-lint create mode 100644 .github/.ansible-lint create mode 100644 docs/modules/storage_container.rst create mode 100644 playbooks/modules/certificate.yml create mode 100644 playbooks/modules/cluster.yml create mode 100644 playbooks/modules/dns.yml create mode 100644 playbooks/modules/email.yml create mode 100644 playbooks/modules/filesystem.yml create mode 100644 playbooks/modules/filesystem_snapshot.yml create mode 100644 playbooks/modules/host.yml create mode 100644 playbooks/modules/hostgroup.yml create mode 100644 playbooks/modules/info.yml create mode 100644 playbooks/modules/job.yml create mode 100644 playbooks/modules/ldap_account.yml create mode 100644 playbooks/modules/ldap_domain.yml create mode 100644 playbooks/modules/local_user.yml create mode 100644 playbooks/modules/nasserver.yml create mode 100644 playbooks/modules/network.yml create mode 100644 playbooks/modules/nfs.yml create mode 100644 playbooks/modules/ntp.yml create mode 100644 playbooks/modules/protectionpolicy.yml create mode 100644 playbooks/modules/quota.yml create mode 100644 playbooks/modules/remote_support.yml create mode 100644 playbooks/modules/remote_support_contact.yml create mode 100644 playbooks/modules/remotesystem.yml create mode 100644 playbooks/modules/replicationrule.yml create mode 100644 playbooks/modules/replicationsession.yml create mode 100644 playbooks/modules/role.yml create mode 100644 playbooks/modules/security_config.yml create mode 100644 playbooks/modules/smbshare.yml create mode 100644 playbooks/modules/smtp_config.yml create mode 100644 playbooks/modules/snapshot.yml create mode 100644 playbooks/modules/snapshotrule.yml create mode 100644 playbooks/modules/storage_container.yml create mode 100644 playbooks/modules/vcenter.yml create mode 100644 playbooks/modules/volume.yml create mode 100644 playbooks/modules/volumegroup.yml create mode 100644 plugins/modules/storage_container.py rename tests/sanity/{ignore-2.12.txt => ignore-2.15.txt} (79%) create mode 100644 tests/unit/plugins/module_utils/mock_fail_json.py create mode 100644 tests/unit/plugins/module_utils/mock_storage_container_api.py create mode 100644 tests/unit/plugins/modules/test_storage_container.py diff --git a/.ansible-lint b/.ansible-lint new file mode 100644 index 0000000..14f922f --- /dev/null +++ b/.ansible-lint @@ -0,0 +1,5 @@ +exclude_paths: + - changelogs/ + - .github/ + - meta/ + - roles/powerflex_sdc/molecule/ diff --git a/.github/.ansible-lint b/.github/.ansible-lint new file mode 100644 index 0000000..14f922f --- /dev/null +++ b/.github/.ansible-lint @@ -0,0 +1,5 @@ +exclude_paths: + - changelogs/ + - .github/ + - meta/ + - roles/powerflex_sdc/molecule/ diff --git a/.github/workflows/ansible-test.yml b/.github/workflows/ansible-test.yml index 684e0d3..fa3b247 100644 --- a/.github/workflows/ansible-test.yml +++ b/.github/workflows/ansible-test.yml @@ -15,7 +15,7 @@ jobs: strategy: fail-fast: false matrix: - ansible-version: [stable-2.12] + ansible-version: [stable-2.13] steps: - name: Check out code uses: actions/checkout@v2 @@ -50,11 +50,9 @@ jobs: fail-fast: false matrix: python-version: ["3.9", "3.10", "3.11"] - ansible-version: [stable-2.12, stable-2.13, stable-2.14] + ansible-version: [stable-2.13, stable-2.14, stable-2.15] exclude: # Python 3.11 is supported only from ansible-core 2.14 onwards - - python-version: "3.11" - ansible-version: stable-2.12 - python-version: "3.11" ansible-version: stable-2.13 @@ -93,7 +91,7 @@ jobs: strategy: fail-fast: false matrix: - ansible-version: [stable-2.12, stable-2.13, stable-2.14] + ansible-version: [stable-2.13, stable-2.14, stable-2.15] steps: - name: Set up Python 3.9 @@ -121,3 +119,44 @@ jobs: - name: Run sanity tests run: ansible-test sanity --docker -v --color working-directory: /home/runner/.ansible/collections/ansible_collections/dellemc/powerstore + + lint: + name: Ansible lint + runs-on: ubuntu-latest + needs: [build] + strategy: + fail-fast: false + matrix: + python-version: ["3.9", "3.10", "3.11"] + ansible-version: [stable-2.13, stable-2.14, stable-2.15] + + steps: + # Important: This sets up your GITHUB_WORKSPACE environment variable + - name: Checkout the source code + uses: actions/checkout@v3 + with: + fetch-depth: 0 # needed for progressive mode to work + + - name: Set up Python ${{ matrix.python-version }} + uses: actions/setup-python@v1 + with: + python-version: ${{ matrix.python-version }} + + - name: Install ansible (${{ matrix.ansible-version }}) version + run: pip install https://github.com/ansible/ansible/archive/${{ matrix.ansible-version }}.tar.gz --disable-pip-version-check + + - name: Install ansible lint + run: pip install ansible-lint --disable-pip-version-check + + - name: Download migrated collection artifacts + uses: actions/download-artifact@v1 + with: + name: collection + path: .cache/collection-tarballs + + - name: Install collection build + run: ansible-galaxy collection install .cache/collection-tarballs/*.tar.gz + + - name: Run Ansible lint + run: ansible-lint --show-relpath + working-directory: /home/runner/work/ansible-powerstore/ansible-powerstore diff --git a/CHANGELOG.rst b/CHANGELOG.rst index 283ac72..cabef71 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -5,6 +5,21 @@ Dellemc.Powerstore Change Logs .. contents:: Topics +v2.0.0 +====== + +Minor Changes +------------- + +- Added support for manual appliance selection in volume module. +- Added support for replication group in replication session module. +- Info module is enhanced to list storage containers and replication groups. + +New Modules +----------- + +- dellemc.powerstore.storage_container - Manage storage container for PowerStore + v1.9.0 ====== diff --git a/README.md b/README.md index ad4935c..0ad665f 100644 --- a/README.md +++ b/README.md @@ -1,32 +1,32 @@ # Ansible Modules for Dell Technologies PowerStore The Ansible Modules for Dell Technologies (Dell) PowerStore allow Data Center and IT administrators to use RedHat Ansible to automate and orchestrate the configuration and management of Dell PowerStore arrays. -The capabilities of the Ansible modules are managing volumes, volume groups, hosts, host groups, snapshots, snapshot rules, replication rules, replication sessions, protection policies, file systems, NAS servers, SMB shares, user and tree quotas, file system snapshots, NFS exports, Clusters, Networks, Local users, Jobs, Roles, Certificates, Remote systems, security configuration, DNS server, Email notification destination, NTP server, Remote support configuration, Remote support contacts, SMTP configuration, LDAP accounts and LDAP domain configuration. It also allows gathering high level info from the array. The options available for each are list, show, create, modify and delete. These tasks can be executed by running simple playbooks written in yaml syntax. The modules are written so that all the operations are idempotent, so making multiple identical requests has the same effect as making a single request. +The capabilities of the Ansible modules are managing volumes, volume groups, vCenters, hosts, host groups, snapshots, snapshot rules, replication rules, replication sessions, protection policies, file systems, NAS servers, SMB shares, user and tree quotas, file system snapshots, NFS exports, Clusters, Networks, Local users, Jobs, Roles, Certificates, Remote systems, security configuration, DNS server, Email notification destination, NTP server, Remote support configuration, Remote support contacts, SMTP configuration, LDAP accounts, LDAP domain configuration and storage containers. It also allows gathering high level info from the array. The options available for each are list, show, create, modify and delete. These tasks can be executed by running simple playbooks written in yaml syntax. The modules are written so that all the operations are idempotent, so making multiple identical requests has the same effect as making a single request. ## Table of contents -* [Code of conduct](https://github.com/dell/ansible-powerstore/blob/1.9.0/docs/CODE_OF_CONDUCT.md) -* [Maintainer guide](https://github.com/dell/ansible-powerstore/blob/1.9.0/docs/MAINTAINER_GUIDE.md) -* [Committer guide](https://github.com/dell/ansible-powerstore/blob/1.9.0/docs/COMMITTER_GUIDE.md) -* [Contributing guide](https://github.com/dell/ansible-powerstore/blob/1.9.0/docs/CONTRIBUTING.md) -* [Branching strategy](https://github.com/dell/ansible-powerstore/blob/1.9.0/docs/BRANCHING.md) -* [List of adopters](https://github.com/dell/ansible-powerstore/blob/1.9.0/docs/ADOPTERS.md) -* [Maintainers](https://github.com/dell/ansible-powerstore/blob/1.9.0/docs/MAINTAINERS.md) -* [Support](https://github.com/dell/ansible-powerstore/blob/1.9.0/docs/SUPPORT.md) +* [Code of conduct](https://github.com/dell/ansible-powerstore/blob/2.0.0/docs/CODE_OF_CONDUCT.md) +* [Maintainer guide](https://github.com/dell/ansible-powerstore/blob/2.0.0/docs/MAINTAINER_GUIDE.md) +* [Committer guide](https://github.com/dell/ansible-powerstore/blob/2.0.0/docs/COMMITTER_GUIDE.md) +* [Contributing guide](https://github.com/dell/ansible-powerstore/blob/2.0.0/docs/CONTRIBUTING.md) +* [Branching strategy](https://github.com/dell/ansible-powerstore/blob/2.0.0/docs/BRANCHING.md) +* [List of adopters](https://github.com/dell/ansible-powerstore/blob/2.0.0/docs/ADOPTERS.md) +* [Maintainers](https://github.com/dell/ansible-powerstore/blob/2.0.0/docs/MAINTAINERS.md) +* [Support](https://github.com/dell/ansible-powerstore/blob/2.0.0/docs/SUPPORT.md) * [License](#license) -* [Security](https://github.com/dell/ansible-powerstore/blob/1.9.0/docs/SECURITY.md) +* [Security](https://github.com/dell/ansible-powerstore/blob/2.0.0/docs/SECURITY.md) * [Prerequisites](#prerequisites) * [List of Ansible modules for Dell PowerStore](#list-of-ansible-modules-for-dell-powerstore) * [Installation and execution of Ansible modules for Dell PowerStore](#installation-and-execution-of-ansible-modules-for-dell-powerstore) * [Maintenance](#maintenance) ## License -The Ansible collection for PowerStore is released and licensed under the GPL-3.0 license. See [LICENSE](https://github.com/dell/ansible-powerstore/blob/1.9.0/LICENSE) for the full terms. Ansible modules and modules utilities that are part of the Ansible collection for PowerStore are released and licensed under the Apache 2.0 license. See [MODULE-LICENSE](https://github.com/dell/ansible-powerstore/blob/1.9.0/MODULE-LICENSE) for the full terms. +The Ansible collection for PowerStore is released and licensed under the GPL-3.0 license. See [LICENSE](https://github.com/dell/ansible-powerstore/blob/2.0.0/LICENSE) for the full terms. Ansible modules and modules utilities that are part of the Ansible collection for PowerStore are released and licensed under the Apache 2.0 license. See [MODULE-LICENSE](https://github.com/dell/ansible-powerstore/blob/2.0.0/MODULE-LICENSE) for the full terms. ## Prerequisites | **Ansible Modules** | **PowerStore Version** | **SDK version** | **Python version** | **Ansible** | |---------------------|-----------------------|-----------------|--------------------|--------------------------| -| v1.9.0 | 2.1.x
3.0.x
3.2.x | 1.10.0 | 3.9.x
3.10.x
3.11.x | 2.12
2.13
2.14 | +| v2.0.0 | 3.0.x
3.2.x
3.5.x | 2.0.0 | 3.9.x
3.10.x
3.11.x | 2.13
2.14
2.15 | * Please follow PyPowerStore installation instructions on [PyPowerStore Documentation](https://github.com/dell/python-powerstore) @@ -35,42 +35,43 @@ The Ansible collection for PowerStore is released and licensed under the GPL-3.0 The modules are written in such a way that all requests are idempotent and hence fault-tolerant. It essentially means that the result of a successfully performed request is independent of the number of times it is executed. ## List of Ansible Modules for Dell PowerStore -* [Volume module](https://github.com/dell/ansible-powerstore/blob/1.9.0/docs/modules/volume.rst) -* [Volume group module](https://github.com/dell/ansible-powerstore/blob/1.9.0/docs/modules/volumegroup.rst) -* [Host module](https://github.com/dell/ansible-powerstore/blob/1.9.0/docs/modules/host.rst) -* [Host group module](https://github.com/dell/ansible-powerstore/blob/1.9.0/docs/modules/hostgroup.rst) -* [Snapshot module](https://github.com/dell/ansible-powerstore/blob/1.9.0/docs/modules/snapshot.rst) -* [Snapshot rule module](https://github.com/dell/ansible-powerstore/blob/1.9.0/docs/modules/snapshotrule.rst) -* [Replication rule module](https://github.com/dell/ansible-powerstore/blob/1.9.0/docs/modules/replicationrule.rst) -* [Replication session module](https://github.com/dell/ansible-powerstore/blob/1.9.0/docs/modules/replicationsession.rst) -* [Protection policy module](https://github.com/dell/ansible-powerstore/blob/1.9.0/docs/modules/protectionpolicy.rst) -* [Info module](https://github.com/dell/ansible-powerstore/blob/1.9.0/docs/modules/info.rst) -* [File system module](https://github.com/dell/ansible-powerstore/blob/1.9.0/docs/modules/filesystem.rst) -* [NAS server module](https://github.com/dell/ansible-powerstore/blob/1.9.0/docs/modules/nasserver.rst) -* [SMB share module](https://github.com/dell/ansible-powerstore/blob/1.9.0/docs/modules/smbshare.rst) -* [Quota module](https://github.com/dell/ansible-powerstore/blob/1.9.0/docs/modules/quota.rst) -* [File system snapshot module](https://github.com/dell/ansible-powerstore/blob/1.9.0/docs/modules/filesystem_snapshot.rst) -* [NFS export module](https://github.com/dell/ansible-powerstore/blob/1.9.0/docs/modules/nfs.rst) -* [Cluster module](https://github.com/dell/ansible-powerstore/blob/1.9.0/docs/modules/cluster.rst) -* [Network module](https://github.com/dell/ansible-powerstore/blob/1.9.0/docs/modules/network.rst) -* [Local user module](https://github.com/dell/ansible-powerstore/blob/1.9.0/docs/modules/local_user.rst) -* [Role module](https://github.com/dell/ansible-powerstore/blob/1.9.0/docs/modules/role.rst) -* [Job module](https://github.com/dell/ansible-powerstore/blob/1.9.0/docs/modules/job.rst) -* [Certificate module](https://github.com/dell/ansible-powerstore/blob/1.9.0/docs/modules/certificate.rst) -* [Remote system module](https://github.com/dell/ansible-powerstore/blob/1.9.0/docs/modules/remotesystem.rst) -* [Security config module](https://github.com/dell/ansible-powerstore/blob/1.9.0/docs/modules/security_config.rst) -* [DNS module](https://github.com/dell/ansible-powerstore/blob/1.9.0/docs/modules/dns.rst) -* [Email module](https://github.com/dell/ansible-powerstore/blob/1.9.0/docs/modules/email.rst) -* [NTP module](https://github.com/dell/ansible-powerstore/blob/1.9.0/docs/modules/ntp.rst) -* [Remote support module](https://github.com/dell/ansible-powerstore/blob/1.9.0/docs/modules/remote_support.rst) -* [Remote support contact module](https://github.com/dell/ansible-powerstore/blob/1.9.0/docs/modules/remote_support_contact.rst) -* [SMTP config module](https://github.com/dell/ansible-powerstore/blob/1.9.0/docs/modules/smtp_config.rst) -* [LDAP Account module](https://github.com/dell/ansible-powerstore/blob/1.9.0/docs/modules/ldap_account.rst) -* [LDAP Domain module](https://github.com/dell/ansible-powerstore/blob/1.9.0/docs/modules/ldap_domain.rst) -* [vCenter module](https://github.com/dell/ansible-powerstore/blob/1.9.0/docs/modules/vcenter.rst) +* [Volume module](https://github.com/dell/ansible-powerstore/blob/2.0.0/docs/modules/volume.rst) +* [Volume group module](https://github.com/dell/ansible-powerstore/blob/2.0.0/docs/modules/volumegroup.rst) +* [Host module](https://github.com/dell/ansible-powerstore/blob/2.0.0/docs/modules/host.rst) +* [Host group module](https://github.com/dell/ansible-powerstore/blob/2.0.0/docs/modules/hostgroup.rst) +* [Snapshot module](https://github.com/dell/ansible-powerstore/blob/2.0.0/docs/modules/snapshot.rst) +* [Snapshot rule module](https://github.com/dell/ansible-powerstore/blob/2.0.0/docs/modules/snapshotrule.rst) +* [Replication rule module](https://github.com/dell/ansible-powerstore/blob/2.0.0/docs/modules/replicationrule.rst) +* [Replication session module](https://github.com/dell/ansible-powerstore/blob/2.0.0/docs/modules/replicationsession.rst) +* [Protection policy module](https://github.com/dell/ansible-powerstore/blob/2.0.0/docs/modules/protectionpolicy.rst) +* [Info module](https://github.com/dell/ansible-powerstore/blob/2.0.0/docs/modules/info.rst) +* [File system module](https://github.com/dell/ansible-powerstore/blob/2.0.0/docs/modules/filesystem.rst) +* [NAS server module](https://github.com/dell/ansible-powerstore/blob/2.0.0/docs/modules/nasserver.rst) +* [SMB share module](https://github.com/dell/ansible-powerstore/blob/2.0.0/docs/modules/smbshare.rst) +* [Quota module](https://github.com/dell/ansible-powerstore/blob/2.0.0/docs/modules/quota.rst) +* [File system snapshot module](https://github.com/dell/ansible-powerstore/blob/2.0.0/docs/modules/filesystem_snapshot.rst) +* [NFS export module](https://github.com/dell/ansible-powerstore/blob/2.0.0/docs/modules/nfs.rst) +* [Cluster module](https://github.com/dell/ansible-powerstore/blob/2.0.0/docs/modules/cluster.rst) +* [Network module](https://github.com/dell/ansible-powerstore/blob/2.0.0/docs/modules/network.rst) +* [Local user module](https://github.com/dell/ansible-powerstore/blob/2.0.0/docs/modules/local_user.rst) +* [Role module](https://github.com/dell/ansible-powerstore/blob/2.0.0/docs/modules/role.rst) +* [Job module](https://github.com/dell/ansible-powerstore/blob/2.0.0/docs/modules/job.rst) +* [Certificate module](https://github.com/dell/ansible-powerstore/blob/2.0.0/docs/modules/certificate.rst) +* [Remote system module](https://github.com/dell/ansible-powerstore/blob/2.0.0/docs/modules/remotesystem.rst) +* [Security config module](https://github.com/dell/ansible-powerstore/blob/2.0.0/docs/modules/security_config.rst) +* [DNS module](https://github.com/dell/ansible-powerstore/blob/2.0.0/docs/modules/dns.rst) +* [Email module](https://github.com/dell/ansible-powerstore/blob/2.0.0/docs/modules/email.rst) +* [NTP module](https://github.com/dell/ansible-powerstore/blob/2.0.0/docs/modules/ntp.rst) +* [Remote support module](https://github.com/dell/ansible-powerstore/blob/2.0.0/docs/modules/remote_support.rst) +* [Remote support contact module](https://github.com/dell/ansible-powerstore/blob/2.0.0/docs/modules/remote_support_contact.rst) +* [SMTP config module](https://github.com/dell/ansible-powerstore/blob/2.0.0/docs/modules/smtp_config.rst) +* [LDAP Account module](https://github.com/dell/ansible-powerstore/blob/2.0.0/docs/modules/ldap_account.rst) +* [LDAP Domain module](https://github.com/dell/ansible-powerstore/blob/2.0.0/docs/modules/ldap_domain.rst) +* [vCenter module](https://github.com/dell/ansible-powerstore/blob/2.0.0/docs/modules/vcenter.rst) +* [Storage container module](https://github.com/dell/ansible-powerstore/blob/2.0.0/docs/modules/storage_container.rst) ## Installation and execution of Ansible modules for Dell PowerStore -The installation and execution steps of Ansible modules for Dell PowerStore can be found [here](https://github.com/dell/ansible-powerstore/blob/1.9.0/docs/INSTALLATION.md) +The installation and execution steps of Ansible modules for Dell PowerStore can be found [here](https://github.com/dell/ansible-powerstore/blob/2.0.0/docs/INSTALLATION.md) ## Maintenance Ansible Modules for Dell Technologies PowerStore deprecation cycle is aligned with [Ansible](https://docs.ansible.com/ansible/latest/dev_guide/module_lifecycle.html). \ No newline at end of file diff --git a/changelogs/.plugin-cache.yaml b/changelogs/.plugin-cache.yaml index 594f8ad..90de32e 100644 --- a/changelogs/.plugin-cache.yaml +++ b/changelogs/.plugin-cache.yaml @@ -6,6 +6,7 @@ plugins: callback: {} cliconf: {} connection: {} + filter: {} httpapi: {} inventory: {} lookup: {} @@ -160,16 +161,21 @@ plugins: name: snapshotrule namespace: '' version_added: 1.0.0 + storage_container: + description: Manage storage container for PowerStore + name: storage_container + namespace: '' + version_added: 2.0.0 + vcenter: + description: Manage vCenter on a PowerStore storage system + name: vcenter + namespace: '' + version_added: 1.9.0 volume: description: Manage volumes on a PowerStore storage system name: volume namespace: '' version_added: 1.0.0 - vcenter: - description: Manage vCenter on a PowerStore Storage System - name: volume - namespace: '' - version_added: 1.9.0 volumegroup: description: Manage volume groups on a PowerStore Storage System name: volumegroup @@ -178,5 +184,6 @@ plugins: netconf: {} shell: {} strategy: {} + test: {} vars: {} -version: 1.9.0 +version: 2.0.0 diff --git a/changelogs/changelog.yaml b/changelogs/changelog.yaml index 0d337c2..bf825bc 100644 --- a/changelogs/changelog.yaml +++ b/changelogs/changelog.yaml @@ -186,3 +186,14 @@ releases: name: vcenter namespace: '' release_date: '2023-03-31' + 2.0.0: + changes: + minor_changes: + - Added support for manual appliance selection in volume module. + - Added support for replication group in replication session module. + - Info module is enhanced to list storage containers and replication group. + modules: + - description: Manage Storage Containers on Dell PowerStore + name: storage_container + namespace: '' + release_date: '2023-06-30' diff --git a/docs/CONTRIBUTING.md b/docs/CONTRIBUTING.md index 3eff29d..d7bd183 100644 --- a/docs/CONTRIBUTING.md +++ b/docs/CONTRIBUTING.md @@ -10,7 +10,7 @@ You may obtain a copy of the License at # How to contribute -Become one of the contributors to this project! We thrive to build a welcoming and open community for anyone who wants to use the project or contribute to it. There are just a few small guidelines you need to follow. To help us create a safe and positive community experience for all, we require all participants to adhere to the [Code of Conduct](https://github.com/dell/ansible-powerstore/blob/1.9.0/docs/CODE_OF_CONDUCT.md). +Become one of the contributors to this project! We thrive to build a welcoming and open community for anyone who wants to use the project or contribute to it. There are just a few small guidelines you need to follow. To help us create a safe and positive community experience for all, we require all participants to adhere to the [Code of Conduct](https://github.com/dell/ansible-powerstore/blob/2.0.0/docs/CODE_OF_CONDUCT.md). ## Table of contents @@ -76,7 +76,7 @@ Triage helps ensure that issues resolve quickly by: If you don't have the knowledge or time to code, consider helping with _issue triage_. The Ansible modules for Dell PowerStore community will thank you for saving them time by spending some of yours. -Read more about the ways you can [Triage issues](https://github.com/dell/ansible-powerstore/blob/1.9.0/docs/ISSUE_TRIAGE.md). +Read more about the ways you can [Triage issues](https://github.com/dell/ansible-powerstore/blob/2.0.0/docs/ISSUE_TRIAGE.md). ## Your first contribution @@ -89,7 +89,7 @@ When you're ready to contribute, it's time to create a pull request. ## Branching -* [Branching Strategy for Ansible modules for Dell PowerStore](https://github.com/dell/ansible-powerstore/blob/1.9.0/docs/BRANCHING.md) +* [Branching Strategy for Ansible modules for Dell PowerStore](https://github.com/dell/ansible-powerstore/blob/2.0.0/docs/BRANCHING.md) ## Signing your commits @@ -144,7 +144,7 @@ Make sure that the title for your pull request uses the same format as the subje ### Quality gates for pull requests -GitHub Actions are used to enforce quality gates when a pull request is created or when any commit is made to the pull request. These GitHub Actions enforce our minimum code quality requirement for any code that get checked into the repository. If any of the quality gates fail, it is expected that the contributor will look into the check log, understand the problem and resolve the issue. If help is needed, please feel free to reach out the maintainers of the project for [support](https://github.com/dell/ansible-powerstore/blob/1.9.0/docs/SUPPORT.md). +GitHub Actions are used to enforce quality gates when a pull request is created or when any commit is made to the pull request. These GitHub Actions enforce our minimum code quality requirement for any code that get checked into the repository. If any of the quality gates fail, it is expected that the contributor will look into the check log, understand the problem and resolve the issue. If help is needed, please feel free to reach out the maintainers of the project for [support](https://github.com/dell/ansible-powerstore/blob/2.0.0/docs/SUPPORT.md). #### Code sanitization diff --git a/docs/INSTALLATION.md b/docs/INSTALLATION.md index 17ddca0..3a398cb 100644 --- a/docs/INSTALLATION.md +++ b/docs/INSTALLATION.md @@ -41,7 +41,7 @@ You may obtain a copy of the License at * Download the latest tar build from any of the available distribution channel [Ansible Galaxy](https://galaxy.ansible.com/dellemc/powerstore) /[Automation Hub](https://console.redhat.com/ansible/automation-hub/repo/published/dellemc/powerstore) and use this command to install the collection anywhere in your system: - ansible-galaxy collection install dellemc-powerstore-1.9.0.tar.gz -p + ansible-galaxy collection install dellemc-powerstore-2.0.0.tar.gz -p * Set the environment variable: @@ -68,7 +68,7 @@ You may obtain a copy of the License at ## Ansible modules execution -The Ansible server must be configured with Python library for PowerStore to run the Ansible playbooks. The [Documents](https://github.com/dell/ansible-powerstore/blob/1.9.0/docs/) provide information on different Ansible modules along with their functions and syntax. The parameters table in the Product Guide provides information on various parameters which needs to be configured before running the modules. +The Ansible server must be configured with Python library for PowerStore to run the Ansible playbooks. The [Documents](https://github.com/dell/ansible-powerstore/blob/2.0.0/docs/) provide information on different Ansible modules along with their functions and syntax. The parameters table in the Product Guide provides information on various parameters which needs to be configured before running the modules. ## SSL certificate validation diff --git a/docs/ISSUE_TRIAGE.md b/docs/ISSUE_TRIAGE.md index 9a7c1f3..cc7289a 100644 --- a/docs/ISSUE_TRIAGE.md +++ b/docs/ISSUE_TRIAGE.md @@ -43,7 +43,7 @@ Should explain what happened, what was expected and how to reproduce it together - Ansible Version: [e.g. 2.14] - Python Version [e.g. 3.11] - - Ansible modules for Dell PowerStore Version: [e.g. 1.9.0] + - Ansible modules for Dell PowerStore Version: [e.g. 2.0.0] - PowerStore SDK version: [e.g. PyPowerStore 1.10.0] - Any other additional information... diff --git a/docs/MAINTAINER_GUIDE.md b/docs/MAINTAINER_GUIDE.md index 558d5fd..f1e8438 100644 --- a/docs/MAINTAINER_GUIDE.md +++ b/docs/MAINTAINER_GUIDE.md @@ -27,7 +27,7 @@ If a candidate is approved, a Maintainer contacts the candidate to invite them t ## Maintainer policies * Lead by example -* Follow the [Code of Conduct](https://github.com/dell/ansible-powerstore/blob/1.9.0/docs/CODE_OF_CONDUCT.md) and the guidelines in the [Contributing](https://github.com/dell/ansible-powerstore/blob/1.9.0/docs/CONTRIBUTING.md) and [Committer](https://github.com/dell/ansible-powerstore/blob/1.9.0/docs/COMMITTER_GUIDE.md) guides +* Follow the [Code of Conduct](https://github.com/dell/ansible-powerstore/blob/2.0.0/docs/CODE_OF_CONDUCT.md) and the guidelines in the [Contributing](https://github.com/dell/ansible-powerstore/blob/2.0.0/docs/CONTRIBUTING.md) and [Committer](https://github.com/dell/ansible-powerstore/blob/2.0.0/docs/COMMITTER_GUIDE.md) guides * Promote a friendly and collaborative environment within our community * Be actively engaged in discussions, answering questions, updating defects, and reviewing pull requests * Criticize code, not people. Ideally, tell the contributor a better way to do what they need. diff --git a/docs/Release Notes.md b/docs/Release Notes.md index 4602e78..b4e6576 100644 --- a/docs/Release Notes.md +++ b/docs/Release Notes.md @@ -1,6 +1,6 @@ **Ansible Modules for Dell Technologies PowerStore** ========================================= -### Release Notes 1.9.0 +### Release Notes 2.0.0 > © 2022 Dell Inc. or its subsidiaries. All rights reserved. Dell, > and other trademarks are trademarks of Dell Inc. or its @@ -28,7 +28,7 @@ Table 1. Revision history | Revision | Date | Description | |----------|------------|-----------------------------------------------------------| -| 01 | March 2023 | Current release of Ansible Modules for Dell PowerStore 1.9.0 | +| 01 | June 2023 | Current release of Ansible Modules for Dell PowerStore 2.0.0 | Product Description ------------------- @@ -38,14 +38,16 @@ New features & enhancements --------------------------- Along with the previous release deliverables, this release supports these features: -- Volume module is enhanced to support app_type, and app_type_other. -- Info module is enhanced to list vCenters and virtual volumes. -- Filesystem module is enhanced to support config_type, flr_attributes, is_async_mtime_enabled, file_events_publishing_mode and host_io_size. -- vCenter module supports the following functionalities: - - Get details of vCenter. - - Add vCenter. - - Modify attributes of vCenter. - - Remove vCenter. +- Volume module is enhanced to support manual appliance selection. +- Info module is enhanced to list storage containers and replication group. +- Replication session module is enhanced to support replication group. +- Storage container module supports the following functionalities: + - Create storage container. + - Create storage container destination. + - Delete storage container. + - Delete storage container destination. + - Get details of storage container. + - Modify storage container. Known issues ------------ @@ -62,12 +64,11 @@ Limitations Distribution ---------------- The software package is available for download from the [Ansible Modules -for PowerStore GitHub](https://github.com/dell/ansible-powerstore/tree/1.9.0) page. +for PowerStore GitHub](https://github.com/dell/ansible-powerstore/tree/2.0.0) page. Documentation ------------- -The documentation is available on [Ansible Modules for PowerStore GitHub](https://github.com/dell/ansible-powerstore/tree/1.9.0/docs) +The documentation is available on [Ansible Modules for PowerStore GitHub](https://github.com/dell/ansible-powerstore/tree/2.0.0/docs) page. It includes these: - README - Release Notes (this document) -- Product Guide diff --git a/docs/SECURITY.md b/docs/SECURITY.md index 885fd60..5a7f91e 100644 --- a/docs/SECURITY.md +++ b/docs/SECURITY.md @@ -12,7 +12,7 @@ You may obtain a copy of the License at The Ansible modules for Dell PowerStore repository are inspected for security vulnerabilities via blackduck scans and static code analysis. -In addition to this, there are various security checks that get executed against a branch when a pull request is created/updated. Please refer to [pull request](https://github.com/dell/ansible-powerstore/blob/1.9.0/docs/CONTRIBUTING.md#Pull-requests) for more information. +In addition to this, there are various security checks that get executed against a branch when a pull request is created/updated. Please refer to [pull request](https://github.com/dell/ansible-powerstore/blob/2.0.0/docs/CONTRIBUTING.md#Pull-requests) for more information. ## Reporting a vulnerability diff --git a/docs/modules/certificate.rst b/docs/modules/certificate.rst index 86f4267..2b6a2dc 100644 --- a/docs/modules/certificate.rst +++ b/docs/modules/certificate.rst @@ -12,7 +12,7 @@ certificate -- Certificate operations for PowerStore Storage System Synopsis -------- -Supports the provisioning operations on a Certificate such as add/import, modify, reset, exchange and get the details of a certificate. +Supports the provisioning operations on a certificate such as add/import, modify, reset, exchange and get the details of a certificate. @@ -20,7 +20,10 @@ Requirements ------------ The below requirements are needed on the host that executes this module. -- A Dell PowerStore Storage System. Ansible 2.12, 2.13 or 2.14 +- A Dell PowerStore storage system version 3.0.0.0 or later. +- Ansible-core 2.13 or later. +- PyPowerStore 2.0.0. +- Python 3.9, 3.10 or 3.11. @@ -44,7 +47,7 @@ Parameters scope (optional, str, None) - Defines a subset of certificates belonging to one Service. + Defines a subset of certificates belonging to one service. certificate (optional, str, None) @@ -79,12 +82,12 @@ Parameters IP or FQDN of the PowerStore management system. - verifycert (True, bool, None) + validate_certs (optional, bool, True) Boolean variable to specify whether to validate SSL certificate or not. - True - indicates that the SSL certificate should be verified. Set the environment variable REQUESTS_CA_BUNDLE to the path of the SSL certificate. + ``true`` - indicates that the SSL certificate should be verified. Set the environment variable REQUESTS_CA_BUNDLE to the path of the SSL certificate. - False - indicates that the SSL certificate should not be verified. + ``false`` - indicates that the SSL certificate should not be verified. user (True, str, None) @@ -115,10 +118,10 @@ Notes .. note:: - Idempotency is not supported for adding/importing certificates, exchange of certificates and the reset of certificates. - - Only is_current parameter is supported for modification of certificate. + - Only *is_current* parameter is supported for modification of certificate. - Reset operation can reset more than one certificate at a time. - Add/import, modify and reset are supported for PowerStore versions 2.0 and above only. - - The check_mode is not supported. + - The *check_mode* is not supported. - The modules present in this collection named as 'dellemc.powerstore' are built to support the Dell PowerStore storage platform. @@ -135,7 +138,7 @@ Examples array_ip: "{{array_ip}}" user: "{{user}}" password: "{{password}}" - verifycert: "{{verifycert}}" + validate_certs: "{{validate_certs}}" certificate_id: "e940144f-393f-4e9c-8f54-9a4d57b38c48" state: "present" @@ -144,7 +147,7 @@ Examples array_ip: "{{array_ip}}" user: "{{user}}" password: "{{password}}" - verifycert: "{{verifycert}}" + validate_certs: "{{validate_certs}}" service: "VASA_HTTP" state: "present" @@ -153,7 +156,7 @@ Examples array_ip: "{{array_ip}}" user: "{{user}}" password: "{{password}}" - verifycert: "{{verifycert}}" + validate_certs: "{{validate_certs}}" service: "Replication_HTTP" remote_address: "{{remote_array_ip}}" remote_port: 443 @@ -166,11 +169,11 @@ Examples array_ip: "{{array_ip}}" user: "{{user}}" password: "{{password}}" - verifycert: "{{verifycert}}" + validate_certs: "{{validate_certs}}" certificate_type: "CA_Client_Validation" service: "VASA_HTTP" certificate: "{{certificate_string}}" - is_current: True + is_current: true state: "present" - name: Modify certificate @@ -178,9 +181,9 @@ Examples array_ip: "{{array_ip}}" user: "{{user}}" password: "{{password}}" - verifycert: "{{verifycert}}" + validate_certs: "{{validate_certs}}" certificate_id: "37b76535-612b-456a-a694-1389f17632c7" - is_current: True + is_current: true state: "present" diff --git a/docs/modules/cluster.rst b/docs/modules/cluster.rst index 8fbcfe4..57dc465 100644 --- a/docs/modules/cluster.rst +++ b/docs/modules/cluster.rst @@ -20,7 +20,10 @@ Requirements ------------ The below requirements are needed on the host that executes this module. -- A Dell PowerStore Storage System. Ansible 2.12, 2.13 or 2.14 +- A Dell PowerStore storage system version 3.0.0.0 or later. +- Ansible-core 2.13 or later. +- PyPowerStore 2.0.0. +- Python 3.9, 3.10 or 3.11. @@ -50,23 +53,23 @@ Parameters appliance_id (optional, str, None) ID of the appliance. - Parameters appliance_id and appliance_name are mutually exclusive. + Parameters *appliance_id* and *appliance_name* are mutually exclusive. - Parameter is_ssh_enabled has to be passed along with appliance_id. + Parameter *is_ssh_enabled* has to be passed along with *appliance_id*. appliance_name (optional, str, None) Name of the appliance. - Parameters appliance_id and appliance_name are mutually exclusive. + Parameters *appliance_id* and *appliance_name* are mutually exclusive. - Parameter is_ssh_enabled has to be passed along with appliance_name. + Parameter *is_ssh_enabled* has to be passed along with *appliance_name*. is_ssh_enabled (optional, bool, None) Whether SSH access is enabled for the cluster. - Either appliance_id or appliance_name is to be passed along with is_ssh_enabled. + Either *appliance_id* or *appliance_name* is to be passed along with *is_ssh_enabled*. physical_mtu (optional, int, None) @@ -75,7 +78,7 @@ Parameters The MTU can be set between 1500 to 9000. - ignore_network_warnings (False, bool, None) + ignore_network_warnings (optional, bool, None) Whether to ignore the network warning about unreachable external network. @@ -147,7 +150,7 @@ Parameters snmp_community_string (optional, str, None) - Specifies SNMPv2 community string, if SNMPv2 connect method is selected. + Specifies ``SNMPv2`` community string, if ``SNMPv2`` connect method is selected. @@ -226,7 +229,7 @@ Parameters This should be specified when creating PowerStore X cluster. - Mutually exclusive with data_center_id. + Mutually exclusive with *data_center_id*. data_center_id (optional, str, None) @@ -236,7 +239,7 @@ Parameters This should be specified when creating PowerStore X cluster. - Mutually exclusive with data_center_name. + Mutually exclusive with *data_center_name*. esx_cluster_name (optional, str, None) @@ -270,27 +273,27 @@ Parameters wait_for_completion (optional, bool, False) Flag to indicate if the operation should be run synchronously or asynchronously. - True signifies synchronous execution. By default, create cluster operation will run asynchronously. + ``true`` signifies synchronous execution. By default, create cluster operation will run asynchronously. state (True, str, None) Define whether the cluster should exist or not. - Value present indicates that the cluster should exist on the system. + Value ``present`` indicates that the cluster should exist on the system. - Value absent indicates that the cluster should not exist on the system. + Value ``absent`` indicates that the cluster should not exist on the system. array_ip (True, str, None) IP or FQDN of the PowerStore management system. - verifycert (True, bool, None) + validate_certs (optional, bool, True) Boolean variable to specify whether to validate SSL certificate or not. - True - indicates that the SSL certificate should be verified. Set the environment variable REQUESTS_CA_BUNDLE to the path of the SSL certificate. + ``true`` - indicates that the SSL certificate should be verified. Set the environment variable REQUESTS_CA_BUNDLE to the path of the SSL certificate. - False - indicates that the SSL certificate should not be verified. + ``false`` - indicates that the SSL certificate should not be verified. user (True, str, None) @@ -321,13 +324,13 @@ Notes .. note:: - Deletion of a cluster is not supported by ansible module. - - The check_mode is not supported. + - The *check_mode* is not supported. - Before performing create operation, the default password for admin user and service user should be changed. - - For management type network during cluster creation, storage_discovery_address and purposes should not be passed. - - The vcenters parameter is mandatory for PowerStore X cluster creation. + - For management type network during cluster creation, *storage_discovery_address* and purposes should not be passed. + - The *vcenters* parameter is mandatory for PowerStore X cluster creation. - Minimum 3 and 5 addresses are required for management network for PowerStore T and X model respectively. - - The File_Mobility purpose is supported only in FootHills Prime and above. - - Parameter is_http_redirect_enabled is supported only in PowerStore FootHills Prime and above. + - The ``File_Mobility`` purpose is supported only in FootHills Prime and above. + - Parameter *is_http_redirect_enabled* is supported only in PowerStore FootHills Prime and above. - The modules present in this collection named as 'dellemc.powerstore' are built to support the Dell PowerStore storage platform. @@ -342,7 +345,7 @@ Examples - name: Get the details of cluster using id dellemc.powerstore.cluster: array_ip: "{{array_ip}}" - verifycert: "{{verifycert}}" + validate_certs: "{{validate_certs}}" user: "{{user}}" password: "{{password}}" cluster_id: "0" @@ -351,12 +354,12 @@ Examples - name: Modify details of cluster using the name dellemc.powerstore.cluster: array_ip: "{{array_ip}}" - verifycert: "{{verifycert}}" + validate_certs: "{{validate_certs}}" user: "{{user}}" password: "{{password}}" cluster_name: "RT-D1320" appliance_id: "A1" - is_ssh_enabled: True + is_ssh_enabled: true service_password: "S@mple_password" chap_mode: "Disabled" new_name: "new_RT-D1320" @@ -365,11 +368,11 @@ Examples - name: Validate create cluster dellemc.powerstore.cluster: array_ip: "{{array_ip}}" - verifycert: "{{verifycert}}" + validate_certs: "{{validate_certs}}" user: "{{user}}" password: "{{password}}" cluster_name: "RT-D1320" - ignore_network_warnings: True + ignore_network_warnings: true appliances: - link_local_address: "1.2.x.x" name: "Ansible_cluster" @@ -397,18 +400,18 @@ Examples - "3.x.x.x" purpose: - "ISCSI" - is_http_redirect_enabled: True - validate_create: True + is_http_redirect_enabled: true + validate_create: true state: "present" - name: Create cluster dellemc.powerstore.cluster: array_ip: "{{array_ip}}" - verifycert: "{{verifycert}}" + validate_certs: "{{validate_certs}}" user: "{{user}}" password: "{{password}}" cluster_name: "RT-D1320" - ignore_network_warnings: True + ignore_network_warnings: true appliances: - link_local_address: "1.2.x.x" name: "Ansible_cluster" @@ -449,12 +452,12 @@ Examples - address: "1.x.x.x" username: "user" password: "password" - is_verify_server_cert: True + is_verify_server_cert: true vasa_provider_credentials: username: "user" password: "password" - is_http_redirect_enabled: True - wait_for_completion: False + is_http_redirect_enabled: true + wait_for_completion: false state: "present" @@ -574,7 +577,7 @@ cluster_details (When Cluster exists., complex, {'appliance_count': 1, 'chap_mod appliance_details (When appliance name or id is passed in the playbook task., complex, ) - Name and Id of the appliance for which is_ssh_enabled parameter is used. + Name and Id of the appliance for which *is_ssh_enabled* parameter is used. id (, str, ) diff --git a/docs/modules/dns.rst b/docs/modules/dns.rst index 6207063..d7b331d 100644 --- a/docs/modules/dns.rst +++ b/docs/modules/dns.rst @@ -20,7 +20,10 @@ Requirements ------------ The below requirements are needed on the host that executes this module. -- A Dell PowerStore Storage System. Ansible 2.12, 2.13 or 2.14 +- A Dell PowerStore storage system version 3.0.0.0 or later. +- Ansible-core 2.13 or later. +- PyPowerStore 2.0.0. +- Python 3.9, 3.10 or 3.11. @@ -31,30 +34,30 @@ Parameters Unique identifier of the DNS instance. - dns_addresses (False, list, None) + dns_addresses (optional, list, None) DNS server addresses in IPv4 format. - dns_address_state (False, str, None) - State of the addresses mentioned in dns_addresses. + dns_address_state (optional, str, None) + State of the addresses mentioned in *dns_addresses*. state (True, str, None) The state of the DNS instance after the task is performed. - For get and modify operations it should be set to "present". + For get and modify operations it should be set to ``present``. array_ip (True, str, None) IP or FQDN of the PowerStore management system. - verifycert (True, bool, None) + validate_certs (optional, bool, True) Boolean variable to specify whether to validate SSL certificate or not. - True - indicates that the SSL certificate should be verified. Set the environment variable REQUESTS_CA_BUNDLE to the path of the SSL certificate. + ``true`` - indicates that the SSL certificate should be verified. Set the environment variable REQUESTS_CA_BUNDLE to the path of the SSL certificate. - False - indicates that the SSL certificate should not be verified. + ``false`` - indicates that the SSL certificate should not be verified. user (True, str, None) @@ -85,9 +88,9 @@ Notes .. note:: - Minimum 1 and maximum 3 addresses can be associated to a DNS instance. - - Parameters dns_addresses and dns_address_state are required together. + - Parameters *dns_addresses* and *dns_address_state* are required together. - Creation and deletion of DNS is not supported. - - The check_mode is not supported. + - The *check_mode* is not supported. - The modules present in this collection named as 'dellemc.powerstore' are built to support the Dell PowerStore storage platform. @@ -104,7 +107,7 @@ Examples array_ip: "{{array_ip}}" user: "{{user}}" password: "{{password}}" - verifycert: "{{verifycert}}" + validate_certs: "{{validate_certs}}" dns_id: "DNS1" state: "present" @@ -113,7 +116,7 @@ Examples array_ip: "{{array_ip}}" user: "{{user}}" password: "{{password}}" - verifycert: "{{verifycert}}" + validate_certs: "{{validate_certs}}" dns_id: "DNS1" dns_addresses: - "XX.XX.XX.XX" @@ -126,7 +129,7 @@ Examples array_ip: "{{array_ip}}" user: "{{user}}" password: "{{password}}" - verifycert: "{{verifycert}}" + validate_certs: "{{validate_certs}}" dns_id: "DNS1" dns_addresses: - "YY.YY.YY.YY" diff --git a/docs/modules/email.rst b/docs/modules/email.rst index 670772b..be4df9e 100644 --- a/docs/modules/email.rst +++ b/docs/modules/email.rst @@ -26,30 +26,33 @@ Requirements ------------ The below requirements are needed on the host that executes this module. -- A Dell PowerStore Storage System. Ansible 2.12, 2.13 or 2.14 +- A Dell PowerStore storage system version 3.0.0.0 or later. +- Ansible-core 2.13 or later. +- PyPowerStore 2.0.0. +- Python 3.9, 3.10 or 3.11. Parameters ---------- - email_id (False, str, None) + email_id (optional, str, None) Unique identifier of the destination email address. - Mutually exclusive with email_address. + Mutually exclusive with *email_address*. - email_address (False, str, None) + email_address (optional, str, None) Email address to receive notifications. - Mutually exclusive with email_id. + Mutually exclusive with *email_id*. - new_address (False, str, None) + new_address (optional, str, None) New email address to receive notifications. - send_test_email (False, bool, False) + send_test_email (optional, bool, False) Whether to send the test email to the destination email address. @@ -57,19 +60,19 @@ Parameters Whether to send different types of notifications. It contains below optional candidate variables. - critical (False, bool, None) + critical (optional, bool, None) Whether to send notifications for critical alerts. - major (False, bool, None) + major (optional, bool, None) Whether to send notifications for major alerts. - minor (False, bool, None) + minor (optional, bool, None) Whether to send notifications for minor alerts. - info (False, bool, None) + info (optional, bool, None) Whether to send notifications for informational alerts. @@ -77,21 +80,21 @@ Parameters state (True, str, None) The state of the destination email address after the task is performed. - For Delete operation only, it should be set to "absent". + For Delete operation only, it should be set to ``absent``. - For all Create, Modify, Test or Get details operations it should be set to "present". + For all Create, Modify, Test or Get details operations it should be set to ``present``. array_ip (True, str, None) IP or FQDN of the PowerStore management system. - verifycert (True, bool, None) + validate_certs (optional, bool, True) Boolean variable to specify whether to validate SSL certificate or not. - True - indicates that the SSL certificate should be verified. Set the environment variable REQUESTS_CA_BUNDLE to the path of the SSL certificate. + ``true`` - indicates that the SSL certificate should be verified. Set the environment variable REQUESTS_CA_BUNDLE to the path of the SSL certificate. - False - indicates that the SSL certificate should not be verified. + ``false`` - indicates that the SSL certificate should not be verified. user (True, str, None) @@ -122,7 +125,7 @@ Notes .. note:: - Idempotency is not supported for Test operation of Email module. - - The check_mode is not supported. + - The *check_mode* is not supported. - The modules present in this collection named as 'dellemc.powerstore' are built to support the Dell PowerStore storage platform. @@ -139,7 +142,7 @@ Examples array_ip: "{{array_ip}}" user: "{{user}}" password: "{{password}}" - verifycert: "{{verifycert}}" + validate_certs: "{{validate_certs}}" email_id: "780b6220-2d0b-4b9f-a485-4ae7f673bd98" state: "present" @@ -148,7 +151,7 @@ Examples array_ip: "{{array_ip}}" user: "{{user}}" password: "{{password}}" - verifycert: "{{verifycert}}" + validate_certs: "{{validate_certs}}" email_address: "abc@dell.com" state: "present" @@ -157,12 +160,12 @@ Examples array_ip: "{{array_ip}}" user: "{{user}}" password: "{{password}}" - verifycert: "{{verifycert}}" + validate_certs: "{{validate_certs}}" email_address: "abc_xyz@dell.com" notify: - info: True - critical: True - major: False + info: true + critical: true + major: false state: "present" - name: Modify destination email @@ -170,12 +173,12 @@ Examples array_ip: "{{array_ip}}" user: "{{user}}" password: "{{password}}" - verifycert: "{{verifycert}}" + validate_certs: "{{validate_certs}}" email_address: "abc_xyz@dell.com" new_address: "def_pqr@dell.com" notify: - info: False - major: False + info: false + major: false state: "present" - name: Send a test mail to the destination email with email_id @@ -183,9 +186,9 @@ Examples array_ip: "{{array_ip}}" user: "{{user}}" password: "{{password}}" - verifycert: "{{verifycert}}" + validate_certs: "{{validate_certs}}" email_id: "780b6220-2d0b-4b9f-a485-4ae7f673bd98" - send_test_email: True + send_test_email: true state: "present" - name: Delete destination email @@ -193,7 +196,7 @@ Examples array_ip: "{{array_ip}}" user: "{{user}}" password: "{{password}}" - verifycert: "{{verifycert}}" + validate_certs: "{{validate_certs}}" email_address: "def_pqr@dell.com" state: "absent" diff --git a/docs/modules/filesystem.rst b/docs/modules/filesystem.rst index 6b1771e..b164582 100644 --- a/docs/modules/filesystem.rst +++ b/docs/modules/filesystem.rst @@ -20,7 +20,10 @@ Requirements ------------ The below requirements are needed on the host that executes this module. -- A Dell PowerStore Storage System. Ansible 2.12, 2.13 or 2.14 +- A Dell PowerStore storage system version 3.0.0.0 or later. +- Ansible-core 2.13 or later. +- PyPowerStore 2.0.0. +- Python 3.9, 3.10 or 3.11. @@ -210,12 +213,12 @@ Parameters IP or FQDN of the PowerStore management system. - verifycert (True, bool, None) + validate_certs (optional, bool, True) Boolean variable to specify whether to validate SSL certificate or not. - True - indicates that the SSL certificate should be verified. Set the environment variable REQUESTS_CA_BUNDLE to the path of the SSL certificate. + ``true`` - indicates that the SSL certificate should be verified. Set the environment variable REQUESTS_CA_BUNDLE to the path of the SSL certificate. - False - indicates that the SSL certificate should not be verified. + ``false`` - indicates that the SSL certificate should not be verified. user (True, str, None) @@ -264,7 +267,7 @@ Examples register: result_fs dellemc.powerstore.filesystem: array_ip: "{{array_ip}}" - verifycert: "{{verifycert}}" + validate_certs: "{{validate_certs}}" user: "{{user}}" password: "{{password}}" filesystem_name: "{{filesystem_name}}" @@ -275,8 +278,8 @@ Examples access_policy: "UNIX" locking_policy: "MANDATORY" smb_properties: - is_smb_no_notify_enabled: True - is_smb_notify_on_access_enabled: True + is_smb_no_notify_enabled: true + is_smb_notify_on_access_enabled: true quota_defaults: grace_period: 1 grace_period_unit: 'days' @@ -284,7 +287,7 @@ Examples default_soft_limit: 2 protection_policy: "{{protection_policy_id}}" config_type: "VMWARE" - is_async_mtime_enabled: True + is_async_mtime_enabled: true file_events_publishing_mode: "NFS_ONLY" host_io_size: "VMWARE_16K" state: "present" @@ -292,20 +295,20 @@ Examples - name: Modify File System by id dellemc.powerstore.filesystem: array_ip: "{{array_ip}}" - verifycert: "{{verifycert}}" + validate_certs: "{{validate_certs}}" user: "{{user}}" password: "{{password}}" filesystem_id: "{{fs_id}}" folder_rename_policy: "ALL_ALLOWED" smb_properties: - is_smb_op_locks_enabled: True + is_smb_op_locks_enabled: true smb_notify_on_change_dir_depth: 3 quota_defaults: grace_period: 2 grace_period_unit: 'weeks' default_hard_limit: 2 default_soft_limit: 1 - is_async_mtime_enabled: True + is_async_mtime_enabled: true file_events_publishing_mode: "ALL" flr_attributes: mode: "Enterprise" @@ -317,7 +320,7 @@ Examples - name: Get File System details by id dellemc.powerstore.filesystem: array_ip: "{{array_ip}}" - verifycert: "{{verifycert}}" + validate_certs: "{{validate_certs}}" user: "{{user}}" password: "{{password}}" filesystem_id: "{{result_fs.filesystem_details.id}}" @@ -326,7 +329,7 @@ Examples - name: Delete File System by id dellemc.powerstore.filesystem: array_ip: "{{array_ip}}" - verifycert: "{{verifycert}}" + validate_certs: "{{validate_certs}}" user: "{{user}}" password: "{{password}}" filesystem_id: "{{result_fs.filesystem_details.id}}" diff --git a/docs/modules/filesystem_snapshot.rst b/docs/modules/filesystem_snapshot.rst index b20f7eb..ab5c6fe 100644 --- a/docs/modules/filesystem_snapshot.rst +++ b/docs/modules/filesystem_snapshot.rst @@ -20,7 +20,10 @@ Requirements ------------ The below requirements are needed on the host that executes this module. -- A Dell PowerStore Storage System. Ansible 2.12, 2.13 or 2.14 +- A Dell PowerStore storage system version 3.0.0.0 or later. +- Ansible-core 2.13 or later. +- PyPowerStore 2.0.0. +- Python 3.9, 3.10 or 3.11. @@ -42,7 +45,7 @@ Parameters filesystem (optional, str, None) The ID/Name of the filesystem for which snapshot will be taken. - If filesystem name is specified, then nas_server is required to uniquely identify the filesystem. + If filesystem name is specified, then *nas_server* is required to uniquely identify the filesystem. Mandatory for create operation. @@ -58,7 +61,7 @@ Parameters desired_retention (optional, int, None) The retention value for the Snapshot. - If the desired_retention/expiration_timestamp is not mentioned during creation, snapshot will be created with unlimited retention. + If the *desired_retention*/*expiration_timestamp* is not mentioned during creation, snapshot will be created with unlimited retention. Maximum supported desired retention is 31 days. @@ -76,7 +79,7 @@ Parameters access_type (optional, str, None) Specifies whether the snapshot directory or protocol access is granted to the filesystem snapshot. - For create operation, if access_type is not specified, snapshot will be created with 'SNAPSHOT' access type. + For create operation, if *access_type* is not specified, snapshot will be created with ``SNAPSHOT`` access type. state (True, str, None) @@ -87,12 +90,12 @@ Parameters IP or FQDN of the PowerStore management system. - verifycert (True, bool, None) + validate_certs (optional, bool, True) Boolean variable to specify whether to validate SSL certificate or not. - True - indicates that the SSL certificate should be verified. Set the environment variable REQUESTS_CA_BUNDLE to the path of the SSL certificate. + ``true`` - indicates that the SSL certificate should be verified. Set the environment variable REQUESTS_CA_BUNDLE to the path of the SSL certificate. - False - indicates that the SSL certificate should not be verified. + ``false`` - indicates that the SSL certificate should not be verified. user (True, str, None) @@ -122,7 +125,7 @@ Notes ----- .. note:: - - The check_mode is not supported. + - The *check_mode* is not supported. - The modules present in this collection named as 'dellemc.powerstore' are built to support the Dell PowerStore storage platform. @@ -137,7 +140,7 @@ Examples - name: Create filesystem snapshot dellemc.powerstore.filesystem_snapshot: array_ip: "{{array_ip}}" - verifycert: "{{verifycert}}" + validate_certs: "{{validate_certs}}" user: "{{user}}" password: "{{password}}" snapshot_name: "sample_filesystem_snapshot" @@ -150,7 +153,7 @@ Examples - name: Get the details of filesystem snapshot dellemc.powerstore.filesystem_snapshot: array_ip: "{{array_ip}}" - verifycert: "{{verifycert}}" + validate_certs: "{{validate_certs}}" user: "{{user}}" password: "{{password}}" snapshot_id: "{{fs_snapshot_id}}" @@ -159,7 +162,7 @@ Examples - name: Modify the filesystem snapshot dellemc.powerstore.filesystem_snapshot: array_ip: "{{array_ip}}" - verifycert: "{{verifycert}}" + validate_certs: "{{validate_certs}}" user: "{{user}}" password: "{{password}}" snapshot_name: "sample_filesystem_snapshot" @@ -171,7 +174,7 @@ Examples - name: Delete filesystem snapshot dellemc.powerstore.filesystem_snapshot: array_ip: "{{array_ip}}" - verifycert: "{{verifycert}}" + validate_certs: "{{validate_certs}}" user: "{{user}}" password: "{{password}}" snapshot_id: "{{fs_snapshot_id}}" diff --git a/docs/modules/host.rst b/docs/modules/host.rst index 8c64817..f188ee8 100644 --- a/docs/modules/host.rst +++ b/docs/modules/host.rst @@ -20,7 +20,10 @@ Requirements ------------ The below requirements are needed on the host that executes this module. -- A Dell PowerStore Storage System. Ansible 2.12, 2.13 or 2.14 +- A Dell PowerStore storage system version 3.0.0.0 or later. +- Ansible-core 2.13 or later. +- PyPowerStore 2.0.0. +- Python 3.9, 3.10 or 3.11. @@ -34,15 +37,15 @@ Parameters Required when creating a host. - Use either host_id or host_name for modify and delete tasks. + Use either *host_id* or *host_name* for modify and delete tasks. - host_id (False, str, None) + host_id (optional, str, None) The 36 character long host id automatically generated when a host is created. - Use either host_id or host_name for modify and delete tasks. + Use either *host_id* or *host_name* for modify and delete tasks. - The host_id cannot be used while creating host, as it is generated by the array after creation of host. + The *host_id* cannot be used while creating host, as it is generated by the array after creation of host. os_type (optional, str, None) @@ -60,19 +63,19 @@ Parameters Required when creating a host. - It is mutually exclusive with detailed_initiators. + It is mutually exclusive with *detailed_initiators*. detailed_initiators (optional, list, None) Initiator properties. - It is mutually exclusive with initiators. + It is mutually exclusive with *initiators*. port_name (True, str, None) Name of port type. - The port_name is mandatory key. + The *port_name* is mandatory key. port_type (optional, str, None) @@ -115,17 +118,17 @@ Parameters state (True, str, None) Define whether the host should exist or not. - Value present - indicates that the host should exist in system. + Value ``present`` - indicates that the host should exist in system. - Value absent - indicates that the host should not exist in system. + Value ``absent`` - indicates that the host should not exist in system. initiator_state (optional, str, None) Define whether the initiators should be present or absent in host. - Value present-in-host - indicates that the initiators should exist on host. + Value ``present-in-host`` - indicates that the initiators should exist on host. - Value absent-in-host - indicates that the initiators should not exist on host. + Value ``absent-in-host`` - indicates that the initiators should not exist on host. Required when creating a host with initiators or adding/removing initiators to/from existing host. @@ -136,7 +139,7 @@ Parameters Cannot be specified when creating a host. - host_connectivity (False, str, None) + host_connectivity (optional, str, None) Connectivity type for host. If any of metro connectivity options specified, a metro host must exists in both cluster provide connectivity to a metro volume from both cluster. @@ -146,12 +149,12 @@ Parameters IP or FQDN of the PowerStore management system. - verifycert (True, bool, None) + validate_certs (optional, bool, True) Boolean variable to specify whether to validate SSL certificate or not. - True - indicates that the SSL certificate should be verified. Set the environment variable REQUESTS_CA_BUNDLE to the path of the SSL certificate. + ``true`` - indicates that the SSL certificate should be verified. Set the environment variable REQUESTS_CA_BUNDLE to the path of the SSL certificate. - False - indicates that the SSL certificate should not be verified. + ``false`` - indicates that the SSL certificate should not be verified. user (True, str, None) @@ -182,11 +185,11 @@ Notes .. note:: - Only completely and correctly configured iSCSI initiators can be associated with a host. - - The parameters initiators and detailed_initiators are mutually exclusive. + - The parameters *initiators* and *detailed_initiators* are mutually exclusive. - For mutual CHAP authentication, single CHAP credentials are mandatory. - - Support of NVMe type of initiators is for PowerStore 2.0 and beyond. - - The host_connectivity is supported only in PowerStore 3.0.0.0 and above. - - The check_mode is not supported. + - Support of ``NVMe`` type of initiators is for PowerStore 2.0 and beyond. + - The *host_connectivity* is supported only in PowerStore 3.0.0.0 and above. + - The *check_mode* is not supported. - The modules present in this collection named as 'dellemc.powerstore' are built to support the Dell PowerStore storage platform. @@ -201,7 +204,7 @@ Examples - name: Create host with FC initiator dellemc.powerstore.host: array_ip: "{{array_ip}}" - verifycert: "{{verifycert}}" + validate_certs: "{{validate_certs}}" user: "{{user}}" password: "{{password}}" host_name: "ansible-test-host-1" @@ -215,7 +218,7 @@ Examples - name: Create host with iSCSI initiator and its details dellemc.powerstore.host: array_ip: "{{array_ip}}" - verifycert: "{{verifycert}}" + validate_certs: "{{validate_certs}}" user: "{{user}}" password: "{{password}}" host_name: "ansible-test-host-2" @@ -235,7 +238,7 @@ Examples - name: Get host details by id dellemc.powerstore.host: array_ip: "{{array_ip}}" - verifycert: "{{verifycert}}" + validate_certs: "{{validate_certs}}" user: "{{user}}" password: "{{password}}" host_id: "5c1e869b-ed8a-4845-abae-b102bc249d41" @@ -244,7 +247,7 @@ Examples - name: Add initiators to host by name dellemc.powerstore.host: array_ip: "{{array_ip}}" - verifycert: "{{verifycert}}" + validate_certs: "{{validate_certs}}" user: "{{user}}" password: "{{password}}" host_name: "ansible-test-host-1" @@ -256,7 +259,7 @@ Examples - name: Add initiators to host by id dellemc.powerstore.host: array_ip: "{{array_ip}}" - verifycert: "{{verifycert}}" + validate_certs: "{{validate_certs}}" user: "{{user}}" password: "{{password}}" host_id: "5c1e869b-ed8a-4845-abae-b102bc249d41" @@ -271,7 +274,7 @@ Examples - name: Remove initiators from by id dellemc.powerstore.host: array_ip: "{{array_ip}}" - verifycert: "{{verifycert}}" + validate_certs: "{{validate_certs}}" user: "{{user}}" password: "{{password}}" host_id: "8c1e869b-fe8a-4845-hiae-h802bc249d41" @@ -283,7 +286,7 @@ Examples - name: Modify host by name dellemc.powerstore.host: array_ip: "{{array_ip}}" - verifycert: "{{verifycert}}" + validate_certs: "{{validate_certs}}" user: "{{user}}" password: "{{password}}" host_name: "ansible-test-host-1" @@ -294,7 +297,7 @@ Examples - name: Delete host dellemc.powerstore.host: array_ip: "{{array_ip}}" - verifycert: "{{verifycert}}" + validate_certs: "{{validate_certs}}" user: "{{user}}" password: "{{password}}" host_name: "ansible-test-host-1-new" @@ -363,7 +366,7 @@ host_details (When host exists, complex, {'description': None, 'host_group_id': mapped_hosts (, complex, ) - This is the inverse of the resource type host_volume_mapping association. + This is the inverse of the resource type *host_volume_mapping* association. id (, str, ) diff --git a/docs/modules/hostgroup.rst b/docs/modules/hostgroup.rst index 4b6b903..86aa156 100644 --- a/docs/modules/hostgroup.rst +++ b/docs/modules/hostgroup.rst @@ -22,7 +22,10 @@ Requirements ------------ The below requirements are needed on the host that executes this module. -- A Dell PowerStore Storage System. Ansible 2.12, 2.13 or 2.14 +- A Dell PowerStore storage system version 3.0.0.0 or later. +- Ansible-core 2.13 or later. +- PyPowerStore 2.0.0. +- Python 3.9, 3.10 or 3.11. @@ -36,15 +39,15 @@ Parameters Required when creating a host group. - Use either hostgroup_id or hostgroup_name for modify and delete tasks. + Use either *hostgroup_id* or *hostgroup_name* for modify and delete tasks. hostgroup_id (optional, str, None) The 36-character long host group id, automatically generated when a host group is created. - Use either hostgroup_id or hostgroup_name for modify and delete tasks. + Use either *hostgroup_id* or *hostgroup_name* for modify and delete tasks. - The hostgroup_id cannot be used while creating host group, as it is generated by the array after creation of host group. + The *hostgroup_id* cannot be used while creating host group, as it is generated by the array after creation of host group. hosts (optional, list, None) @@ -60,9 +63,9 @@ Parameters state (True, str, None) Define whether the host group should exist or not. - Value present - indicates that the host group should exist on the system. + Value ``present`` - indicates that the host group should exist on the system. - Value absent - indicates that the host group should not exist on the system. + Value ``absent`` - indicates that the host group should not exist on the system. Deletion of a host group results in deletion of the containing hosts as well. Remove hosts from the host group first to retain them. @@ -70,9 +73,9 @@ Parameters host_state (optional, str, None) Define whether the hosts should be present or absent in host group. - Value present-in-group - indicates that the hosts should exist on the host group. + Value ``present-in-group`` - indicates that the hosts should exist on the host group. - Value absent-in-group - indicates that the hosts should not exist on the host group. + Value ``absent-in-group`` - indicates that the hosts should not exist on the host group. Required when creating a host group with hosts or adding/removing hosts from existing host group. @@ -81,7 +84,7 @@ Parameters The new name for host group renaming function. This value must contain 128 or fewer printable Unicode characters. - host_connectivity (False, str, None) + host_connectivity (optional, str, None) Connectivity type for host group. If any of metro connectivity options specified, a metro host group must exists in both cluster provide connectivity to a metro volume from both cluster. @@ -91,12 +94,12 @@ Parameters IP or FQDN of the PowerStore management system. - verifycert (True, bool, None) + validate_certs (optional, bool, True) Boolean variable to specify whether to validate SSL certificate or not. - True - indicates that the SSL certificate should be verified. Set the environment variable REQUESTS_CA_BUNDLE to the path of the SSL certificate. + ``true`` - indicates that the SSL certificate should be verified. Set the environment variable REQUESTS_CA_BUNDLE to the path of the SSL certificate. - False - indicates that the SSL certificate should not be verified. + ``false`` - indicates that the SSL certificate should not be verified. user (True, str, None) @@ -126,8 +129,8 @@ Notes ----- .. note:: - - The check_mode is not supported. - - The host_connectivity is supported only PowerStore 3.0.0.0 and above. + - The *check_mode* is not supported. + - The *host_connectivity* is supported only PowerStore 3.0.0.0 and above. - The modules present in this collection named as 'dellemc.powerstore' are built to support the Dell PowerStore storage platform. @@ -142,7 +145,7 @@ Examples - name: Create host group with hosts dellemc.powerstore.hostgroup: array_ip: "{{array_ip}}" - verifycert: "{{verifycert}}" + validate_certs: "{{validate_certs}}" user: "{{user}}" password: "{{password}}" hostgroup_name: "{{hostgroup_name}}" @@ -155,7 +158,7 @@ Examples - name: Get host group details using ID dellemc.powerstore.hostgroup: array_ip: "{{array_ip}}" - verifycert: "{{verifycert}}" + validate_certs: "{{validate_certs}}" user: "{{user}}" password: "{{password}}" hostgroup_id: "{{host group_id}}" @@ -164,7 +167,7 @@ Examples - name: Add hosts to host group dellemc.powerstore.hostgroup: array_ip: "{{array_ip}}" - verifycert: "{{verifycert}}" + validate_certs: "{{validate_certs}}" user: "{{user}}" password: "{{password}}" hostgroup_name: "{{hostgroup_name}}" @@ -176,7 +179,7 @@ Examples - name: Remove hosts from host group dellemc.powerstore.hostgroup: array_ip: "{{array_ip}}" - verifycert: "{{verifycert}}" + validate_certs: "{{validate_certs}}" user: "{{user}}" password: "{{password}}" hostgroup_name: "{{hostgroup_name}}" @@ -188,7 +191,7 @@ Examples - name: Modify host group dellemc.powerstore.hostgroup: array_ip: "{{array_ip}}" - verifycert: "{{verifycert}}" + validate_certs: "{{validate_certs}}" user: "{{user}}" password: "{{password}}" hostgroup_name: "{{hostgroup_name}}" @@ -199,7 +202,7 @@ Examples - name: Delete host group dellemc.powerstore.hostgroup: array_ip: "{{array_ip}}" - verifycert: "{{verifycert}}" + validate_certs: "{{validate_certs}}" user: "{{user}}" password: "{{password}}" hostgroup_name: "{{hostgroup_name}}" diff --git a/docs/modules/info.rst b/docs/modules/info.rst index e1fcb40..041af39 100644 --- a/docs/modules/info.rst +++ b/docs/modules/info.rst @@ -18,7 +18,7 @@ Block provisioning module includes volumes, volume groups, hosts, host groups, s File provisioning module includes NAS servers, NFS exports, SMB shares, tree quotas, user quotas, and file systems. -Replication module includes replication rules, replication sessions, and remote system. +Replication module includes replication rules, replication sessions, replication groups, and remote system. Virtualization module includes vCenters and virtual volumes. @@ -32,7 +32,10 @@ Requirements ------------ The below requirements are needed on the host that executes this module. -- A Dell PowerStore Storage System. Ansible 2.12, 2.13 or 2.14 +- A Dell PowerStore storage system version 3.0.0.0 or later. +- Ansible-core 2.13 or later. +- PyPowerStore 2.0.0. +- Python 3.9, 3.10 or 3.11. @@ -42,79 +45,83 @@ Parameters gather_subset (True, list, None) A list of string variables which specify the PowerStore system entities requiring information. - Volumes - vol. + Volumes - ``vol``. - All the nodes - node. + All the nodes - ``node``. - Volume groups - vg. + Volume groups - ``vg``. - Protection policies - protection_policy. + Protection policies - ``protection_policy``. - Hosts - host. + Hosts - ``host``. - Host groups - hg. + Host groups - ``hg``. - Snapshot rules - snapshot_rule. + Snapshot rules - ``snapshot_rule``. - NAS servers - nas_server. + NAS servers - ``nas_server``. - NFS exports - nfs_export. + NFS exports - ``nfs_export``. - SMB shares - smb_share. + SMB shares - ``smb_share``. - Tree quotas - tree_quota. + Tree quotas - ``tree_quota``. - User quotas - user_quota. + User quotas - ``user_quota``. - File systems - file_system. + File systems - ``file_system``. - Replication rules - replication_rule. + Replication rules - ``replication_rule``. - Replication sessions - replication_session. + Replication sessions - ``replication_session``. - Remote systems - remote_system. + Remote systems - ``remote_system``. - Various networks - network. + Various networks - ``network``. - Roles - role. + Roles - ``role``. - Local users - user. + Local users - ``user``. - Appliances - appliance. + Appliances - ``appliance``. - Security configurations - security_config. + Security configurations - ``security_config``. - Certificates - certificate. + Certificates - ``certificate``. - Active directories - ad. + Active directories - ``ad``. - LDAPs - ldap. + LDAPs - ``ldap``. - DNS servers - dns. + DNS servers - ``dns``. - NTP servers - ntp. + NTP servers - ``ntp``. - Email notification destinations - email_notification. + Email notification destinations - ``email_notification``. - SMTP configurations - smtp_config. + SMTP configurations - ``smtp_config``. - Remote Support - remote_support. + Remote Support - ``remote_support``. - Remote support contacts - remote_support_contact. + Remote support contacts - ``remote_support_contact``. - LDAP accounts - ldap_account. + LDAP accounts - ``ldap_account``. - LDAP domain - ldap_domain. + LDAP domain - ``ldap_domain``. - All vCenters - vcenter. + All vCenters - ``vcenter``. - Virtual volumes - virtual_volume. + Virtual volumes - ``virtual_volume``. + Storage containers - ``storage_container``. - filters (False, list, None) + Replication groups - ``replication_group``. + + + filters (optional, list, None) A list of filters to support filtered output for storage entities. - Each filter is a list of filter_key, filter_operator, filter_value. + Each filter is a list of *filter_key*, *filter_operator*, *filter_value*. Supports passing of multiple filters. @@ -135,19 +142,19 @@ Parameters all_pages (optional, bool, False) Indicates whether to return all available entities on the storage system. - If set to True, the Info module will implement pagination and return all entities. Otherwise, a maximum of the first 100 entities of any type will be returned. + If set to ``true``, the Info module will implement pagination and return all entities. Otherwise, a maximum of the first 100 entities of any type will be returned. array_ip (True, str, None) IP or FQDN of the PowerStore management system. - verifycert (True, bool, None) + validate_certs (optional, bool, True) Boolean variable to specify whether to validate SSL certificate or not. - True - indicates that the SSL certificate should be verified. Set the environment variable REQUESTS_CA_BUNDLE to the path of the SSL certificate. + ``true`` - indicates that the SSL certificate should be verified. Set the environment variable REQUESTS_CA_BUNDLE to the path of the SSL certificate. - False - indicates that the SSL certificate should not be verified. + ``false`` - indicates that the SSL certificate should not be verified. user (True, str, None) @@ -177,8 +184,8 @@ Notes ----- .. note:: - - Pagination is not supported for role, local user, security configs, LDAP accounts and LDAP domain. If all_pages is passed, it will be ignored. - - The check_mode is supported. + - Pagination is not supported for role, local user, security configs, LDAP accounts and LDAP domain. If *all_pages* is passed, it will be ignored. + - The *check_mode* is supported. - The modules present in this collection named as 'dellemc.powerstore' are built to support the Dell PowerStore storage platform. @@ -194,7 +201,7 @@ Examples - name: Get list of volumes, volume groups, hosts, host groups and node dellemc.powerstore.info: array_ip: "{{array_ip}}" - verifycert: "{{verifycert}}" + validate_certs: "{{validate_certs}}" user: "{{user}}" password: "{{password}}" gather_subset: @@ -207,7 +214,7 @@ Examples - name: Get list of replication related entities dellemc.powerstore.info: array_ip: "{{array_ip}}" - verifycert: "{{verifycert}}" + validate_certs: "{{validate_certs}}" user: "{{user}}" password: "{{password}}" gather_subset: @@ -218,7 +225,7 @@ Examples - name: Get list of volumes whose state notequal to ready dellemc.powerstore.info: array_ip: "{{array_ip}}" - verifycert: "{{verifycert}}" + validate_certs: "{{validate_certs}}" user: "{{user}}" password: "{{password}}" gather_subset: @@ -231,7 +238,7 @@ Examples - name: Get list of protection policies and snapshot rules dellemc.powerstore.info: array_ip: "{{array_ip}}" - verifycert: "{{verifycert}}" + validate_certs: "{{validate_certs}}" user: "{{user}}" password: "{{password}}" gather_subset: @@ -241,7 +248,7 @@ Examples - name: Get list of snapshot rules whose desired_retention between 101-499 dellemc.powerstore.info: array_ip: "{{array_ip}}" - verifycert: "{{verifycert}}" + validate_certs: "{{validate_certs}}" user: "{{user}}" password: "{{password}}" gather_subset: @@ -257,7 +264,7 @@ Examples - name: Get list of nas server, nfs_export and smb share dellemc.powerstore.info: array_ip: "{{array_ip}}" - verifycert: "{{verifycert}}" + validate_certs: "{{validate_certs}}" user: "{{user}}" password: "{{password}}" gather_subset: @@ -268,7 +275,7 @@ Examples - name: Get list of tree quota, user quota and file system dellemc.powerstore.info: array_ip: "{{array_ip}}" - verifycert: "{{verifycert}}" + validate_certs: "{{validate_certs}}" user: "{{user}}" password: "{{password}}" gather_subset: @@ -279,7 +286,7 @@ Examples - name: Get list of nas server whose name equal to 'nas_server' dellemc.powerstore.info: array_ip: "{{array_ip}}" - verifycert: "{{verifycert}}" + validate_certs: "{{validate_certs}}" user: "{{user}}" password: "{{password}}" gather_subset: @@ -292,7 +299,7 @@ Examples - name: Get list of smb share whose name contains 'share' dellemc.powerstore.info: array_ip: "{{array_ip}}" - verifycert: "{{verifycert}}" + validate_certs: "{{validate_certs}}" user: "{{user}}" password: "{{password}}" gather_subset: @@ -305,7 +312,7 @@ Examples - name: Get list of user, role, network and appliances dellemc.powerstore.info: array_ip: "{{array_ip}}" - verifycert: "{{verifycert}}" + validate_certs: "{{validate_certs}}" user: "{{user}}" password: "{{password}}" gather_subset: @@ -317,7 +324,7 @@ Examples - name: Get list of ad, certificate, security config and ldaps dellemc.powerstore.info: array_ip: "{{array_ip}}" - verifycert: "{{verifycert}}" + validate_certs: "{{validate_certs}}" user: "{{user}}" password: "{{password}}" gather_subset: @@ -329,7 +336,7 @@ Examples - name: Get list of networks whose name contains 'Management' dellemc.powerstore.info: array_ip: "{{array_ip}}" - verifycert: "{{verifycert}}" + validate_certs: "{{validate_certs}}" user: "{{user}}" password: "{{password}}" gather_subset: @@ -342,7 +349,7 @@ Examples - name: Get list of dns, email notification, ntp, remote support, remote support contact and smtp config dellemc.powerstore.info: array_ip: "{{array_ip}}" - verifycert: "{{verifycert}}" + validate_certs: "{{validate_certs}}" user: "{{user}}" password: "{{password}}" gather_subset: @@ -356,7 +363,7 @@ Examples - name: Get list of emails which receives minor notifications dellemc.powerstore.info: array_ip: "{{array_ip}}" - verifycert: "{{verifycert}}" + validate_certs: "{{validate_certs}}" user: "{{user}}" password: "{{password}}" gather_subset: @@ -364,12 +371,12 @@ Examples filters: - filter_key: 'notify_minor' filter_operator: 'equal' - filter_value: 'False' + filter_value: 'false' - name: Get list of LDAP accounts dellemc.powerstore.info: array_ip: "{{array_ip}}" - verifycert: "{{verifycert}}" + validate_certs: "{{validate_certs}}" user: "{{user}}" password: "{{password}}" gather_subset: @@ -378,7 +385,7 @@ Examples - name: Get list of LDAP accounts with type as "User" dellemc.powerstore.info: array_ip: "{{array_ip}}" - verifycert: "{{verifycert}}" + validate_certs: "{{validate_certs}}" user: "{{user}}" password: "{{password}}" gather_subset: @@ -391,7 +398,7 @@ Examples - name: Get list of LDAP domain dellemc.powerstore.info: array_ip: "{{array_ip}}" - verifycert: "{{verifycert}}" + validate_certs: "{{validate_certs}}" user: "{{user}}" password: "{{password}}" gather_subset: @@ -400,7 +407,7 @@ Examples - name: Get list of LDAP domain with protocol as "LDAPS" dellemc.powerstore.info: array_ip: "{{array_ip}}" - verifycert: "{{verifycert}}" + validate_certs: "{{validate_certs}}" user: "{{user}}" password: "{{password}}" gather_subset: @@ -413,7 +420,7 @@ Examples - name: Get list of vCenters dellemc.powerstore.info: array_ip: "{{array_ip}}" - verifycert: "{{verifycert}}" + validate_certs: "{{validate_certs}}" user: "{{user}}" password: "{{password}}" gather_subset: @@ -422,11 +429,21 @@ Examples - name: Get list of virtual volumes dellemc.powerstore.info: array_ip: "{{array_ip}}" - verifycert: "{{verifycert}}" + validate_certs: "{{validate_certs}}" user: "{{user}}" password: "{{password}}" gather_subset: - virtual_volume + - replication_group + + - name: Get list of storage containers + dellemc.powerstore.info: + array_ip: "{{array_ip}}" + validate_certs: "{{validate_certs}}" + user: "{{user}}" + password: "{{password}}" + gather_subset: + - storage_container @@ -442,7 +459,7 @@ Array_Software_Version (always, str, 2.1.0.0) API version of PowerStore array. -ActiveDirectory (When ad is in a given gather_subset, list, [{'id': '60866158-5d00-3d7a-971b-5adabf42d82c'}]) +ActiveDirectory (When C(ad) is in a given I(gather_subset), list, [{'id': '60866158-5d00-3d7a-971b-5adabf42d82c'}]) Provides details of all active directories. @@ -451,7 +468,7 @@ ActiveDirectory (When ad is in a given gather_subset, list, [{'id': '60866158-5d -Appliance (When appliance is in a given gather_subset, list, [{'id': 'A1', 'model': 'PowerStore 1000T', 'name': 'Appliance-WND8977'}]) +Appliance (When C(appliance) is in a given I(gather_subset), list, [{'id': 'A1', 'model': 'PowerStore 1000T', 'name': 'Appliance-WND8977'}]) Provides details of all appliances. @@ -468,7 +485,7 @@ Appliance (When appliance is in a given gather_subset, list, [{'id': 'A1', 'mode -Certificate (When certificates is in a given gather_subset, list, [{'id': 'e940144f-393f-4e9c-8f54-9a4d57b38c48'}]) +Certificate (When C(certificates) is in a given I(gather_subset), list, [{'id': 'e940144f-393f-4e9c-8f54-9a4d57b38c48'}]) Provides details of all certificates. @@ -490,7 +507,7 @@ Cluster (always, list, [{'id': '0', 'name': 'RT-D1006'}]) -DNS (When dns is in a given gather_subset, list, [{'id': 'DNS1'}]) +DNS (When C(dns) is in a given I(gather_subset), list, [{'id': 'DNS1'}]) Provides details of all DNS servers. @@ -499,7 +516,7 @@ DNS (When dns is in a given gather_subset, list, [{'id': 'DNS1'}]) -EmailNotification (When email_notification is in a given gather_subset, list, [{'email_address': 'abc', 'id': '9c3e5cba-17d5-4d64-b97c-350f91e2b714'}]) +EmailNotification (When C(email_notification) is in a given I(gather_subset), list, [{'email_address': 'abc', 'id': '9c3e5cba-17d5-4d64-b97c-350f91e2b714'}]) Provides details of all emails to which notifications will be sent. @@ -512,7 +529,7 @@ EmailNotification (When email_notification is in a given gather_subset, list, [{ -FileSystems (When file_system is in a given gather_subset, list, [{'id': '61ef399b-f4c4-ccb6-1761-16c6ac7490fc', 'name': 'test_fs'}]) +FileSystems (When C(file_system) is in a given I(gather_subset), list, [{'id': '61ef399b-f4c4-ccb6-1761-16c6ac7490fc', 'name': 'test_fs'}]) Provides details of all filesystems. @@ -525,7 +542,7 @@ FileSystems (When file_system is in a given gather_subset, list, [{'id': '61ef39 -HostGroups (When hg is in a given gather_subset, list, [{'id': 'f62b97b4-f262-417c-8dc9-39bec9024665', 'name': 'test_hg'}]) +HostGroups (When C(hg) is in a given I(gather_subset), list, [{'id': 'f62b97b4-f262-417c-8dc9-39bec9024665', 'name': 'test_hg'}]) Provides details of all host groups. @@ -538,7 +555,7 @@ HostGroups (When hg is in a given gather_subset, list, [{'id': 'f62b97b4-f262-41 -Hosts (When host is in a given gather_subset, list, [{'id': '42a0d739-20e6-49ec-afa6-65d2b3c006c8', 'name': 'test_host'}]) +Hosts (When C(host) is in a given I(gather_subset), list, [{'id': '42a0d739-20e6-49ec-afa6-65d2b3c006c8', 'name': 'test_host'}]) Provides details of all hosts. @@ -551,7 +568,7 @@ Hosts (When host is in a given gather_subset, list, [{'id': '42a0d739-20e6-49ec- -LDAP (When ldap is in a given gather_subset, list, [{'id': '60ba0edd-551a-64f1-ce49-8a83a5bce479'}]) +LDAP (When C(ldap) is in a given I(gather_subset), list, [{'id': '60ba0edd-551a-64f1-ce49-8a83a5bce479'}]) Provides details of all LDAPs. @@ -560,7 +577,7 @@ LDAP (When ldap is in a given gather_subset, list, [{'id': '60ba0edd-551a-64f1-c -LDAPAccounts (When LDAP account is in a given gather_subset, list, [{'id': '5', 'role_id': '1', 'domain_id': '2', 'name': 'sample_ldap_user', 'type': 'User', 'type_l10n': 'User', 'dn': 'cn=sample_ldap_user,dc=ldap,dc=com'}]) +LDAPAccounts (When C(ldap_account) is in a given I(gather_subset), list, [{'id': '5', 'role_id': '1', 'domain_id': '2', 'name': 'sample_ldap_user', 'type': 'User', 'type_l10n': 'User', 'dn': 'cn=sample_ldap_user,dc=ldap,dc=com'}]) Provides details of all LDAP accounts. @@ -589,7 +606,7 @@ LDAPAccounts (When LDAP account is in a given gather_subset, list, [{'id': '5', -LDAPDomain (When LDAP domain configuration is in a given gather_subset, list, [{'id': '9', 'domain_name': 'domain.com', 'port': 636, 'protocol': 'LDAPS', 'protocol_l10n': 'LDAPS', 'bind_user': 'cn=ldapadmin,dc=domain,dc=com', 'ldap_timeout': 300000, 'ldap_server_type': 'OpenLDAP', 'ldap_server_type_l10n': 'OpenLDAP', 'is_global_catalog': False, 'user_id_attribute': 'uid', 'user_object_class': 'inetOrgPerson', 'user_search_path': 'dc=domain,dc=com', 'group_name_attribute': 'cn', 'group_member_attribute': 'member', 'group_object_class': 'groupOfNames', 'group_search_path': 'dc=domain,dc=com', 'group_search_level': 0, 'ldap_servers': ['10.xxx.xx.xxx']}]) +LDAPDomain (When C(ldap_domain) configuration is in a given I(gather_subset), list, [{'id': '9', 'domain_name': 'domain.com', 'port': 636, 'protocol': 'LDAPS', 'protocol_l10n': 'LDAPS', 'bind_user': 'cn=ldapadmin,dc=domain,dc=com', 'ldap_timeout': 300000, 'ldap_server_type': 'OpenLDAP', 'ldap_server_type_l10n': 'OpenLDAP', 'is_global_catalog': False, 'user_id_attribute': 'uid', 'user_object_class': 'inetOrgPerson', 'user_search_path': 'dc=domain,dc=com', 'group_name_attribute': 'cn', 'group_member_attribute': 'member', 'group_object_class': 'groupOfNames', 'group_search_path': 'dc=domain,dc=com', 'group_search_level': 0, 'ldap_servers': ['10.xxx.xx.xxx']}]) Provides details of the LDAP domain configurations. @@ -626,7 +643,7 @@ LDAPDomain (When LDAP domain configuration is in a given gather_subset, list, [{ is_global_catalog (, bool, ) - Whether or not the catalog is global. Default value is false. + Whether or not the catalog is global. Default value is ``false``. user_id_attribute (, str, ) @@ -670,7 +687,7 @@ LDAPDomain (When LDAP domain configuration is in a given gather_subset, list, [{ -LocalUsers (When user is in a given gather_subset, list, [{'id': '1', 'name': 'admin'}]) +LocalUsers (When C(user) is in a given I(gather_subset), list, [{'id': '1', 'name': 'admin'}]) Provides details of all local users. @@ -683,7 +700,7 @@ LocalUsers (When user is in a given gather_subset, list, [{'id': '1', 'name': 'a -NASServers (When nas_server is in a given gather_subset, list, [{'id': '61e1c9bb-b791-550e-a785-16c6ac7490fc', 'name': 'test_nas'}]) +NASServers (When C(nas_server) is in a given I(gather_subset), list, [{'id': '61e1c9bb-b791-550e-a785-16c6ac7490fc', 'name': 'test_nas'}]) Provides details of all nas servers. @@ -696,7 +713,7 @@ NASServers (When nas_server is in a given gather_subset, list, [{'id': '61e1c9bb -Networks (When network is in a given gather_subset, list, [{'id': 'NW1', 'name': 'Default Management Network'}]) +Networks (When C(network) is in a given I(gather_subset), list, [{'id': 'NW1', 'name': 'Default Management Network'}]) Provides details of all networks. @@ -709,7 +726,7 @@ Networks (When network is in a given gather_subset, list, [{'id': 'NW1', 'name': -NFSExports (When nfs_export is in a given gather_subset, list, [{'id': '61ef39a0-09b3-5339-c8bb-16c6ac7490fc', 'name': 'test_nfs'}]) +NFSExports (When C(nfs_export) is in a given I(gather_subset), list, [{'id': '61ef39a0-09b3-5339-c8bb-16c6ac7490fc', 'name': 'test_nfs'}]) Provides details of all nfs exports. @@ -722,7 +739,7 @@ NFSExports (When nfs_export is in a given gather_subset, list, [{'id': '61ef39a0 -Nodes (When a node is in a given gather_subset, list, [{'id': 'N1', 'name': 'Appliance-RT-D1006-node-A'}]) +Nodes (When a C(node) is in a given I(gather_subset), list, [{'id': 'N1', 'name': 'Appliance-RT-D1006-node-A'}]) Provides details of all nodes. @@ -735,7 +752,7 @@ Nodes (When a node is in a given gather_subset, list, [{'id': 'N1', 'name': 'App -NTP (When ntp is in a given gather_subset, list, [{'id': 'NTP1'}]) +NTP (When C(ntp) is in a given I(gather_subset), list, [{'id': 'NTP1'}]) Provides details of all NTP servers. @@ -744,7 +761,7 @@ NTP (When ntp is in a given gather_subset, list, [{'id': 'NTP1'}]) -ProtectionPolicies (When protection_policy is in a given gather_subset, list, [{'id': '4eff379c-090c-48e0-9949-b2cd0ce2cf88', 'name': 'test_protection_policy'}]) +ProtectionPolicies (When C(protection_policy) is in a given I(gather_subset), list, [{'id': '4eff379c-090c-48e0-9949-b2cd0ce2cf88', 'name': 'test_protection_policy'}]) Provides details of all protection policies. @@ -757,7 +774,7 @@ ProtectionPolicies (When protection_policy is in a given gather_subset, list, [{ -RemoteSupport (When remote_support is in a given gather_subset, list, [{'id': '0'}]) +RemoteSupport (When C(remote_support) is in a given I(gather_subset), list, [{'id': '0'}]) Provides details of all remote support config. @@ -766,7 +783,7 @@ RemoteSupport (When remote_support is in a given gather_subset, list, [{'id': '0 -RemoteSupportContact (When remote_support_contact is in a given gather_subset, list, [{'id': '0'}, {'id': '1'}]) +RemoteSupportContact (When C(remote_support_contact) is in a given I(gather_subset), list, [{'id': '0'}, {'id': '1'}]) Provides details of all remote support contacts. @@ -775,7 +792,44 @@ RemoteSupportContact (When remote_support_contact is in a given gather_subset, l -ReplicationRules (When replication_rule is in a given gather_subset, list, [{'id': '55d14477-de22-4d39-b24d-07cf08ba329f', 'name': 'ansible_rep_rule'}]) +ReplicationGroups (when C(replication_group) is in a given I(gather_subset)., list, [{'id': 'c4ba4ad3-2200-47d4-8f61-ddf51d83aac2', 'storage_container_id': '0b460d65-b8b6-40bf-8578-aa2e2fd3d02a', 'name': 'Ansible_RTD8337_VM', 'description': 'Ansible_RTD8337_VM', 'creator_type': 'User', 'creation_timestamp': '2023-05-16T13:58:09.348368+00:00', 'is_replication_destination': False, 'creator_type_l10n': 'User'}]) + Provide details of all replication group. + + + id (, str, ) + ID of the replication group. + + + name (, str, ) + Name of the replication group. + + + storage_container_id (, str, ) + ID of the storage container. + + + description (, str, ) + Description of the replication group. + + + creator_type (, str, ) + Creator type of the storage resource. + + + creation_timestamp (, str, ) + Timestamp when given replication group was created. + + + is_replication_destination (, bool, ) + Indicates whether replication group is replication destination or not. + + + creator_type_l10n (, str, ) + Localized message string corresponding to creator_type. + + + +ReplicationRules (When C(replication_rule) is in a given I(gather_subset), list, [{'id': '55d14477-de22-4d39-b24d-07cf08ba329f', 'name': 'ansible_rep_rule'}]) Provides details of all replication rules. @@ -788,7 +842,7 @@ ReplicationRules (When replication_rule is in a given gather_subset, list, [{'id -ReplicationSession (when replication_session given in gather_subset, list, [{'id': '0b0a7ae9-c0c4-4dce-8c49-570f4ea80bb0'}]) +ReplicationSession (when C(replication_session) given in I(gather_subset), list, [{'id': '0b0a7ae9-c0c4-4dce-8c49-570f4ea80bb0'}]) Details of all replication sessions. @@ -797,7 +851,7 @@ ReplicationSession (when replication_session given in gather_subset, list, [{'id -RemoteSystems (When remote_system is in a given gather_subset, list, [{'id': 'f07be373-dafd-4a46-8b21-f7cf790c287f', 'name': 'WN-D8978'}]) +RemoteSystems (When C(remote_system) is in a given I(gather_subset), list, [{'id': 'f07be373-dafd-4a46-8b21-f7cf790c287f', 'name': 'WN-D8978'}]) Provides details of all remote systems. @@ -810,7 +864,7 @@ RemoteSystems (When remote_system is in a given gather_subset, list, [{'id': 'f0 -Roles (When role is in a given gather_subset, list, [{'id': '1', 'name': 'Administrator'}, {'id': '2', 'name': 'Storage Administrator'}, {'id': '3', 'name': 'Operator'}, {'id': '4', 'name': 'VM Administrator'}, {'id': '5', 'name': 'Security Administrator'}, {'id': '6', 'name': 'Storage Operator'}]) +Roles (When C(role is in a given I(gather_subset, list, [{'id': '1', 'name': 'Administrator'}, {'id': '2', 'name': 'Storage Administrator'}, {'id': '3', 'name': 'Operator'}, {'id': '4', 'name': 'VM Administrator'}, {'id': '5', 'name': 'Security Administrator'}, {'id': '6', 'name': 'Storage Operator'}]) Provides details of all roles. @@ -823,7 +877,7 @@ Roles (When role is in a given gather_subset, list, [{'id': '1', 'name': 'Admini -SecurityConfig (When security_config is in a given gather_subset, list, [{'id': '1'}]) +SecurityConfig (When C(security_config) is in a given I(gather_subset), list, [{'id': '1'}]) Provides details of all security configs. @@ -832,7 +886,7 @@ SecurityConfig (When security_config is in a given gather_subset, list, [{'id': -SMBShares (When smb_share is in a given gather_subset, list, [{'id': '72ef39a0-09b3-5339-c8bb-16c6ac7490fc', 'name': 'test_smb'}]) +SMBShares (When C(smb_share) is in a given I(gather_subset), list, [{'id': '72ef39a0-09b3-5339-c8bb-16c6ac7490fc', 'name': 'test_smb'}]) Provides details of all smb shares. @@ -845,7 +899,7 @@ SMBShares (When smb_share is in a given gather_subset, list, [{'id': '72ef39a0-0 -SMTPConfig (When smtp_config is in a given gather_subset, list, [{'id': '0'}]) +SMTPConfig (When C(smtp_config) is in a given I(gather_subset), list, [{'id': '0'}]) Provides details of all smtp config. @@ -854,7 +908,7 @@ SMTPConfig (When smtp_config is in a given gather_subset, list, [{'id': '0'}]) -SnapshotRules (When snapshot_rule is in a given gather_subset, list, [{'id': 'e1b1bc3e-f8a1-4c81-a143-9ffd6af55837', 'name': 'Snapshot Rule Test'}]) +SnapshotRules (When C(snapshot_rule) is in a given I(gather_subset), list, [{'id': 'e1b1bc3e-f8a1-4c81-a143-9ffd6af55837', 'name': 'Snapshot Rule Test'}]) Provides details of all snapshot rules. @@ -867,7 +921,88 @@ SnapshotRules (When snapshot_rule is in a given gather_subset, list, [{'id': 'e1 -VolumeGroups (When vg is in a given gather_subset, list, [{'id': 'faaa8370-c62e-4fa2-b8ca-7f54419a5b40', 'name': 'Volume Group Test'}]) +StorageContainers (When C(storage_container) is in a given I(gather_subset), list, [{'datastores': [], 'destinations': [], 'id': 'e0ccd953-5650-41d8-9bce-f36d876d6a2a', 'name': 'Ansible_storage_container_1', 'quota': 21474836480, 'replication_groups': [], 'storage_protocol': 'NVMe', 'storage_protocol_l10n': 'NVMe', 'virtual_volumes': []}]) + Provide details of all storage containers. + + + id (, str, ) + ID of the storage container. + + + name (, str, ) + Name of the storage container. + + + storage_protocol (, str, ) + The type of storage container. + + + quota (, int, ) + The total number of bytes that can be provisioned/reserved against this storage container. + + + replication_groups (, list, ) + Properties of a Replication Group. + + + id (, str, ) + Unique identifier of the Replication Group instance. + + + name (, str, ) + Name of the Replication Group. + + + + virtual_volumes (, list, ) + The virtual volumes associated to the storage container. + + + id (, str, ) + The unique identifier of the virtual volume. + + + name (, str, ) + The name of the virtual volume. + + + + destinations (, list, ) + A storage container destination defines replication destination for a local storage container on a remote system. + + + id (, str, ) + The unique id of the storage container destination. + + + remote_system_id (, str, ) + The unique id of the remote system. + + + remote_system_name (, str, ) + The name of the remote system. + + + remote_storage_container_id (, str, ) + The unique id of the destination storage container on the remote system. + + + + datastores (, list, ) + List of associated datastores. + + + id (, str, ) + Unique identifier of the datastore instance. + + + name (, str, ) + User-assigned name of the datastore in vCenter. + + + + +VolumeGroups (When C(vg) is in a given I(gather_subset), list, [{'id': 'faaa8370-c62e-4fa2-b8ca-7f54419a5b40', 'name': 'Volume Group Test'}]) Provides details of all volume groups. @@ -880,7 +1015,7 @@ VolumeGroups (When vg is in a given gather_subset, list, [{'id': 'faaa8370-c62e- -Volumes (When vol is in a given gather_subset, list, [{'id': '01854336-94ef-4df9-b1e7-0a729ca7c944', 'name': 'test_vol'}]) +Volumes (When C(vol) is in a given I(gather_subset), list, [{'id': '01854336-94ef-4df9-b1e7-0a729ca7c944', 'name': 'test_vol'}]) Provides details of all volumes. @@ -893,7 +1028,7 @@ Volumes (When vol is in a given gather_subset, list, [{'id': '01854336-94ef-4df9 -TreeQuotas (When tree_quota is in a given gather_subset, list, [{'id': '00000003-0fe0-0001-0000-0000e8030000'}]) +TreeQuotas (When C(tree_quota) is in a given I(gather_subset), list, [{'id': '00000003-0fe0-0001-0000-0000e8030000'}]) Provides details of all tree quotas. @@ -906,7 +1041,7 @@ TreeQuotas (When tree_quota is in a given gather_subset, list, [{'id': '00000003 -UserQuotas (When user_quota is in a given gather_subset, list, [{'id': '00000003-0708-0000-0000-000004000080'}]) +UserQuotas (When C(user_quota) is in a given I(gather_subset), list, [{'id': '00000003-0708-0000-0000-000004000080'}]) Provides details of all user quotas. @@ -915,7 +1050,7 @@ UserQuotas (When user_quota is in a given gather_subset, list, [{'id': '00000003 -vCenter (When vCenter is in a given gather_subset, list, [{'id': '0d330d6c-3fe6-41c6-8023-5bd3fa7c61cd', 'instance_uuid': '0d330d6c-3fe6-41c6-8023-5bd3fa7c61cd', 'address': '10.x.x.x', 'username': 'administrator', 'version': '7.0.3', 'vendor_provider_status': 'Online', 'vendor_provider_status_l10n': 'Online', 'virtual_machines': [], 'datastores': [], 'vsphere_hosts': []}]) +vCenter (When C(vCenter) is in a given I(gather_subset), list, [{'id': '0d330d6c-3fe6-41c6-8023-5bd3fa7c61cd', 'instance_uuid': '0d330d6c-3fe6-41c6-8023-5bd3fa7c61cd', 'address': '10.x.x.x', 'username': 'administrator', 'version': '7.0.3', 'vendor_provider_status': 'Online', 'vendor_provider_status_l10n': 'Online', 'virtual_machines': [], 'datastores': [], 'vsphere_hosts': []}]) Provide details of all vCenters. @@ -960,7 +1095,7 @@ vCenter (When vCenter is in a given gather_subset, list, [{'id': '0d330d6c-3fe6- -VirtualVolume (When virtual_volume is in a given gather_subset, list, [{'id': '85643b54-9429-49ee-b7c3-b061fcdaab7c', 'name': 'test-centos_2.vmdk', 'size': 17179869184, 'type': 'Primary', 'usage_type': 'Data', 'appliance_id': 'A1', 'storage_container_id': '4dff1460-4d1e-48b6-98d8-cae8d7bf63b5', 'io_priority': 'Medium', 'profile_id': 'f4e5bade-15a2-4805-bf8e-52318c4ce443', 'replication_group_id': None, 'creator_type': 'User', 'is_readonly': False, 'migration_session_id': None, 'virtual_machine_uuid': '503629e5-8677-b26f-bf2d-e9f639bcc77f', 'family_id': '9ce8d828-14e3-44f8-bde1-a97f440a7259', 'parent_id': None, 'source_id': None, 'source_timestamp': None, 'creation_timestamp': '2022-12-27T10:01:32.622+00:00', 'naa_name': 'naa.68ccf09800918d7f008769d29bc6a43a', 'is_replication_destination': False, 'location_history': None, 'protection_policy_id': None, 'nsid': 5114, 'nguid': 'nguid.918d7f008769d29b8ccf096800c6a43a', 'type_l10n': 'Primary', 'usage_type_l10n': 'Data', 'io_priority_l10n': 'Medium', 'creator_type_l10n': 'User', 'host_virtual_volume_mappings': []}]) +VirtualVolume (When C(virtual_volume) is in a given I(gather_subset), list, [{'id': '85643b54-9429-49ee-b7c3-b061fcdaab7c', 'name': 'test-centos_2.vmdk', 'size': 17179869184, 'type': 'Primary', 'usage_type': 'Data', 'appliance_id': 'A1', 'storage_container_id': '4dff1460-4d1e-48b6-98d8-cae8d7bf63b5', 'io_priority': 'Medium', 'profile_id': 'f4e5bade-15a2-4805-bf8e-52318c4ce443', 'replication_group_id': None, 'creator_type': 'User', 'is_readonly': False, 'migration_session_id': None, 'virtual_machine_uuid': '503629e5-8677-b26f-bf2d-e9f639bcc77f', 'family_id': '9ce8d828-14e3-44f8-bde1-a97f440a7259', 'parent_id': None, 'source_id': None, 'source_timestamp': None, 'creation_timestamp': '2022-12-27T10:01:32.622+00:00', 'naa_name': 'naa.68ccf09800918d7f008769d29bc6a43a', 'is_replication_destination': False, 'location_history': None, 'protection_policy_id': None, 'nsid': 5114, 'nguid': 'nguid.918d7f008769d29b8ccf096800c6a43a', 'type_l10n': 'Primary', 'usage_type_l10n': 'Data', 'io_priority_l10n': 'Medium', 'creator_type_l10n': 'User', 'host_virtual_volume_mappings': []}]) Provides details of all virtual volumes. diff --git a/docs/modules/job.rst b/docs/modules/job.rst index 4388081..28bb905 100644 --- a/docs/modules/job.rst +++ b/docs/modules/job.rst @@ -20,7 +20,10 @@ Requirements ------------ The below requirements are needed on the host that executes this module. -- A Dell PowerStore Storage System. Ansible 2.12, 2.13 or 2.14 +- A Dell PowerStore storage system version 3.0.0.0 or later. +- Ansible-core 2.13 or later. +- PyPowerStore 2.0.0. +- Python 3.9, 3.10 or 3.11. @@ -35,12 +38,12 @@ Parameters IP or FQDN of the PowerStore management system. - verifycert (True, bool, None) + validate_certs (optional, bool, True) Boolean variable to specify whether to validate SSL certificate or not. - True - indicates that the SSL certificate should be verified. Set the environment variable REQUESTS_CA_BUNDLE to the path of the SSL certificate. + ``true`` - indicates that the SSL certificate should be verified. Set the environment variable REQUESTS_CA_BUNDLE to the path of the SSL certificate. - False - indicates that the SSL certificate should not be verified. + ``false`` - indicates that the SSL certificate should not be verified. user (True, str, None) @@ -70,7 +73,7 @@ Notes ----- .. note:: - - The check_mode is not supported. + - The *check_mode* is not supported. - The modules present in this collection named as 'dellemc.powerstore' are built to support the Dell PowerStore storage platform. @@ -85,7 +88,7 @@ Examples - name: Get Job Details dellemc.powerstore.job: array_ip: "{{mgmt_ip}}" - verifycert: "{{verifycert}}" + validate_certs: "{{validate_certs}}" user: "{{user}}" password: "{{password}}" job_id: "a544981c-e94a-40ab-9eae-e578e182d2bb" diff --git a/docs/modules/ldap_account.rst b/docs/modules/ldap_account.rst index d535f8c..19e07c0 100644 --- a/docs/modules/ldap_account.rst +++ b/docs/modules/ldap_account.rst @@ -20,7 +20,10 @@ Requirements ------------ The below requirements are needed on the host that executes this module. -- A Dell PowerStore Storage System. Ansible 2.12, 2.13 or 2.14 +- A Dell PowerStore storage system version 3.0.0.0 or later. +- Ansible-core 2.13 or later. +- PyPowerStore 2.0.0. +- Python 3.9, 3.10 or 3.11. @@ -60,21 +63,21 @@ Parameters state (True, str, None) Define whether the LDAP account should exist or not. - For Delete operation only, it should be set to "absent". + For Delete operation only, it should be set to ``absent``. - For all other operations except delete, it should be set to "present". + For all other operations except delete, it should be set to ``present``. array_ip (True, str, None) IP or FQDN of the PowerStore management system. - verifycert (True, bool, None) + validate_certs (optional, bool, True) Boolean variable to specify whether to validate SSL certificate or not. - True - indicates that the SSL certificate should be verified. Set the environment variable REQUESTS_CA_BUNDLE to the path of the SSL certificate. + ``true`` - indicates that the SSL certificate should be verified. Set the environment variable REQUESTS_CA_BUNDLE to the path of the SSL certificate. - False - indicates that the SSL certificate should not be verified. + ``false`` - indicates that the SSL certificate should not be verified. user (True, str, None) @@ -104,7 +107,7 @@ Notes ----- .. note:: - - The check_mode is supported. + - The *check_mode* is supported. - The modules present in this collection named as 'dellemc.powerstore' are built to support the Dell PowerStore storage platform. @@ -119,7 +122,7 @@ Examples - name: Create an LDAP account dellemc.powerstore.ldap_account: array_ip: "{{array_ip}}" - verifycert: "{{verifycert}}" + validate_certs: "{{validate_certs}}" user: "{{user}}" password: "{{password}}" ldap_account_name: "ldap_user_account_1" @@ -131,7 +134,7 @@ Examples - name: Get the details of the LDAP account by name dellemc.powerstore.ldap_account: array_ip: "{{array_ip}}" - verifycert: "{{verifycert}}" + validate_certs: "{{validate_certs}}" user: "{{user}}" password: "{{password}}" ldap_account_name: "ldap_user_account_1" @@ -140,7 +143,7 @@ Examples - name: Get the details of the LDAP account by id dellemc.powerstore.ldap_account: array_ip: "{{array_ip}}" - verifycert: "{{verifycert}}" + validate_certs: "{{validate_certs}}" user: "{{user}}" password: "{{password}}" ldap_account_id: "3" @@ -149,7 +152,7 @@ Examples - name: Modify an LDAP account dellemc.powerstore.ldap_account: array_ip: "{{array_ip}}" - verifycert: "{{verifycert}}" + validate_certs: "{{validate_certs}}" user: "{{user}}" password: "{{password}}" ldap_account_name: "ldap_user_account_1" @@ -159,7 +162,7 @@ Examples - name: Delete an LDAP account dellemc.powerstore.ldap_account: array_ip: "{{array_ip}}" - verifycert: "{{verifycert}}" + validate_certs: "{{validate_certs}}" user: "{{user}}" password: "{{password}}" ldap_account_id: "3" diff --git a/docs/modules/ldap_domain.rst b/docs/modules/ldap_domain.rst index 3758f20..7c99fc0 100644 --- a/docs/modules/ldap_domain.rst +++ b/docs/modules/ldap_domain.rst @@ -20,7 +20,10 @@ Requirements ------------ The below requirements are needed on the host that executes this module. -- A Dell PowerStore Storage System. Ansible 2.12, 2.13 or 2.14 +- A Dell PowerStore storage system version 3.0.0.0 or later. +- Ansible-core 2.13 or later. +- PyPowerStore 2.0.0. +- Python 3.9, 3.10 or 3.11. @@ -44,7 +47,7 @@ Parameters ldap_server_state (optional, str, None) State of the LDAP server. - The ldap_servers and ldap_server_state are required together. + The *ldap_servers* and *ldap_server_state* are required together. ldap_server_port (optional, int, None) @@ -86,13 +89,13 @@ Parameters user_id_attribute (optional, str, None) Name of the LDAP attribute whose value indicates the unique identifier of the user. - Default value is sAMAccountName. + Default value is ``sAMAccountName``. user_object_class (optional, str, None) LDAP object class for users. - Default value is user. + Default value is ``user``. user_search_path (optional, str, None) @@ -109,19 +112,19 @@ Parameters group_name_attribute (optional, str, None) Name of the LDAP attribute whose value indicates the group name. - Default value is cn. + Default value is ``cn``. group_member_attribute (optional, str, None) Name of the LDAP attribute whose value contains the names of group members within a group. - Default value is member. + Default value is ``member``. group_object_class (optional, str, None) LDAP object class for groups. - Default value is group. + Default value is ``group``. group_search_path (optional, str, None) @@ -144,21 +147,21 @@ Parameters state (True, str, None) Define whether the LDAP domain configuration should exist or not. - For Delete operation only, it should be set to "absent". + For Delete operation only, it should be set to ``absent``. - For all other operations except delete, it should be set to "present". + For all other operations except delete, it should be set to ``present``. array_ip (True, str, None) IP or FQDN of the PowerStore management system. - verifycert (True, bool, None) + validate_certs (optional, bool, True) Boolean variable to specify whether to validate SSL certificate or not. - True - indicates that the SSL certificate should be verified. Set the environment variable REQUESTS_CA_BUNDLE to the path of the SSL certificate. + ``true`` - indicates that the SSL certificate should be verified. Set the environment variable REQUESTS_CA_BUNDLE to the path of the SSL certificate. - False - indicates that the SSL certificate should not be verified. + ``false`` - indicates that the SSL certificate should not be verified. user (True, str, None) @@ -188,10 +191,10 @@ Notes ----- .. note:: - - The 'is_global_catalog' option can be enabled only for AD server type. + - The *is_global_catalog* option can be enabled only for AD server type. - To use LDAPS protocol, the pre-requisite is to upload the certificate of LDAP server on PowerStore array. - Verify operation does not support idempotency. - - The check_mode is supported. + - The *check_mode* is supported. - The modules present in this collection named as 'dellemc.powerstore' are built to support the Dell PowerStore storage platform. @@ -206,7 +209,7 @@ Examples - name: Create LDAP domain dellemc.powerstore.ldap_domain: array_ip: "{{array_ip}}" - verifycert: "{{verifycert}}" + validate_certs: "{{validate_certs}}" user: "{{user}}" password: "{{password}}" domain_name: "{{domain_name}}" @@ -225,7 +228,7 @@ Examples - name: Get LDAP domain details using ID dellemc.powerstore.ldap_domain: array_ip: "{{array_ip}}" - verifycert: "{{verifycert}}" + validate_certs: "{{validate_certs}}" user: "{{user}}" password: "{{password}}" ldap_domain_id: 4 @@ -234,7 +237,7 @@ Examples - name: Get LDAP domain details using name dellemc.powerstore.ldap_domain: array_ip: "{{array_ip}}" - verifycert: "{{verifycert}}" + validate_certs: "{{validate_certs}}" user: "{{user}}" password: "{{password}}" ldap_domain_name: "{{ldap_domain_name}}" @@ -243,17 +246,17 @@ Examples - name: Verify LDAP domain configuration dellemc.powerstore.ldap_domain: array_ip: "{{array_ip}}" - verifycert: "{{verifycert}}" + validate_certs: "{{validate_certs}}" user: "{{user}}" password: "{{password}}" ldap_domain_id: 4 - verify_configuration: True + verify_configuration: true state: "present" - name: Delete LDAP domain configuration dellemc.powerstore.ldap_domain: array_ip: "{{array_ip}}" - verifycert: "{{verifycert}}" + validate_certs: "{{validate_certs}}" user: "{{user}}" password: "{{password}}" ldap_domain_id: 4 @@ -262,7 +265,7 @@ Examples - name: Create LDAP domain with AD server type dellemc.powerstore.ldap_domain: array_ip: "{{array_ip}}" - verifycert: "{{verifycert}}" + validate_certs: "{{validate_certs}}" user: "{{user}}" password: "{{password}}" ldap_domain_name: "{{domain_name}}" @@ -272,7 +275,7 @@ Examples ldap_server_type: "AD" bind_user: "{{bind_user}}" bind_password: "{{bind_password}}" - is_global_catalog: True + is_global_catalog: true ldap_server_port: 3268 protocol: "LDAP" ldap_domain_user_settings: @@ -284,7 +287,7 @@ Examples - name: Get LDAP domain details using domain name dellemc.powerstore.ldap_domain: array_ip: "{{array_ip}}" - verifycert: "{{verifycert}}" + validate_certs: "{{validate_certs}}" user: "{{user}}" password: "{{password}}" ldap_domain_name: "{{domain_name}}" @@ -293,7 +296,7 @@ Examples - name: Delete LDAP domain using domain name dellemc.powerstore.ldap_domain: array_ip: "{{array_ip}}" - verifycert: "{{verifycert}}" + validate_certs: "{{validate_certs}}" user: "{{user}}" password: "{{password}}" ldap_domain_name: "{{domain_name}}" diff --git a/docs/modules/local_user.rst b/docs/modules/local_user.rst index 368f16e..3c869b0 100644 --- a/docs/modules/local_user.rst +++ b/docs/modules/local_user.rst @@ -20,7 +20,10 @@ Requirements ------------ The below requirements are needed on the host that executes this module. -- A Dell PowerStore Storage System. Ansible 2.12, 2.13 or 2.14 +- A Dell PowerStore storage system version 3.0.0.0 or later. +- Ansible-core 2.13 or later. +- PyPowerStore 2.0.0. +- Python 3.9, 3.10 or 3.11. @@ -28,7 +31,7 @@ Parameters ---------- user_name (optional, str, None) - Name of the local user account. Mutually exclusive with user_id. + Name of the local user account. Mutually exclusive with *user_id*. Mandatory only for create operation. @@ -36,7 +39,7 @@ Parameters user_id (optional, str, None) Unique identifier of the local user account. - Mutually exclusive with user_name. + Mutually exclusive with *user_name*. user_password (optional, str, None) @@ -52,19 +55,19 @@ Parameters role_name (optional, str, None) The name of the role to which the local user account will be mapped. - It is mutually exclusive with role_id. + It is mutually exclusive with *role_id*. role_id (optional, int, None) The unique identifier of the role to which the local user account will be mapped. - It is mutually exclusive with role_name. + It is mutually exclusive with *role_name*. is_locked (optional, bool, None) Whether the user account is locked or not. - Defaults to false at creation time. + Defaults to ``false`` at creation time. state (True, str, None) @@ -75,12 +78,12 @@ Parameters IP or FQDN of the PowerStore management system. - verifycert (True, bool, None) + validate_certs (optional, bool, True) Boolean variable to specify whether to validate SSL certificate or not. - True - indicates that the SSL certificate should be verified. Set the environment variable REQUESTS_CA_BUNDLE to the path of the SSL certificate. + ``true`` - indicates that the SSL certificate should be verified. Set the environment variable REQUESTS_CA_BUNDLE to the path of the SSL certificate. - False - indicates that the SSL certificate should not be verified. + ``false`` - indicates that the SSL certificate should not be verified. user (True, str, None) @@ -110,7 +113,7 @@ Notes ----- .. note:: - - The check_mode is not supported. + - The *check_mode* is not supported. - The modules present in this collection named as 'dellemc.powerstore' are built to support the Dell PowerStore storage platform. @@ -125,19 +128,19 @@ Examples - name: Create local user dellemc.powerstore.local_user: array_ip: "{{array_ip}}" - verifycert: "{{verifycert}}" + validate_certs: "{{validate_certs}}" user: "{{user}}" password: "{{password}}" user_name: "ansible_user_1" user_password: "Password123#" role_name: "role_1" - is_locked: False + is_locked: false state: "present" - name: Get the details local user with user id dellemc.powerstore.local_user: array_ip: "{{array_ip}}" - verifycert: "{{verifycert}}" + validate_certs: "{{validate_certs}}" user: "{{user}}" password: "{{password}}" user_id: "{{user_id}}" @@ -146,7 +149,7 @@ Examples - name: Get the details local user with user name dellemc.powerstore.local_user: array_ip: "{{array_ip}}" - verifycert: "{{verifycert}}" + validate_certs: "{{validate_certs}}" user: "{{user}}" password: "{{password}}" user_name: "ansible_user_1" @@ -155,20 +158,20 @@ Examples - name: Modify attributes of local user dellemc.powerstore.local_user: array_ip: "{{array_ip}}" - verifycert: "{{verifycert}}" + validate_certs: "{{validate_certs}}" user: "{{user}}" password: "{{password}}" user_name: "ansible_user_1" user_password: "Password123#" new_password: "Ansible123#" role_id: 4 - is_locked: True + is_locked: true state: "present" - name: Delete local user dellemc.powerstore.local_user: array_ip: "{{array_ip}}" - verifycert: "{{verifycert}}" + validate_certs: "{{validate_certs}}" user: "{{user}}" password: "{{password}}" user_name: "ansible_user_1" diff --git a/docs/modules/nasserver.rst b/docs/modules/nasserver.rst index f0835c5..4fdfead 100644 --- a/docs/modules/nasserver.rst +++ b/docs/modules/nasserver.rst @@ -20,7 +20,10 @@ Requirements ------------ The below requirements are needed on the host that executes this module. -- A Dell PowerStore Storage System. Ansible 2.12, 2.13 or 2.14 +- A Dell PowerStore storage system version 3.0.0.0 or later. +- Ansible-core 2.13 or later. +- PyPowerStore 2.0.0. +- Python 3.9, 3.10 or 3.11. @@ -28,11 +31,11 @@ Parameters ---------- nas_server_name (optional, str, None) - Name of the NAS server. Mutually exclusive with nas_server_id. + Name of the NAS server. Mutually exclusive with *nas_server_id*. nas_server_id (optional, str, None) - Unique id of the NAS server. Mutually exclusive with nas_server_name. + Unique id of the NAS server. Mutually exclusive with *nas_server_name*. description (optional, str, None) @@ -66,7 +69,7 @@ Parameters protection_policy (optional, str, None) Name/ID of the protection policy applied to the nas server. - Policy can be removed by passing an empty string in the protection_policy parameter. + Policy can be removed by passing an empty string in the *protection_policy* parameter. state (True, str, None) @@ -77,12 +80,12 @@ Parameters IP or FQDN of the PowerStore management system. - verifycert (True, bool, None) + validate_certs (optional, bool, True) Boolean variable to specify whether to validate SSL certificate or not. - True - indicates that the SSL certificate should be verified. Set the environment variable REQUESTS_CA_BUNDLE to the path of the SSL certificate. + ``true`` - indicates that the SSL certificate should be verified. Set the environment variable REQUESTS_CA_BUNDLE to the path of the SSL certificate. - False - indicates that the SSL certificate should not be verified. + ``false`` - indicates that the SSL certificate should not be verified. user (True, str, None) @@ -112,7 +115,7 @@ Notes ----- .. note:: - - The check_mode is not supported. + - The *check_mode* is not supported. - Adding/Removing protection policy to/from a NAS server is supported for PowerStore version 3.0.0 and above. - The modules present in this collection named as 'dellemc.powerstore' are built to support the Dell PowerStore storage platform. @@ -129,7 +132,7 @@ Examples - name: Get details of NAS Server by name dellemc.powerstore.nasserver: array_ip: "{{array_ip}}" - verifycert: "{{verifycert}}" + validate_certs: "{{validate_certs}}" user: "{{user}}" password: "{{password}}" nas_server_name: "{{nas_server_name}}" @@ -138,7 +141,7 @@ Examples - name: Get Details of NAS Server by ID dellemc.powerstore.nasserver: array_ip: "{{array_ip}}" - verifycert: "{{verifycert}}" + validate_certs: "{{validate_certs}}" user: "{{user}}" password: "{{password}}" nas_server_id: "{{nas_id}}" @@ -147,7 +150,7 @@ Examples - name: Rename NAS Server by Name dellemc.powerstore.nasserver: array_ip: "{{array_ip}}" - verifycert: "{{verifycert}}" + validate_certs: "{{validate_certs}}" user: "{{user}}" password: "{{password}}" nas_server_name: "{{nas_server_name}}" @@ -157,7 +160,7 @@ Examples - name: Modify NAS Server attributes by ID dellemc.powerstore.nasserver: array_ip: "{{array_ip}}" - verifycert: "{{verifycert}}" + validate_certs: "{{validate_certs}}" user: "{{user}}" password: "{{password}}" nas_server_id: "{{nas_id}}" @@ -170,7 +173,7 @@ Examples - name: Remove protection policy dellemc.powerstore.nasserver: array_ip: "{{array_ip}}" - verifycert: "{{verifycert}}" + validate_certs: "{{validate_certs}}" user: "{{user}}" password: "{{password}}" nas_server_id: "{{nas_id}}" diff --git a/docs/modules/network.rst b/docs/modules/network.rst index b2abb3e..796c620 100644 --- a/docs/modules/network.rst +++ b/docs/modules/network.rst @@ -20,7 +20,10 @@ Requirements ------------ The below requirements are needed on the host that executes this module. -- A Dell PowerStore Storage System. Ansible 2.12, 2.13 or 2.14 +- A Dell PowerStore storage system version 3.0.0.0 or later. +- Ansible-core 2.13 or later. +- PyPowerStore 2.0.0. +- Python 3.9, 3.10 or 3.11. @@ -32,7 +35,7 @@ Parameters This parameter is added in 2.0.0.0. - Specify either network_name or network_id for any operation. + Specify either *network_name* or *network_id* for any operation. network_id (optional, str, None) @@ -125,7 +128,7 @@ Parameters wait_for_completion (optional, bool, False) - Flag to indicate if the operation should be run synchronously or asynchronously. True signifies synchronous execution. By default, modify operation will run asynchronously. + Flag to indicate if the operation should be run synchronously or asynchronously. ``true`` signifies synchronous execution. By default, modify operation will run ``asynchronously``. state (True, str, None) @@ -136,12 +139,12 @@ Parameters IP or FQDN of the PowerStore management system. - verifycert (True, bool, None) + validate_certs (optional, bool, True) Boolean variable to specify whether to validate SSL certificate or not. - True - indicates that the SSL certificate should be verified. Set the environment variable REQUESTS_CA_BUNDLE to the path of the SSL certificate. + ``true`` - indicates that the SSL certificate should be verified. Set the environment variable REQUESTS_CA_BUNDLE to the path of the SSL certificate. - False - indicates that the SSL certificate should not be verified. + ``false`` - indicates that the SSL certificate should not be verified. user (True, str, None) @@ -172,9 +175,9 @@ Notes .. note:: - It is recommended to perform task asynchronously while changing cluster management address. - - Idempotency is not supported for vasa_provider_credentials and esxi_credentials. - - For PowerStore X model, vasa_provider_credentials has to be specified along with new_cluster_mgmt_address. - - The check_mode is not supported. + - Idempotency is not supported for *vasa_provider_credentials* and *esxi_credentials*. + - For PowerStore X model, *vasa_provider_credentials* has to be specified along with *new_cluster_mgmt_address*. + - The *check_mode* is not supported. - The modules present in this collection named as 'dellemc.powerstore' are built to support the Dell PowerStore storage platform. @@ -189,7 +192,7 @@ Examples - name: Get network details using ID dellemc.powerstore.network: array_ip: "{{array_ip}}" - verifycert: "{{verifycert}}" + validate_certs: "{{validate_certs}}" user: "{{user}}" password: "{{password}}" network_id: "NW1" @@ -198,7 +201,7 @@ Examples - name: Get network details using name dellemc.powerstore.network: array_ip: "{{array_ip}}" - verifycert: "{{verifycert}}" + validate_certs: "{{validate_certs}}" user: "{{user}}" password: "{{password}}" network_name: "Default Management Network" @@ -207,18 +210,18 @@ Examples - name: Rename the storage network dellemc.powerstore.network: array_ip: "{{array_ip}}" - verifycert: "{{verifycert}}" + validate_certs: "{{validate_certs}}" user: "{{user}}" password: "{{password}}" network_name: "Default Storage Network" new_name: "iSCSI Network" - wait_for_completion: True + wait_for_completion: true state: "present" - name: Replace the IP's in the management network and re-register VASA vendor provider dellemc.powerstore.network: array_ip: "{{array_ip}}" - verifycert: "{{verifycert}}" + validate_certs: "{{validate_certs}}" user: "{{user}}" password: "{{password}}" network_id: "NW1" @@ -238,7 +241,7 @@ Examples - name: Map port to the storage network dellemc.powerstore.network: array_ip: "{{array_ip}}" - verifycert: "{{verifycert}}" + validate_certs: "{{validate_certs}}" user: "{{user}}" password: "{{password}}" network_id: "NW6" @@ -250,7 +253,7 @@ Examples - name: Unmap port from the storage network dellemc.powerstore.network: array_ip: "{{array_ip}}" - verifycert: "{{verifycert}}" + validate_certs: "{{validate_certs}}" user: "{{user}}" password: "{{password}}" network_id: "NW6" @@ -263,7 +266,7 @@ Examples provider for X model dellemc.powerstore.network: array_ip: "{{array_ip1}}" - verifycert: "{{verifycert}}" + validate_certs: "{{validate_certs}}" user: "{{user}}" password: "{{password}}" network_id: "NW1" diff --git a/docs/modules/nfs.rst b/docs/modules/nfs.rst index 46eb54c..d028446 100644 --- a/docs/modules/nfs.rst +++ b/docs/modules/nfs.rst @@ -20,7 +20,10 @@ Requirements ------------ The below requirements are needed on the host that executes this module. -- A Dell PowerStore Storage System. Ansible 2.12, 2.13 or 2.14 +- A Dell PowerStore storage system version 3.0.0.0 or later. +- Ansible-core 2.13 or later. +- PyPowerStore 2.0.0. +- Python 3.9, 3.10 or 3.11. @@ -32,7 +35,7 @@ Parameters Mandatory for create operation. - Specify either nfs_export_name or nfs_export_id(but not both) for any operation. + Specify either *nfs_export_name* or *nfs_export_id* but not both for any operation. nfs_export_id (optional, str, None) @@ -44,19 +47,19 @@ Parameters Either filesystem or snapshot is required for creation of the NFS Export. - If filesystem name is specified, then nas_server is required to uniquely identify the filesystem. + If filesystem name is specified, then *nas_server* is required to uniquely identify the filesystem. - If filesystem parameter is provided, then snapshot cannot be specified. + If *filesystem* parameter is provided, then *snapshot* cannot be specified. snapshot (optional, str, None) The ID/Name of the Snapshot for which NFS export will be created. - Either filesystem or snapshot is required for creation of the NFS Export. + Either *filesystem* or *snapshot* is required for creation of the NFS Export. - If snapshot name is specified, then nas_server is required to uniquely identify the snapshot. + If snapshot name is specified, then *nas_server* is required to uniquely identify the snapshot. - If snapshot parameter is provided, then filesystem cannot be specified. + If *snapshot* parameter is provided, then *filesystem* cannot be specified. NFS export can be created only if access type of snapshot is "protocol". @@ -82,7 +85,7 @@ Parameters For hosts that need different access than the default, they can be configured by adding to the list. - If default_access is not mentioned during creation, then NFS export will be created with No_Access. + If *default_access* is not mentioned during creation, then NFS export will be created with ``No_Access``. no_access_hosts (optional, list, None) @@ -108,7 +111,7 @@ Parameters min_security (optional, str, None) NFS enforced security type for users accessing an NFS export. - If not specified at the time of creation, it will be set to SYS. + If not specified at the time of creation, it will be set to ``SYS``. anonymous_uid (optional, int, None) @@ -126,7 +129,7 @@ Parameters is_no_suid (optional, bool, None) If set, do not allow access to set SUID. Otherwise, allow access. - If not specified at the time of creation, it will be set to False. + If not specified at the time of creation, it will be set to ``false``. host_state (optional, str, None) @@ -143,12 +146,12 @@ Parameters IP or FQDN of the PowerStore management system. - verifycert (True, bool, None) + validate_certs (optional, bool, True) Boolean variable to specify whether to validate SSL certificate or not. - True - indicates that the SSL certificate should be verified. Set the environment variable REQUESTS_CA_BUNDLE to the path of the SSL certificate. + ``true`` - indicates that the SSL certificate should be verified. Set the environment variable REQUESTS_CA_BUNDLE to the path of the SSL certificate. - False - indicates that the SSL certificate should not be verified. + ``false`` - indicates that the SSL certificate should not be verified. user (True, str, None) @@ -178,7 +181,7 @@ Notes ----- .. note:: - - The check_mode is not supported. + - The *check_mode* is not supported. - The modules present in this collection named as 'dellemc.powerstore' are built to support the Dell PowerStore storage platform. @@ -193,7 +196,7 @@ Examples - name: Create NFS export (filesystem) dellemc.powerstore.nfs: array_ip: "{{array_ip}}" - verifycert: "{{verifycert}}" + validate_certs: "{{validate_certs}}" user: "{{user}}" password: "{{password}}" nfs_export_name: "{{export_name1}}" @@ -215,14 +218,14 @@ Examples min_security: "SYS" anonymous_uid: 1000 anonymous_gid: 1000 - is_no_suid: True + is_no_suid: true host_state: "present-in-export" state: "present" - name: Create NFS export Create NFS export for filesystem snapshot with mandatory parameters dellemc.powerstore.nfs: array_ip: "{{array_ip}}" - verifycert: "{{verifycert}}" + validate_certs: "{{validate_certs}}" user: "{{user}}" password: "{{password}}" nfs_export_name: "{{export_name2}}" @@ -234,7 +237,7 @@ Examples - name: Get NFS export details using ID dellemc.powerstore.nfs: array_ip: "{{array_ip}}" - verifycert: "{{verifycert}}" + validate_certs: "{{validate_certs}}" user: "{{user}}" password: "{{password}}" nfs_export_id: "{{export_id}}" @@ -243,7 +246,7 @@ Examples - name: Add Read-Only and Read-Write hosts to NFS export dellemc.powerstore.nfs: array_ip: "{{array_ip}}" - verifycert: "{{verifycert}}" + validate_certs: "{{validate_certs}}" user: "{{user}}" password: "{{password}}" nfs_export_id: "{{export_id}}" @@ -257,7 +260,7 @@ Examples - name: Remove Read-Only and Read-Write hosts from NFS export dellemc.powerstore.nfs: array_ip: "{{array_ip}}" - verifycert: "{{verifycert}}" + validate_certs: "{{validate_certs}}" user: "{{user}}" password: "{{password}}" nfs_export_id: "{{export_id}}" @@ -271,7 +274,7 @@ Examples - name: Modify the attributes of NFS export dellemc.powerstore.nfs: array_ip: "{{array_ip}}" - verifycert: "{{verifycert}}" + validate_certs: "{{validate_certs}}" user: "{{user}}" password: "{{password}}" nfs_export_id: "{{export_id}}" @@ -282,7 +285,7 @@ Examples - name: Delete NFS export using name dellemc.powerstore.nfs: array_ip: "{{array_ip}}" - verifycert: "{{verifycert}}" + validate_certs: "{{validate_certs}}" user: "{{user}}" password: "{{password}}" nfs_export_name: "{{export_name}}" diff --git a/docs/modules/ntp.rst b/docs/modules/ntp.rst index ac8d490..84fba02 100644 --- a/docs/modules/ntp.rst +++ b/docs/modules/ntp.rst @@ -20,7 +20,10 @@ Requirements ------------ The below requirements are needed on the host that executes this module. -- A Dell PowerStore Storage System. Ansible 2.12, 2.13 or 2.14 +- A Dell PowerStore storage system version 3.0.0.0 or later. +- Ansible-core 2.13 or later. +- PyPowerStore 2.0.0. +- Python 3.9, 3.10 or 3.11. @@ -31,30 +34,30 @@ Parameters Unique identifier of the NTP instance. - ntp_addresses (False, list, None) + ntp_addresses (optional, list, None) NTP server addresses, may contain host names or IPv4 addresses. - ntp_address_state (False, str, None) - State of the addresses mentioned in ntp_addresses. + ntp_address_state (optional, str, None) + State of the addresses mentioned in *ntp_addresses*. state (True, str, None) The state of the NTP instance after the task is performed. - For get and modify operations it should be set to "present". + For get and modify operations it should be set to ``present``. array_ip (True, str, None) IP or FQDN of the PowerStore management system. - verifycert (True, bool, None) + validate_certs (optional, bool, True) Boolean variable to specify whether to validate SSL certificate or not. - True - indicates that the SSL certificate should be verified. Set the environment variable REQUESTS_CA_BUNDLE to the path of the SSL certificate. + ``true`` - indicates that the SSL certificate should be verified. Set the environment variable REQUESTS_CA_BUNDLE to the path of the SSL certificate. - False - indicates that the SSL certificate should not be verified. + ``false`` - indicates that the SSL certificate should not be verified. user (True, str, None) @@ -85,9 +88,9 @@ Notes .. note:: - Minimum 1 and maximum 3 addresses can be associated to a NTP instance. - - Parameters ntp_addresses and ntp_address_state are required together. + - Parameters *ntp_addresses* and *ntp_address_state* are required together. - Creation and deletion of NTP is not supported. - - The check_mode is not supported. + - The *check_mode* is not supported. - The modules present in this collection named as 'dellemc.powerstore' are built to support the Dell PowerStore storage platform. @@ -104,7 +107,7 @@ Examples array_ip: "{{array_ip}}" user: "{{user}}" password: "{{password}}" - verifycert: "{{verifycert}}" + validate_certs: "{{validate_certs}}" ntp_id: "NTP1" state: "present" @@ -113,7 +116,7 @@ Examples array_ip: "{{array_ip}}" user: "{{user}}" password: "{{password}}" - verifycert: "{{verifycert}}" + validate_certs: "{{validate_certs}}" ntp_id: "NTP1" ntp_addresses: - "XX.XX.XX.XX" @@ -126,7 +129,7 @@ Examples array_ip: "{{array_ip}}" user: "{{user}}" password: "{{password}}" - verifycert: "{{verifycert}}" + validate_certs: "{{validate_certs}}" ntp_id: "NTP1" ntp_addresses: - "YY.YY.YY.YY" diff --git a/docs/modules/protectionpolicy.rst b/docs/modules/protectionpolicy.rst index af697c1..edc4e97 100644 --- a/docs/modules/protectionpolicy.rst +++ b/docs/modules/protectionpolicy.rst @@ -20,18 +20,21 @@ Requirements ------------ The below requirements are needed on the host that executes this module. -- A Dell PowerStore Storage System. Ansible 2.12, 2.13 or 2.14 +- A Dell PowerStore storage system version 3.0.0.0 or later. +- Ansible-core 2.13 or later. +- PyPowerStore 2.0.0. +- Python 3.9, 3.10 or 3.11. Parameters ---------- - name (False, str, None) + name (optional, str, None) String variable. Indicates the name of the protection policy. - protectionpolicy_id (False, str, None) + protectionpolicy_id (optional, str, None) String variable. Indicates the id of the protection policy. @@ -41,26 +44,26 @@ Parameters Used for renaming operation. - snapshotrules (False, list, None) + snapshotrules (optional, list, None) List of strings to specify the name or ids of snapshot rules which are to be added or removed, to or from, the protection policy. - replicationrule (False, str, None) + replicationrule (optional, str, None) The name or ids of the replcation rule which is to be added to the protection policy. To remove the replication rule, an empty string has to be passed. - description (False, str, None) + description (optional, str, None) String variable. Indicates the description of the protection policy. state (True, str, None) String variable. Indicates the state of protection policy. - For Delete operation only, it should be set to "absent". + For Delete operation only, it should be set to ``absent``. - For all other operations like Create, Modify or Get details, it should be set to "present". + For all other operations like Create, Modify or Get details, it should be set to ``present``. snapshotrule_state (False, str, None) @@ -68,21 +71,21 @@ Parameters When snapshot rules are specified, this variable is required. - Value present-in-policy indicates to add to protection policy. + Value ``present-in-policy`` indicates to add to protection policy. - Value absent-in-policy indicates to remove from protection policy. + Value ``absent-in-policy`` indicates to remove from protection policy. array_ip (True, str, None) IP or FQDN of the PowerStore management system. - verifycert (True, bool, None) + validate_certs (optional, bool, True) Boolean variable to specify whether to validate SSL certificate or not. - True - indicates that the SSL certificate should be verified. Set the environment variable REQUESTS_CA_BUNDLE to the path of the SSL certificate. + ``true`` - indicates that the SSL certificate should be verified. Set the environment variable REQUESTS_CA_BUNDLE to the path of the SSL certificate. - False - indicates that the SSL certificate should not be verified. + ``false`` - indicates that the SSL certificate should not be verified. user (True, str, None) @@ -114,7 +117,7 @@ Notes .. note:: - Before deleting a protection policy, the replication rule has to be removed from the protection policy. - In PowerStore version 3.0.0.0, protection policy without snapshot rule/replication rule is not allowed. - - The check_mode is not supported. + - The *check_mode* is not supported. - The modules present in this collection named as 'dellemc.powerstore' are built to support the Dell PowerStore storage platform. @@ -130,7 +133,7 @@ Examples - name: Create a protection policy with snapshot rule and replication rule dellemc.powerstore.protectionpolicy: array_ip: "{{array_ip}}" - verifycert: "{{verifycert}}" + validate_certs: "{{validate_certs}}" user: "{{user}}" password: "{{password}}" name: "{{name}}" @@ -145,7 +148,7 @@ Examples - name : Modify protection policy, change name dellemc.powerstore.protectionpolicy: array_ip: "{{array_ip}}" - verifycert: "{{verifycert}}" + validate_certs: "{{validate_certs}}" user: "{{user}}" password: "{{password}}" name: "{{name}}" @@ -156,7 +159,7 @@ Examples - name : Modify protection policy, add snapshot rule dellemc.powerstore.protectionpolicy: array_ip: "{{array_ip}}" - verifycert: "{{verifycert}}" + validate_certs: "{{validate_certs}}" user: "{{user}}" password: "{{password}}" name: "{{name}}" @@ -168,7 +171,7 @@ Examples - name : Modify protection policy, remove snapshot rule, replication rule dellemc.powerstore.protectionpolicy: array_ip: "{{array_ip}}" - verifycert: "{{verifycert}}" + validate_certs: "{{validate_certs}}" user: "{{user}}" password: "{{password}}" name: "{{name}}" @@ -181,7 +184,7 @@ Examples - name : Get details of protection policy by name dellemc.powerstore.protectionpolicy: array_ip: "{{array_ip}}" - verifycert: "{{verifycert}}" + validate_certs: "{{validate_certs}}" user: "{{user}}" password: "{{password}}" name: "{{name}}" @@ -190,7 +193,7 @@ Examples - name : Get details of protection policy by ID dellemc.powerstore.protectionpolicy: array_ip: "{{array_ip}}" - verifycert: "{{verifycert}}" + validate_certs: "{{validate_certs}}" user: "{{user}}" password: "{{password}}" protectionpolicy_id: "{{protectionpolicy_id}}" @@ -199,7 +202,7 @@ Examples - name : Delete protection policy dellemc.powerstore.protectionpolicy: array_ip: "{{array_ip}}" - verifycert: "{{verifycert}}" + validate_certs: "{{validate_certs}}" user: "{{user}}" password: "{{password}}" name: "{{name}}" diff --git a/docs/modules/quota.rst b/docs/modules/quota.rst index 343e0df..d192248 100644 --- a/docs/modules/quota.rst +++ b/docs/modules/quota.rst @@ -20,7 +20,10 @@ Requirements ------------ The below requirements are needed on the host that executes this module. -- A Dell PowerStore Storage System. Ansible 2.12, 2.13 or 2.14 +- A Dell PowerStore storage system version 3.0.0.0 or later. +- Ansible-core 2.13 or later. +- PyPowerStore 2.0.0. +- Python 3.9, 3.10 or 3.11. @@ -32,7 +35,7 @@ Parameters Path is relative to the root of the filesystem. - For user quota, if path is not specified, quota will be created at the root of the filesystem. + For user quota, if *path* is not specified, quota will be created at the root of the filesystem. quota_type (optional, str, None) @@ -42,13 +45,13 @@ Parameters quota_id (optional, str, None) Id of the user/tree quota. - If quota_id is mentioned, then path/nas_server/file_system/quota_type is not required. + If *quota_id* is mentioned, then *path*/*nas_server*/*file_system*/*quota_type* is not required. filesystem (optional, str, None) The ID/Name of the filesystem for which the Tree/User Quota will be created. - If filesystem name is specified, then nas_server is required to uniquely identify the filesystem. + If filesystem name is specified, then *nas_server* is required to uniquely identify the filesystem. nas_server (optional, str, None) @@ -58,13 +61,13 @@ Parameters description (optional, str, None) Additional information that can be mentioned for a Tree Quota. - Description parameter can only be used when quota_type is 'tree'. + Description parameter can only be used when *quota_type* is ``tree``. unix_name (optional, str, None) The name of the unix user account for which quota operations will be performed. - Any one among uid/unix_name/windows_name/windows_sid is required when quota_type is 'user'. + Any one among ``uid``/``unix_name``/``windows_name``/``windows_sid`` is required when *quota_type* is ``user``. windows_name (optional, str, None) @@ -72,19 +75,19 @@ Parameters The name should be mentioned along with Domain Name as 'DOMAIN_NAME\user_name' or as "DOMAIN_NAME\\user_name". - Any one among uid/unix_name/windows_name/windows_sid is required when quota_type is 'user'. + Any one among ``uid``/``unix_name``/``windows_name``/``windows_sid`` is required when *quota_type* is ``user``. uid (optional, int, None) The ID of the unix user account for which quota operations will be performed. - Any one among uid/unix_name/windows_name/windows_sid is required when quota_type is 'user'. + Any one among ``uid``/``unix_name``/``windows_name``/``windows_sid`` is required when *quota_type* is ``user``. windows_sid (optional, str, None) The SID of the Windows User account for which quota operations will be performed. - Any one among uid/unix_name/windows_name/windows_sid is required when quota_type is 'user'. + Any one among ``uid``/``unix_name``/``windows_name``/``windows_sid`` is required when *quota_type* is ``user``. quota (optional, dict, None) @@ -94,13 +97,13 @@ Parameters soft_limit (optional, int, None) Soft limit of the User/Tree quota. - No Soft limit when set to 0. + No Soft limit when set to ``0``. hard_limit (optional, int, None) Hard limit of the user quota. - No hard limit when set to 0. + No hard limit when set to ``0``. cap_unit (optional, str, GB) @@ -113,21 +116,21 @@ Parameters state (True, str, None) Define whether the Quota should exist or not. - Value present indicates that the Quota should exist on the system. + Value ``present`` indicates that the Quota should exist on the system. - Value absent indicates that the Quota should not exist on the system. + Value ``absent`` indicates that the Quota should not exist on the system. array_ip (True, str, None) IP or FQDN of the PowerStore management system. - verifycert (True, bool, None) + validate_certs (optional, bool, True) Boolean variable to specify whether to validate SSL certificate or not. - True - indicates that the SSL certificate should be verified. Set the environment variable REQUESTS_CA_BUNDLE to the path of the SSL certificate. + ``true`` - indicates that the SSL certificate should be verified. Set the environment variable REQUESTS_CA_BUNDLE to the path of the SSL certificate. - False - indicates that the SSL certificate should not be verified. + ``false`` - indicates that the SSL certificate should not be verified. user (True, str, None) @@ -158,13 +161,13 @@ Notes .. note:: - Tree quota cannot be created at the root of the filesystem. - - When the ID of the filesystem is passed then nas_server is not required. If passed, then filesystem should exist for the nas_server, else the task will fail. + - When the ID of the filesystem is passed then *nas_server* is not required. If passed, then filesystem should exist for the *nas_server*, else the task will fail. - If a primary directory of the current directory or a subordinate directory of the path is having a Tree Quota configured, then the quota for that path cannot be created. - Hierarchical tree quotas are not allowed. - When the first quota is created for a directory/user in a filesystem then the quotas will be enabled for that filesystem automatically. - If a user quota is to be created on a tree quota, then the user quotas will be enabled automatically in a tree quota. - - Delete User Quota operation is not supported. - - The check_mode is not supported. + - ``Delete`` User Quota operation is not supported. + - The *check_mode* is not supported. - The modules present in this collection named as 'dellemc.powerstore' are built to support the Dell PowerStore storage platform. @@ -180,7 +183,7 @@ Examples - name: Create a Quota for a User using unix name dellemc.powerstore.quota: array_ip: "{{array_ip}}" - verifycert: "{{verify_cert}}" + validate_certs: "{{validate_certs}}" user: "{{user}}" password: "{{password}}" quota_type: "user" @@ -196,7 +199,7 @@ Examples - name: Create a Tree Quota dellemc.powerstore.quota: array_ip: "{{array_ip}}" - verifycert: "{{verify_cert}}" + validate_certs: "{{validate_certs}}" user: "{{user}}" password: "{{password}}" quota_type: "tree" @@ -212,7 +215,7 @@ Examples - name: Modify attributes for Tree Quota dellemc.powerstore.quota: array_ip: "{{array_ip}}" - verifycert: "{{verify_cert}}" + validate_certs: "{{validate_certs}}" user: "{{user}}" password: "{{password}}" quota_id: "{{quota_id}}" @@ -225,7 +228,7 @@ Examples - name: Get details of User Quota dellemc.powerstore.quota: array_ip: "{{array_ip}}" - verifycert: "{{verify_cert}}" + validate_certs: "{{validate_certs}}" user: "{{user}}" password: "{{password}}" quota_type: "user" @@ -237,7 +240,7 @@ Examples - name: Get details of Tree Quota dellemc.powerstore.quota: array_ip: "{{array_ip}}" - verifycert: "{{verify_cert}}" + validate_certs: "{{validate_certs}}" user: "{{user}}" password: "{{password}}" quota_id: "{{quota_id}}" @@ -246,7 +249,7 @@ Examples - name: Delete a Tree Quota dellemc.powerstore.quota: array_ip: "{{array_ip}}" - verifycert: "{{verify_cert}}" + validate_certs: "{{validate_certs}}" user: "{{user}}" password: "{{password}}" quota_type: "tree" @@ -261,7 +264,7 @@ Examples Return Values ------------- -changed (always, bool, True) +changed (always, bool, true) Whether or not the resource has changed. diff --git a/docs/modules/remote_support.rst b/docs/modules/remote_support.rst index f11711a..fa1095b 100644 --- a/docs/modules/remote_support.rst +++ b/docs/modules/remote_support.rst @@ -22,7 +22,10 @@ Requirements ------------ The below requirements are needed on the host that executes this module. -- A Dell PowerStore Storage System. Ansible 2.12, 2.13 or 2.14 +- A Dell PowerStore storage system version 3.0.0.0 or later. +- Ansible-core 2.13 or later. +- PyPowerStore 2.0.0. +- Python 3.9, 3.10 or 3.11. @@ -33,15 +36,15 @@ Parameters Unique identifier of the remote support configuration. - support_type (False, str, None) + support_type (optional, str, None) The type of remote support that is configured. Mandatory for modify and verify operation. - SRS_Gateway support_type is only supported for verify operation. + ``SRS_Gateway``, *support_type* is only supported for verify operation. - remote_support_servers (False, list, None) + remote_support_servers (optional, list, None) One or two remote support servers. @@ -58,82 +61,82 @@ Parameters is_primary (optional, bool, None) Indicates whether the server is acting as the primary. - One server must be set to false when two servers are configured. + One server must be set to ``false`` when two servers are configured. - server_state (False, str, None) - Indicates the state of the remote-support_servers. + server_state (optional, str, None) + Indicates the state of the remote_support_servers. - Required with remote_support_servers. + Required with *remote_support_servers*. - is_support_assist_license_accepted (False, bool, None) + is_support_assist_license_accepted (optional, bool, None) Indicates whether user has accepted remote support license agreement before enabling the Support Assist on the system for the first time. - is_cloudiq_enabled (False, bool, None) + is_cloudiq_enabled (optional, bool, None) Indicates whether support for CloudIQ is enabled. - is_rsc_enabled (False, bool, None) + is_rsc_enabled (optional, bool, None) Indicates whether support for Remote Service Credentials is enabled. - proxy_address (False, str, None) + proxy_address (optional, str, None) Proxy server IP address (IPv4). - proxy_port (False, int, None) + proxy_port (optional, int, None) Proxy server port number. - proxy_username (False, str, None) + proxy_username (optional, str, None) User name for proxy server access. - proxy_password (False, str, None) + proxy_password (optional, str, None) Password for proxy server access. - is_icw_configured (False, bool, None) + is_icw_configured (optional, bool, None) Client already configured ICW. - verify_connection (False, bool, False) + verify_connection (optional, bool, False) Indicates whether to perform the verify call or not. - send_test_alert (False, bool, False) + send_test_alert (optional, bool, False) Indicates whether to send a test alert or not. wait_for_completion (optional, bool, False) - Flag to indicate if the operation should be run synchronously or asynchronously. True signifies synchronous execution. By default, modify operation will run asynchronously. + Flag to indicate if the operation should be run synchronously or asynchronously. ``true`` signifies synchronous execution. By default, modify operation will run asynchronously. - return_support_license_text (False, bool, False) + return_support_license_text (optional, bool, False) Indicates whether to return support license agreement text or not. state (True, str, None) The state of the remote support configuration after the task is performed. - For Delete operation only, it should be set to "absent". + For Delete operation only, it should be set to ``absent``. - For get/modify operation it should be set to "present". + For get/modify operation it should be set to ``present``. array_ip (True, str, None) IP or FQDN of the PowerStore management system. - verifycert (True, bool, None) + validate_certs (optional, bool, True) Boolean variable to specify whether to validate SSL certificate or not. - True - indicates that the SSL certificate should be verified. Set the environment variable REQUESTS_CA_BUNDLE to the path of the SSL certificate. + ``true`` - indicates that the SSL certificate should be verified. Set the environment variable REQUESTS_CA_BUNDLE to the path of the SSL certificate. - False - indicates that the SSL certificate should not be verified. + ``false`` - indicates that the SSL certificate should not be verified. user (True, str, None) @@ -164,7 +167,7 @@ Notes .. note:: - Creation and deletion of remote support configuration is not supported. - - Support for check_mode is not available for this module. + - Support for *check_mode* is not available for this module. - Verify and send test alert operations do not support idempotency. - The modules present in this collection named as 'dellemc.powerstore' are built to support the Dell PowerStore storage platform. @@ -183,7 +186,7 @@ Examples array_ip: "{{array_ip}}" user: "{{user}}" password: "{{password}}" - verifycert: "{{verifycert}}" + validate_certs: "{{validate_certs}}" remote_support_id: 0 state: "present" @@ -192,19 +195,19 @@ Examples array_ip: "{{array_ip}}" user: "{{user}}" password: "{{password}}" - verifycert: "{{verifycert}}" + validate_certs: "{{validate_certs}}" remote_support_id: 0 support_type: "SRS_Gateway_Tier2" remote_support_servers: - address: "10.XX.XX.XX" port: 9443 - is_primary: True + is_primary: true - address: "10.XX.XX.YY" port: 9443 - is_primary: False + is_primary: false server_state: "present-in-server" - is_rsc_enabled: True - is_cloudiq_enabled: False + is_rsc_enabled: true + is_cloudiq_enabled: false timeout: 300 state: "present" @@ -213,7 +216,7 @@ Examples array_ip: "{{array_ip}}" user: "{{user}}" password: "{{password}}" - verifycert: "{{verifycert}}" + validate_certs: "{{validate_certs}}" remote_support_id: 0 support_type: "SRS_Integrated_Tier2" proxy_address: "10.XX.XX.ZZ" @@ -228,11 +231,11 @@ Examples array_ip: "{{array_ip}}" user: "{{user}}" password: "{{password}}" - verifycert: "{{verifycert}}" + validate_certs: "{{validate_certs}}" remote_support_id: 0 support_type: "SRS_Integrated_Tier3" timeout: 300 - verify_connection: True + verify_connection: true state: "present" - name: Send a test alert @@ -240,9 +243,9 @@ Examples array_ip: "{{array_ip}}" user: "{{user}}" password: "{{password}}" - verifycert: "{{verifycert}}" + validate_certs: "{{validate_certs}}" remote_support_id: 0 - send_test_alert: True + send_test_alert: true state: "present" diff --git a/docs/modules/remote_support_contact.rst b/docs/modules/remote_support_contact.rst index ee7b3fb..39ba7f7 100644 --- a/docs/modules/remote_support_contact.rst +++ b/docs/modules/remote_support_contact.rst @@ -20,7 +20,10 @@ Requirements ------------ The below requirements are needed on the host that executes this module. -- A Dell PowerStore Storage System. Ansible 2.12, 2.13 or 2.14 +- A Dell PowerStore storage system version 3.0.0.0 or later. +- Ansible-core 2.13 or later. +- PyPowerStore 2.0.0. +- Python 3.9, 3.10 or 3.11. @@ -31,40 +34,40 @@ Parameters Unique identifier of the remote support contact. - first_name (False, str, None) + first_name (optional, str, None) The first name of the support contact for this system. - last_name (False, str, None) + last_name (optional, str, None) The last name of the support contact for this system. - phone (False, str, None) + phone (optional, str, None) The phone number of this support contact for this system. - email (False, str, None) + email (optional, str, None) The email address of the support contact for this system. state (True, str, None) The state of the remote support contact after the task is performed. - For Delete operation only, it should be set to "absent". + For Delete operation only, it should be set to ``absent``. - For get/modify operation it should be set to "present". + For get/modify operation it should be set to ``present``. array_ip (True, str, None) IP or FQDN of the PowerStore management system. - verifycert (True, bool, None) + validate_certs (optional, bool, True) Boolean variable to specify whether to validate SSL certificate or not. - True - indicates that the SSL certificate should be verified. Set the environment variable REQUESTS_CA_BUNDLE to the path of the SSL certificate. + ``true`` - indicates that the SSL certificate should be verified. Set the environment variable REQUESTS_CA_BUNDLE to the path of the SSL certificate. - False - indicates that the SSL certificate should not be verified. + ``false`` - indicates that the SSL certificate should not be verified. user (True, str, None) @@ -95,8 +98,8 @@ Notes .. note:: - Creation and deletion of remote support contact is not supported. - - Parameters first_name, last_name, email and phone can be removed by passing empty string. - - The check_mode is not supported. + - Parameters *first_name*, *last_name*, *email* and *phone* can be removed by passing empty string. + - The *check_mode* is not supported. - The modules present in this collection named as 'dellemc.powerstore' are built to support the Dell PowerStore storage platform. @@ -114,7 +117,7 @@ Examples array_ip: "{{array_ip}}" user: "{{user}}" password: "{{password}}" - verifycert: "{{verifycert}}" + validate_certs: "{{validate_certs}}" contact_id: 0 state: "present" @@ -123,7 +126,7 @@ Examples array_ip: "{{array_ip}}" user: "{{user}}" password: "{{password}}" - verifycert: "{{verifycert}}" + validate_certs: "{{validate_certs}}" contact_id: 0 first_name: "abc" last_name: "xyz" diff --git a/docs/modules/remotesystem.rst b/docs/modules/remotesystem.rst index 0be7376..9d7cb42 100644 --- a/docs/modules/remotesystem.rst +++ b/docs/modules/remotesystem.rst @@ -22,62 +22,65 @@ Requirements ------------ The below requirements are needed on the host that executes this module. -- A Dell PowerStore Storage System. Ansible 2.12, 2.13 or 2.14 +- A Dell PowerStore storage system version 3.0.0.0 or later. +- Ansible-core 2.13 or later. +- PyPowerStore 2.0.0. +- Python 3.9, 3.10 or 3.11. Parameters ---------- - remote_name (False, str, None) + remote_name (optional, str, None) Name of the remote system. - Parameter remote_name cannot be mentioned during addition of a new remote system. + Parameter *remote_name* cannot be mentioned during addition of a new remote system. - remote_id (False, str, None) + remote_id (optional, str, None) ID of the remote system. ID for the remote system is autogenerated, cannot be passed during creation of a remote system. - Parameter remote_id and remote_address are mutually exclusive. + Parameter *remote_id* and *remote_address* are mutually exclusive. - remote_user (False, str, None) + remote_user (optional, str, None) Username used in basic authentication to remote PowerStore cluster. It can be mentioned only during creation of the remote system. - remote_password (False, str, None) + remote_password (optional, str, None) Password used in basic authentication to remote PowerStore cluster. It can be mentioned only during creation of the remote system. - remote_address (False, str, None) + remote_address (optional, str, None) Management IP of the remote system. - Parameter remote_id and remote_address are mutually exclusive. + Parameter *remote_id* and *remote_address* are mutually exclusive. - new_remote_address (False, str, None) + new_remote_address (optional, str, None) New management IP of the remote system. - remote_port (False, int, 443) + remote_port (optional, int, 443) Remote system's port number. It can be mentioned only during creation of the remote system. - description (False, str, None) + description (optional, str, None) Additional information about the remote system. To remove the description empty string is to be passed. - network_latency (False, str, None) + network_latency (optional, str, None) Replication traffic can be tuned for higher efficiency depending on the expected network latency. Setting to low will have latency of less than five milliseconds. @@ -85,10 +88,10 @@ Parameters Setting to high will have latency of more than five milliseconds. - wait_for_completion (False, bool, False) + wait_for_completion (optional, bool, False) Flag to indicate if the operation should be run synchronously or asynchronously. - True signifies synchronous execution. + ``true`` signifies synchronous execution. By default, modify and delete operation will run asynchronously. @@ -96,21 +99,21 @@ Parameters state (True, str, None) The state of the remote system after the task is performed. - For Delete operation only, it should be set to "absent". + For Delete operation only, it should be set to ``absent``. - For all Create, Modify or Get details operations it should be set to "present". + For all Create, Modify or Get details operations it should be set to ``present``. array_ip (True, str, None) IP or FQDN of the PowerStore management system. - verifycert (True, bool, None) + validate_certs (optional, bool, True) Boolean variable to specify whether to validate SSL certificate or not. - True - indicates that the SSL certificate should be verified. Set the environment variable REQUESTS_CA_BUNDLE to the path of the SSL certificate. + ``true`` - indicates that the SSL certificate should be verified. Set the environment variable REQUESTS_CA_BUNDLE to the path of the SSL certificate. - False - indicates that the SSL certificate should not be verified. + ``false`` - indicates that the SSL certificate should not be verified. user (True, str, None) @@ -142,10 +145,10 @@ Notes .. note:: - The module support allows create/delete/update only for remote PowerStore arrays. - Get details can be done for all type of remote arrays. - - Parameters remote_user, remote_port and remote_password are not required during modification, getting and deleting. If passed then these parameters will be ignored and the operation will be performed. - - If wait_for_completion is set to True then the connection will be terminated after the timeout is exceeded. User can tweak timeout and pass it in the playbook task. + - Parameters *remote_user*, *remote_port* and *remote_password* are not required during modification, getting and deleting. If passed then these parameters will be ignored and the operation will be performed. + - If *wait_for_completion* is set to ``true`` then the connection will be terminated after the timeout is exceeded. User can tweak timeout and pass it in the playbook task. - By default, the timeout is set to 120 seconds. - - The check_mode is not supported. + - The *check_mode* is not supported. - The modules present in this collection named as 'dellemc.powerstore' are built to support the Dell PowerStore storage platform. @@ -161,7 +164,7 @@ Examples - name: Add a new remote system dellemc.powerstore.remotesystem: array_ip: "{{array_ip}}" - verifycert: "{{verifycert}}" + validate_certs: "{{validate_certs}}" user: "{{user}}" password: "{{password}}" remote_address: "xxx.xxx.xxx.xxx" @@ -175,13 +178,13 @@ Examples - name: Modify attributes of remote system using remote_id dellemc.powerstore.remotesystem: array_ip: "{{array_ip}}" - verifycert: "{{verifycert}}" + validate_certs: "{{validate_certs}}" user: "{{user}}" password: "{{password}}" remote_id: "7d7e7917-735b-3eef-8cc3-1302001c08e7" remote_address: "xxx.xxx.xxx.xxx" network_latency: "Low" - wait_for_completion: True + wait_for_completion: true timeout: 300 decription: "Updating the description" state: "present" @@ -189,7 +192,7 @@ Examples - name: Get details of remote system using remote_id dellemc.powerstore.remotesystem: array_ip: "{{array_ip}}" - verifycert: "{{verifycert}}" + validate_certs: "{{validate_certs}}" user: "{{user}}" password: "{{password}}" remote_id: "D7d7e7917-735b-3eef-8cc3-1302001c08e7" @@ -198,7 +201,7 @@ Examples - name: Delete remote system using remote_id dellemc.powerstore.remotesystem: array_ip: "{{array_ip}}" - verifycert: "{{verifycert}}" + validate_certs: "{{validate_certs}}" user: "{{user}}" password: "{{password}}" remote_id: "D7d7e7917-735b-3eef-8cc3-1302001c08e7" diff --git a/docs/modules/replicationrule.rst b/docs/modules/replicationrule.rst index dd8f802..c6c3748 100644 --- a/docs/modules/replicationrule.rst +++ b/docs/modules/replicationrule.rst @@ -22,30 +22,33 @@ Requirements ------------ The below requirements are needed on the host that executes this module. -- A Dell PowerStore Storage System. Ansible 2.12, 2.13 or 2.14 +- A Dell PowerStore storage system version 3.0.0.0 or later. +- Ansible-core 2.13 or later. +- PyPowerStore 2.0.0. +- Python 3.9, 3.10 or 3.11. Parameters ---------- - replication_rule_name (False, str, None) + replication_rule_name (optional, str, None) Name of the replication rule. Required during creation of a replication rule. - Parameter replication_rule_name and replication_rule_id are mutually exclusive. + Parameter *replication_rule_name* and *replication_rule_id* are mutually exclusive. - replication_rule_id (False, str, None) + replication_rule_id (optional, str, None) ID of the replication rule. ID for the rule is autogenerated, cannot be passed during creation of a replication rule. - Parameter replication_rule_name and replication_rule_id are mutually exclusive. + Parameter *replication_rule_name* and *replication_rule_id* are mutually exclusive. - new_name (False, str, None) + new_name (optional, str, None) New name of the replication rule. Used for renaming a replication rule. @@ -70,29 +73,29 @@ Parameters remote_system_address (False, str, None) The management IPv4 address of the remote system. - It is required in case the remote system name passed in remote_system parameter is not unique on the PowerStore Array. + It is required in case the remote system name passed in *remote_system* parameter is not unique on the PowerStore Array. - If ID of the remote system is passed then no need to pass remote_system_address. + If ID of the remote system is passed then no need to pass *remote_system_address*. state (True, str, None) The state of the replication rule after the task is performed. - For Delete operation only, it should be set to "absent". + For Delete operation only, it should be set to ``absent``. - For all Create, Modify or Get details operations it should be set to "present". + For all Create, Modify or Get details operations it should be set to ``present``. array_ip (True, str, None) IP or FQDN of the PowerStore management system. - verifycert (True, bool, None) + validate_certs (optional, bool, True) Boolean variable to specify whether to validate SSL certificate or not. - True - indicates that the SSL certificate should be verified. Set the environment variable REQUESTS_CA_BUNDLE to the path of the SSL certificate. + ``true`` - indicates that the SSL certificate should be verified. Set the environment variable REQUESTS_CA_BUNDLE to the path of the SSL certificate. - False - indicates that the SSL certificate should not be verified. + ``false`` - indicates that the SSL certificate should not be verified. user (True, str, None) @@ -122,7 +125,7 @@ Notes ----- .. note:: - - The check_mode is not supported. + - The *check_mode* is not supported. - The modules present in this collection named as 'dellemc.powerstore' are built to support the Dell PowerStore storage platform. @@ -138,7 +141,7 @@ Examples - name: Create new replication rule dellemc.powerstore.replicationrule: array_ip: "{{array_ip}}" - verifycert: "{{verifycert}}" + validate_certs: "{{validate_certs}}" user: "{{user}}" password: "{{password}}" replication_rule_name: "sample_replication_rule" @@ -150,7 +153,7 @@ Examples - name: Modify existing replication rule dellemc.powerstore.replicationrule: array_ip: "{{array_ip}}" - verifycert: "{{verifycert}}" + validate_certs: "{{validate_certs}}" user: "{{user}}" password: "{{password}}" replication_rule_name: "sample_replication_rule" @@ -163,7 +166,7 @@ Examples - name: Get details of replication rule dellemc.powerstore.replicationrule: array_ip: "{{array_ip}}" - verifycert: "{{verifycert}}" + validate_certs: "{{validate_certs}}" user: "{{user}}" password: "{{password}}" replication_rule_id: "{{id}}" @@ -172,7 +175,7 @@ Examples - name: Delete an existing replication rule dellemc.powerstore.replicationrule: array_ip: "{{array_ip}}" - verifycert: "{{verifycert}}" + validate_certs: "{{validate_certs}}" user: "{{user}}" password: "{{password}}" replication_rule_name: "new_sample_replication_rule" diff --git a/docs/modules/replicationsession.rst b/docs/modules/replicationsession.rst index 13f85ca..e7807d1 100644 --- a/docs/modules/replicationsession.rst +++ b/docs/modules/replicationsession.rst @@ -22,48 +22,57 @@ Requirements ------------ The below requirements are needed on the host that executes this module. -- A Dell PowerStore Storage System. Ansible 2.12, 2.13 or 2.14 +- A Dell PowerStore storage system version 3.0.0.0 or later. +- Ansible-core 2.13 or later. +- PyPowerStore 2.0.0. +- Python 3.9, 3.10 or 3.11. Parameters ---------- - filesystem (False, str, None) + filesystem (optional, str, None) Name/ID of the filesystem for which replication session exists. - Parameter filesystem, nas_server, volume_group, volume, and session_id are mutually exclusive. + Parameter *filesystem*, *nas_server*, *volume_group*, *volume*, *replication_group*, and *session_id* are mutually exclusive. - nas_server (False, str, None) + nas_server (optional, str, None) Name/ID of the NAS server for which replication session exists. - Parameter filesystem, nas_server, volume_group, volume, and session_id are mutually exclusive. + Parameter *filesystem*, *nas_server*, *volume_group*, *volume*, *replication_group*, and *session_id* are mutually exclusive. - volume_group (False, str, None) + volume_group (optional, str, None) Name/ID of the volume group for which a replication session exists. - Parameter filesystem, nas_server, volume_group, volume, and session_id are mutually exclusive. + Parameter *filesystem*, *nas_server*, *volume_group*, *volume*, *replication_group*, and *session_id* are mutually exclusive. - volume (False, str, None) + volume (optional, str, None) Name/ID of the volume for which replication session exists. - Parameter filesystem, nas_server, volume_group, volume, and session_id are mutually exclusive. + Parameter *filesystem*, *nas_server*, *volume_group*, *volume*, *replication_group*, and *session_id* are mutually exclusive. - session_id (False, str, None) + replication_group (optional, str, None) + Name or ID of the replication group for which replication session exists. + + Parameter *filesystem*, *nas_server*, *volume_group*, *volume*, *replication_group*, and *session_id* are mutually exclusive. + + + session_id (optional, str, None) ID of the replication session. - Parameter filesystem, nas_server, volume_group, volume, and session_id are mutually exclusive. + Parameter *filesystem*, *nas_server*, *volume_group*, *volume*, *replication_group*, and *session_id* are mutually exclusive. - session_state (False, str, None) + session_state (optional, str, None) State in which the replication session is present after performing the task. - role (False, str, None) + role (optional, str, None) Role of the metro replication session. @@ -71,12 +80,12 @@ Parameters IP or FQDN of the PowerStore management system. - verifycert (True, bool, None) + validate_certs (optional, bool, True) Boolean variable to specify whether to validate SSL certificate or not. - True - indicates that the SSL certificate should be verified. Set the environment variable REQUESTS_CA_BUNDLE to the path of the SSL certificate. + ``true`` - indicates that the SSL certificate should be verified. Set the environment variable REQUESTS_CA_BUNDLE to the path of the SSL certificate. - False - indicates that the SSL certificate should not be verified. + ``false`` - indicates that the SSL certificate should not be verified. user (True, str, None) @@ -107,10 +116,10 @@ Notes .. note:: - Manual synchronization for a replication session is not supported through the Ansible module. - - When the current state of the replication session is 'OK' and in the playbook task 'synchronizing', then it will return "changed" as False. - - The changed as False in above scenario is because of there is a scheduled synchronization in place with the associated replication rule's RPO in the protection policy. - - The check_mode is not supported. - - Parameter nas_server, filesystem, and role parameters are supported only for PowerStore version 3.0.0. and above. + - When the current state of the replication session is 'OK' and in the playbook task ``synchronizing``, then it will return "changed" as false. + - The changed as false in above scenario is because there is a scheduled synchronization in place with the associated replication rule's RPO in the protection policy. + - The *check_mode* is not supported. + - Parameter *nas_server*, *filesystem*, *replication_group*, and *role* parameters are supported only for PowerStore version 3.0.0. and above. - The modules present in this collection named as 'dellemc.powerstore' are built to support the Dell PowerStore storage platform. diff --git a/docs/modules/role.rst b/docs/modules/role.rst index b9395ba..9883cf5 100644 --- a/docs/modules/role.rst +++ b/docs/modules/role.rst @@ -20,7 +20,10 @@ Requirements ------------ The below requirements are needed on the host that executes this module. -- A Dell PowerStore Storage System. Ansible 2.12, 2.13 or 2.14 +- A Dell PowerStore storage system version 3.0.0.0 or later. +- Ansible-core 2.13 or later. +- PyPowerStore 2.0.0. +- Python 3.9, 3.10 or 3.11. @@ -38,21 +41,21 @@ Parameters state (True, str, None) Define whether the role should exist or not. - Value present, indicates that the role should exist on the system. + Value ``present``, indicates that the role should exist on the system. - Value absent, indicates that the role should not exist on the system. + Value ``absent``, indicates that the role should not exist on the system. array_ip (True, str, None) IP or FQDN of the PowerStore management system. - verifycert (True, bool, None) + validate_certs (optional, bool, True) Boolean variable to specify whether to validate SSL certificate or not. - True - indicates that the SSL certificate should be verified. Set the environment variable REQUESTS_CA_BUNDLE to the path of the SSL certificate. + ``true`` - indicates that the SSL certificate should be verified. Set the environment variable REQUESTS_CA_BUNDLE to the path of the SSL certificate. - False - indicates that the SSL certificate should not be verified. + ``false`` - indicates that the SSL certificate should not be verified. user (True, str, None) @@ -84,7 +87,7 @@ Notes .. note:: - Only getting the details of the role is supported by the ansible module. - Creation, modification and deletion of roles is not supported by the ansible modules. - - The check_mode is not supported. + - The *check_mode* is not supported. - The modules present in this collection named as 'dellemc.powerstore' are built to support the Dell PowerStore storage platform. @@ -100,7 +103,7 @@ Examples - name: Get the details of role by name dellemc.powerstore.role: array_ip: "{{array_ip}}" - verifycert: "{{verify_cert}}" + validate_certs: "{{verify_cert}}" user: "{{user}}" password: "{{password}}" role_name: "Administrator" @@ -109,7 +112,7 @@ Examples - name: Get the details of role by id dellemc.powerstore.role: array_ip: "{{array_ip}}" - verifycert: "{{verify_cert}}" + validate_certs: "{{verify_cert}}" user: "{{user}}" password: "{{password}}" role_id: "1" diff --git a/docs/modules/security_config.rst b/docs/modules/security_config.rst index 1157c3f..70c909e 100644 --- a/docs/modules/security_config.rst +++ b/docs/modules/security_config.rst @@ -20,7 +20,10 @@ Requirements ------------ The below requirements are needed on the host that executes this module. -- A Dell PowerStore Storage System. Ansible 2.12, 2.13 or 2.14 +- A Dell PowerStore storage system version 3.0.0.0 or later. +- Ansible-core 2.13 or later. +- PyPowerStore 2.0.0. +- Python 3.9, 3.10 or 3.11. @@ -47,12 +50,12 @@ Parameters IP or FQDN of the PowerStore management system. - verifycert (True, bool, None) + validate_certs (optional, bool, True) Boolean variable to specify whether to validate SSL certificate or not. - True - indicates that the SSL certificate should be verified. Set the environment variable REQUESTS_CA_BUNDLE to the path of the SSL certificate. + ``true`` - indicates that the SSL certificate should be verified. Set the environment variable REQUESTS_CA_BUNDLE to the path of the SSL certificate. - False - indicates that the SSL certificate should not be verified. + ``false`` - indicates that the SSL certificate should not be verified. user (True, str, None) @@ -84,7 +87,7 @@ Notes .. note:: - Creation and deletion of security configs is not supported by Ansible modules. - Modification of protocol mode is only supported for PowerStore v2.0.0.0 and above. - - The check_mode is not supported. + - The *check_mode* is not supported. - The modules present in this collection named as 'dellemc.powerstore' are built to support the Dell PowerStore storage platform. @@ -99,7 +102,7 @@ Examples - name: Get security config dellemc.powerstore.security_config: array_ip: "{{array_ip}}" - verifycert: "{{verifycert}}" + validate_certs: "{{validate_certs}}" user: "{{user}}" password: "{{password}}" security_config_id: 1 @@ -108,7 +111,7 @@ Examples - name: Modify attribute of security config dellemc.powerstore.security_config: array_ip: "{{array_ip}}" - verifycert: "{{verifycert}}" + validate_certs: "{{validate_certs}}" user: "{{user}}" password: "{{password}}" security_config_id: 1 diff --git a/docs/modules/smbshare.rst b/docs/modules/smbshare.rst index 4981699..31ff22c 100644 --- a/docs/modules/smbshare.rst +++ b/docs/modules/smbshare.rst @@ -20,7 +20,10 @@ Requirements ------------ The below requirements are needed on the host that executes this module. -- A Dell PowerStore Storage System. Ansible 2.12, 2.13 or 2.14 +- A Dell PowerStore storage system version 3.0.0.0 or later. +- Ansible-core 2.13 or later. +- PyPowerStore 2.0.0. +- Python 3.9, 3.10 or 3.11. @@ -32,7 +35,7 @@ Parameters Required during creation of the SMB share. - For all other operations either share_name or share_id is required. + For all other operations either *share_name* or *share_id* is required. share_id (optional, str, None) @@ -40,9 +43,9 @@ Parameters Should not be specified during creation. ID is auto generated. - For all other operations either share_name or share_id is required. + For all other operations either *share_name* or *share_id* is required. - If share_id is used then no need to pass nas_server/filesystem/snapshot/ path. + If *share_id* is used then no need to pass *nas_server*/*filesystem*/*snapshot*/ *path*. path (optional, str, None) @@ -58,7 +61,7 @@ Parameters Either filesystem or snapshot is required for creation of the SMB share. - If filesystem name is specified, then nas_server is required to uniquely identify the filesystem. + If filesystem name is specified, then *nas_server* is required to uniquely identify the filesystem. If filesystem parameter is provided, then snapshot cannot be specified. @@ -68,7 +71,7 @@ Parameters Either filesystem or snapshot is required for creation of the SMB share. - If snapshot name is specified, then nas_server is required to uniquely identify the snapshot. + If snapshot name is specified, then *nas_server* is required to uniquely identify the snapshot. If snapshot parameter is provided, then filesystem cannot be specified. @@ -78,7 +81,7 @@ Parameters nas_server (optional, str, None) The ID/Name of the NAS Server. - It is not required if share_id is used. + It is not required if *share_id* is used. description (optional, str, None) @@ -92,43 +95,43 @@ Parameters is_abe_enabled (optional, bool, None) Indicates whether Access-based Enumeration (ABE) for SMB share is enabled. - During creation, if not mentioned, then the default is False. + During creation, if not mentioned, then the default is ``false``. is_branch_cache_enabled (optional, bool, None) Indicates whether Branch Cache optimization for SMB share is enabled. - During creation, if not mentioned then default is False. + During creation, if not mentioned then default is ``false``. is_continuous_availability_enabled (optional, bool, None) Indicates whether continuous availability for SMB 3.0 is enabled. - During creation, if not mentioned, then the default is False. + During creation, if not mentioned, then the default is ``false``. is_encryption_enabled (optional, bool, None) Indicates whether encryption for SMB 3.0 is enabled at the shared folder level. - During creation, if not mentioned then default is False. + During creation, if not mentioned then default is ``false``. offline_availability (optional, str, None) Defines valid states of Offline Availability. - MANUAL- Only specified files will be available offline. + ``MANUAL``- Only specified files will be available offline. - DOCUMENTS- All files that users open will be available offline. + ``DOCUMENTS``- All files that users open will be available offline. - PROGRAMS- Program will preferably run from the offline cache even when connected to the network. All files that users open will be available offline. + ``PROGRAMS``- Program will preferably run from the offline cache even when connected to the network. All files that users open will be available offline. - NONE- Prevents clients from storing documents and programs in offline cache. + ``NONE``- Prevents clients from storing documents and programs in offline cache. umask (optional, str, None) The default UNIX umask for new files created on the SMB Share. - During creation, if not mentioned, then the default is "022". + During creation, if not mentioned, then the default is 022. For all other operations, the default is None. @@ -136,21 +139,21 @@ Parameters state (True, str, None) Define whether the SMB share should exist or not. - Value present indicates that the share should exist on the system. + Value ``present`` indicates that the share should exist on the system. - Value absent indicates that the share should not exist on the system. + Value ``absent`` indicates that the share should not exist on the system. array_ip (True, str, None) IP or FQDN of the PowerStore management system. - verifycert (True, bool, None) + validate_certs (optional, bool, True) Boolean variable to specify whether to validate SSL certificate or not. - True - indicates that the SSL certificate should be verified. Set the environment variable REQUESTS_CA_BUNDLE to the path of the SSL certificate. + ``true`` - indicates that the SSL certificate should be verified. Set the environment variable REQUESTS_CA_BUNDLE to the path of the SSL certificate. - False - indicates that the SSL certificate should not be verified. + ``false`` - indicates that the SSL certificate should not be verified. user (True, str, None) @@ -180,9 +183,9 @@ Notes ----- .. note:: - - When the ID of the filesystem/snapshot is passed then nas_server is not required. If passed, then the filesystem/snapshot should exist for the nas_server, else the task will fail. + - When the ID of the filesystem/snapshot is passed then *nas_server* is not required. If passed, then the filesystem/snapshot should exist for the *nas_server*, else the task will fail. - Multiple SMB shares can be created for the same local path. - - The check_mode is not supported. + - The *check_mode* is not supported. - The modules present in this collection named as 'dellemc.powerstore' are built to support the Dell PowerStore storage platform. @@ -198,7 +201,7 @@ Examples - name: Create SMB share for a filesystem dellemc.powerstore.smbshare: array_ip: "{{array_ip}}" - verifycert: "{{verifycert}}" + validate_certs: "{{validate_certs}}" user: "{{user}}" password: "{{password}}" share_name: "sample_smb_share" @@ -206,34 +209,34 @@ Examples nas_server: "{{nas_server_id}}" path: "{{path}}" description: "Sample SMB share created" - is_abe_enabled: True - is_branch_cache_enabled: True + is_abe_enabled: true + is_branch_cache_enabled: true offline_availability: "DOCUMENTS" - is_continuous_availability_enabled: True - is_encryption_enabled: True + is_continuous_availability_enabled: true + is_encryption_enabled: true state: "present" - name: Modify Attributes of SMB share for a filesystem dellemc.powerstore.smbshare: array_ip: "{{array_ip}}" - verifycert: "{{verifycert}}" + validate_certs: "{{validate_certs}}" user: "{{user}}" password: "{{password}}" share_name: "sample_smb_share" nas_server: "sample_nas_server" description: "Sample SMB share attributes updated" - is_abe_enabled: False - is_branch_cache_enabled: False + is_abe_enabled: false + is_branch_cache_enabled: false offline_availability: "MANUAL" - is_continuous_availability_enabled: False - is_encryption_enabled: False + is_continuous_availability_enabled: false + is_encryption_enabled: false umask: "022" state: "present" - name: Create SMB share for a snapshot dellemc.powerstore.smbshare: array_ip: "{{array_ip}}" - verifycert: "{{verifycert}}" + validate_certs: "{{validate_certs}}" user: "{{user}}" password: "{{password}}" share_name: "sample_snap_smb_share" @@ -241,31 +244,31 @@ Examples nas_server: "{{nas_server_id}}" path: "{{path}}" description: "Sample SMB share created for snapshot" - is_abe_enabled: True - is_branch_cache_enabled: True - is_continuous_availability_enabled: True + is_abe_enabled: true + is_branch_cache_enabled: true + is_continuous_availability_enabled: true state: "present" - name: Modify Attributes of SMB share for a snapshot dellemc.powerstore.smbshare: array_ip: "{{array_ip}}" - verifycert: "{{verifycert}}" + validate_certs: "{{validate_certs}}" user: "{{user}}" password: "{{password}}" share_name: "sample_snap_smb_share" nas_server: "sample_nas_server" description: "Sample SMB share attributes updated for snapshot" - is_abe_enabled: False - is_branch_cache_enabled: False + is_abe_enabled: false + is_branch_cache_enabled: false offline_availability: "MANUAL" - is_continuous_availability_enabled: False + is_continuous_availability_enabled: false umask: "022" state: "present" - name: Get details of SMB share dellemc.powerstore.smbshare: array_ip: "{{array_ip}}" - verifycert: "{{verifycert}}" + validate_certs: "{{validate_certs}}" user: "{{user}}" password: "{{password}}" share_id: "{{smb_share_id}}" @@ -274,7 +277,7 @@ Examples - name: Delete SMB share dellemc.powerstore.smbshare: array_ip: "{{array_ip}}" - verifycert: "{{verifycert}}" + validate_certs: "{{validate_certs}}" user: "{{user}}" password: "{{password}}" share_id: "{{smb_share_id}}" diff --git a/docs/modules/smtp_config.rst b/docs/modules/smtp_config.rst index d0a42f0..57e1b1b 100644 --- a/docs/modules/smtp_config.rst +++ b/docs/modules/smtp_config.rst @@ -22,7 +22,10 @@ Requirements ------------ The below requirements are needed on the host that executes this module. -- A Dell PowerStore Storage System. Ansible 2.12, 2.13 or 2.14 +- A Dell PowerStore storage system version 3.0.0.0 or later. +- Ansible-core 2.13 or later. +- PyPowerStore 2.0.0. +- Python 3.9, 3.10 or 3.11. @@ -33,40 +36,40 @@ Parameters Unique identifier of the SMTP configuration. - smtp_address (False, str, None) + smtp_address (optional, str, None) IP address of the SMTP server. - smtp_port (False, int, None) + smtp_port (optional, int, None) Port used for sending SMTP messages. - source_email (False, str, None) + source_email (optional, str, None) Source email address used for sending SMTP messages. - destination_email (False, str, None) + destination_email (optional, str, None) Destination email address for the test. state (True, str, None) The state of the SMTP configuration after the task is performed. - For Delete operation only, it should be set to "absent". + For Delete operation only, it should be set to ``absent`` - For all operations it should be set to "present". + For all operations it should be set to ``present``. array_ip (True, str, None) IP or FQDN of the PowerStore management system. - verifycert (True, bool, None) + validate_certs (optional, bool, True) Boolean variable to specify whether to validate SSL certificate or not. - True - indicates that the SSL certificate should be verified. Set the environment variable REQUESTS_CA_BUNDLE to the path of the SSL certificate. + ``true`` - indicates that the SSL certificate should be verified. Set the environment variable REQUESTS_CA_BUNDLE to the path of the SSL certificate. - False - indicates that the SSL certificate should not be verified. + ``false`` - indicates that the SSL certificate should not be verified. user (True, str, None) @@ -98,7 +101,7 @@ Notes .. note:: - Idempotency is not supported for test operation for smtp_config module. - Creation and deletion of SMTP configuration is not supported. - - The check_mode is not supported. + - The *check_mode* is not supported. - The modules present in this collection named as 'dellemc.powerstore' are built to support the Dell PowerStore storage platform. @@ -116,7 +119,7 @@ Examples array_ip: "{{array_ip}}" user: "{{user}}" password: "{{password}}" - verifycert: "{{verifycert}}" + validate_certs: "{{validate_certs}}" smtp_id: "0" state: "present" @@ -125,7 +128,7 @@ Examples array_ip: "{{array_ip}}" user: "{{user}}" password: "{{password}}" - verifycert: "{{verifycert}}" + validate_certs: "{{validate_certs}}" smtp_id: "0" smtp_address: "sample.smtp.com" source_email: "def@dell.com" @@ -136,7 +139,7 @@ Examples array_ip: "{{array_ip}}" user: "{{user}}" password: "{{password}}" - verifycert: "{{verifycert}}" + validate_certs: "{{validate_certs}}" smtp_id: "0" destination_email: "abc@dell.com" state: "present" diff --git a/docs/modules/snapshot.rst b/docs/modules/snapshot.rst index d3f7343..fba10f1 100644 --- a/docs/modules/snapshot.rst +++ b/docs/modules/snapshot.rst @@ -22,7 +22,10 @@ Requirements ------------ The below requirements are needed on the host that executes this module. -- A Dell PowerStore Storage System. Ansible 2.12, 2.13 or 2.14 +- A Dell PowerStore storage system version 3.0.0.0 or later. +- Ansible-core 2.13 or later. +- PyPowerStore 2.0.0. +- Python 3.9, 3.10 or 3.11. @@ -62,9 +65,9 @@ Parameters retention_unit (optional, str, None) The unit for retention. - If this unit is not specified, 'hours' is taken as default retention_unit. + If this unit is not specified, ``hours`` is taken as default *retention_unit*. - If desired_retention is specified, expiration_timestamp cannot be specified. + If *desired_retention* is specified, *expiration_timestamp* cannot be specified. expiration_timestamp (optional, str, None) @@ -83,12 +86,12 @@ Parameters IP or FQDN of the PowerStore management system. - verifycert (True, bool, None) + validate_certs (optional, bool, True) Boolean variable to specify whether to validate SSL certificate or not. - True - indicates that the SSL certificate should be verified. Set the environment variable REQUESTS_CA_BUNDLE to the path of the SSL certificate. + ``true`` - indicates that the SSL certificate should be verified. Set the environment variable REQUESTS_CA_BUNDLE to the path of the SSL certificate. - False - indicates that the SSL certificate should not be verified. + ``false`` - indicates that the SSL certificate should not be verified. user (True, str, None) @@ -118,7 +121,7 @@ Notes ----- .. note:: - - The check_mode is not supported. + - The *check_mode* is not supported. - The modules present in this collection named as 'dellemc.powerstore' are built to support the Dell PowerStore storage platform. @@ -133,7 +136,7 @@ Examples - name: Create a volume snapshot on PowerStore dellemc.powerstore.snapshot: array_ip: "{{mgmt_ip}}" - verifycert: "{{verifycert}}" + validate_certs: "{{validate_certs}}" user: "{{user}}" password: "{{password}}" snapshot_name: "{{snapshot_name}}" @@ -146,7 +149,7 @@ Examples - name: Get details of a volume snapshot dellemc.powerstore.snapshot: array_ip: "{{mgmt_ip}}" - verifycert: "{{verifycert}}" + validate_certs: "{{validate_certs}}" user: "{{user}}" password: "{{password}}" snapshot_name: "{{snapshot_name}}" @@ -156,7 +159,7 @@ Examples - name: Rename volume snapshot dellemc.powerstore.snapshot: array_ip: "{{mgmt_ip}}" - verifycert: "{{verifycert}}" + validate_certs: "{{validate_certs}}" user: "{{user}}" password: "{{password}}" snapshot_name: "{{snapshot_name}}" @@ -167,7 +170,7 @@ Examples - name: Delete volume snapshot dellemc.powerstore.snapshot: array_ip: "{{mgmt_ip}}" - verifycert: "{{verifycert}}" + validate_certs: "{{validate_certs}}" user: "{{user}}" password: "{{password}}" snapshot_name: "{{new_snapshot_name}}" @@ -177,7 +180,7 @@ Examples - name: Create a volume group snapshot on PowerStore dellemc.powerstore.snapshot: array_ip: "{{mgmt_ip}}" - verifycert: "{{verifycert}}" + validate_certs: "{{validate_certs}}" user: "{{user}}" password: "{{password}}" snapshot_name: "{{snapshot_name}}" @@ -189,7 +192,7 @@ Examples - name: Get details of a volume group snapshot dellemc.powerstore.snapshot: array_ip: "{{mgmt_ip}}" - verifycert: "{{verifycert}}" + validate_certs: "{{validate_certs}}" user: "{{user}}" password: "{{password}}" snapshot_name: "{{snapshot_name}}" @@ -199,7 +202,7 @@ Examples - name: Modify volume group snapshot expiration timestamp dellemc.powerstore.snapshot: array_ip: "{{mgmt_ip}}" - verifycert: "{{verifycert}}" + validate_certs: "{{validate_certs}}" user: "{{user}}" password: "{{password}}" snapshot_name: "{{snapshot_name}}" @@ -211,7 +214,7 @@ Examples - name: Rename volume group snapshot dellemc.powerstore.snapshot: array_ip: "{{mgmt_ip}}" - verifycert: "{{verifycert}}" + validate_certs: "{{validate_certs}}" user: "{{user}}" password: "{{password}}" snapshot_name: "{{snapshot_name}}" @@ -222,7 +225,7 @@ Examples - name: Delete volume group snapshot dellemc.powerstore.snapshot: array_ip: "{{mgmt_ip}}" - verifycert: "{{verifycert}}" + validate_certs: "{{validate_certs}}" user: "{{user}}" password: "{{password}}" snapshot_name: "{{new_snapshot_name}}" diff --git a/docs/modules/snapshotrule.rst b/docs/modules/snapshotrule.rst index c0d3f8b..b25f87a 100644 --- a/docs/modules/snapshotrule.rst +++ b/docs/modules/snapshotrule.rst @@ -22,37 +22,40 @@ Requirements ------------ The below requirements are needed on the host that executes this module. -- A Dell PowerStore Storage System. Ansible 2.12, 2.13 or 2.14 +- A Dell PowerStore storage system version 3.0.0.0 or later. +- Ansible-core 2.13 or later. +- PyPowerStore 2.0.0. +- Python 3.9, 3.10 or 3.11. Parameters ---------- - name (False, str, None) + name (optional, str, None) String variable. Indicates the name of the Snapshot rule. - snapshotrule_id (False, str, None) + snapshotrule_id (optional, str, None) String variable. Indicates the ID of the Snapshot rule. - new_name (False, str, None) + new_name (optional, str, None) String variable. Indicates the new name of the Snapshot rule. Used for renaming operation. - days_of_week (False, list, None) - List of strings to specify days of the week on which the Snapshot rule should be applied. Must be applied for Snapshot rules where the 'time_of_day' parameter is set. + days_of_week (optional, list, None) + List of strings to specify days of the week on which the Snapshot rule should be applied. Must be applied for Snapshot rules where the *time_of_day* parameter is set. - Optional for the Snapshot rule created with an interval. When 'days_of_week' is not specified for a new Snapshot rule, the rule is applied on every day of the week. + Optional for the Snapshot rule created with an interval. When *days_of_week* is not specified for a new Snapshot rule, the rule is applied on every day of the week. interval (False, str, None) String variable. Indicates the interval between Snapshots. - When creating a Snapshot rule, specify either "interval" or "time_of_day", but not both. + When creating a Snapshot rule, specify either *interval* or *time_of_day*, but not both. desired_retention (False, int, None) @@ -64,35 +67,35 @@ Parameters time_of_day (False, str, None) String variable. Indicates the time of the day to take a daily Snapshot, with the format "hh:mm" in 24 hour time format. - When creating a Snapshot rule, specify either "interval"or "time_of_day" but not both. + When creating a Snapshot rule, specify either *interval* or *time_of_day* but not both. delete_snaps (optional, bool, False) Boolean variable to specify whether all Snapshots previously created by this rule should also be deleted when this rule is removed. - True specifies to delete all previously created Snapshots by this rule while deleting this rule. + ``true`` specifies to delete all previously created Snapshots by this rule while deleting this rule. - False specifies to retain all previously created Snapshots while deleting this rule. + ``false`` specifies to retain all previously created Snapshots while deleting this rule. state (True, str, None) String variable indicates the state of Snapshot rule. - For "Delete" operation only, it should be set to "absent". + For "Delete" operation only, it should be set to ``absent``. - For all Create, Modify or Get details operation it should be set to "present". + For all Create, Modify or Get details operation it should be set to ``present``. array_ip (True, str, None) IP or FQDN of the PowerStore management system. - verifycert (True, bool, None) + validate_certs (optional, bool, True) Boolean variable to specify whether to validate SSL certificate or not. - True - indicates that the SSL certificate should be verified. Set the environment variable REQUESTS_CA_BUNDLE to the path of the SSL certificate. + ``true`` - indicates that the SSL certificate should be verified. Set the environment variable REQUESTS_CA_BUNDLE to the path of the SSL certificate. - False - indicates that the SSL certificate should not be verified. + ``false`` - indicates that the SSL certificate should not be verified. user (True, str, None) @@ -122,7 +125,7 @@ Notes ----- .. note:: - - The check_mode is not supported. + - The *check_mode* is not supported. - The modules present in this collection named as 'dellemc.powerstore' are built to support the Dell PowerStore storage platform. @@ -138,7 +141,7 @@ Examples - name: Get details of an existing snapshot rule by name dellemc.powerstore.snapshotrule: array_ip: "{{array_ip}}" - verifycert: "{{verifycert}}" + validate_certs: "{{validate_certs}}" user: "{{user}}" password: "{{password}}" name: "{{name}}" @@ -147,7 +150,7 @@ Examples - name: Get details of an existing snapshot rule by id dellemc.powerstore.snapshotrule: array_ip: "{{array_ip}}" - verifycert: "{{verifycert}}" + validate_certs: "{{validate_certs}}" user: "{{user}}" password: "{{password}}" snapshotrule_id: "{{snapshotrule_id}}" @@ -156,7 +159,7 @@ Examples - name: Create new snapshot rule by interval dellemc.powerstore.snapshotrule: array_ip: "{{array_ip}}" - verifycert: "{{verifycert}}" + validate_certs: "{{validate_certs}}" user: "{{user}}" password: "{{password}}" name: "{{name}}" @@ -170,7 +173,7 @@ Examples - name: Create new snapshot rule by time_of_day and days_of_week dellemc.powerstore.snapshotrule: array_ip: "{{array_ip}}" - verifycert: "{{verifycert}}" + validate_certs: "{{validate_certs}}" user: "{{user}}" password: "{{password}}" name: "{{name}}" @@ -185,7 +188,7 @@ Examples - name: Modify existing snapshot rule to time_of_day and days_of_week dellemc.powerstore.snapshotrule: array_ip: "{{array_ip}}" - verifycert: "{{verifycert}}" + validate_certs: "{{validate_certs}}" user: "{{user}}" password: "{{password}}" name: "{{name}}" @@ -200,7 +203,7 @@ Examples - name: Modify existing snapshot rule to interval dellemc.powerstore.snapshotrule: array_ip: "{{array_ip}}" - verifycert: "{{verifycert}}" + validate_certs: "{{validate_certs}}" user: "{{user}}" password: "{{password}}" name: "{{name}}" @@ -210,7 +213,7 @@ Examples - name: Delete an existing snapshot rule by name dellemc.powerstore.snapshotrule: array_ip: "{{array_ip}}" - verifycert: "{{verifycert}}" + validate_certs: "{{validate_certs}}" user: "{{user}}" password: "{{password}}" name: "{{name}}" diff --git a/docs/modules/storage_container.rst b/docs/modules/storage_container.rst new file mode 100644 index 0000000..3dff1c8 --- /dev/null +++ b/docs/modules/storage_container.rst @@ -0,0 +1,396 @@ +.. _storage_container_module: + + +storage_container -- Manage storage container for PowerStore +============================================================ + +.. contents:: + :local: + :depth: 1 + + +Synopsis +-------- + +Managing storage containers on PowerStore Storage System includes creating a storage container, getting details of a storage container, modifying a storage container and deleting a storage container. + +This module also supports creating and deleting storage container destinations. + + + +Requirements +------------ +The below requirements are needed on the host that executes this module. + +- A Dell PowerStore storage system version 3.0.0.0 or later. +- Ansible-core 2.13 or later. +- PyPowerStore 2.0.0. +- Python 3.9, 3.10 or 3.11. + + + +Parameters +---------- + + storage_container_id (optional, str, None) + The unique identifier of the storage container. + + + storage_container_name (optional, str, None) + Name for the storage container. + + This should be unique across all storage containers in the cluster. + + + quota (optional, int, None) + The total number of bytes that can be provisioned/reserved against this storage container. + + A value of ``0`` means there is no limit. + + It is possible to set the quota to a value that overprovisions the amount of space available in the system. + + + quota_unit (optional, str, GB) + Unit of the quota. + + + storage_protocol (optional, str, None) + The type of storage container. + + ``SCSI`` is set when a storage container is dedicated to ``SCSI`` usage. + + ``NVMe`` is set when a storage container is dedicated to ``NVMe`` usage. + + + high_water_mark (optional, int, None) + This is the percentage of the quota that can be consumed before an alert is raised. + + This is used only for creating a storage container. + + + new_name (optional, str, None) + The new name of the storage container. + + + force_delete (optional, bool, False) + This option overrides the error and allows the deletion to continue in case there are any vVols associated with the storage container. + + Use with great caution. + + + state (False, str, present) + Define whether the storage container should exist or not. + + For Delete operation only, it should be set to ``absent``. + + + storage_container_destination_state (optional, str, present) + Define whether the storage container destination should exist in the storage container. + + To delete storage container destination, it should be ``absent``. + + + storage_container_destination (optional, dict, None) + It contains details of remote system and remote storage container. + + It is required while creating and deleting storage container destinations. + + + remote_system (True, str, None) + Name or ID of the remote system. + + + remote_address (True, str, None) + The IP address of the remote storage system. + + + user (True, str, None) + Username of the remote PowerStore storage system. + + + password (True, str, None) + Password of the remote PowerStore storage system. + + + port (optional, int, 443) + Port number of the remote PowerStore storage system. + + + timeout (optional, int, 120) + Time after which connection will be terminated. + + It is mentioned in seconds. + + + validate_certs (optional, bool, True) + Boolean variable to specify whether to validate SSL certificate or not. + + ``true`` - indicates that the SSL certificate should be verified. Set the environment variable REQUESTS_CA_BUNDLE to the path of the SSL certificate. + + ``false`` - indicates that the SSL certificate should not be verified. + + + remote_storage_container (True, str, None) + Name or ID of the remote storage container on the remote storage system. + + + + array_ip (True, str, None) + IP or FQDN of the PowerStore management system. + + + validate_certs (optional, bool, True) + Boolean variable to specify whether to validate SSL certificate or not. + + ``true`` - indicates that the SSL certificate should be verified. Set the environment variable REQUESTS_CA_BUNDLE to the path of the SSL certificate. + + ``false`` - indicates that the SSL certificate should not be verified. + + + user (True, str, None) + The username of the PowerStore host. + + + password (True, str, None) + The password of the PowerStore host. + + + timeout (optional, int, 120) + Time after which the connection will get terminated. + + It is to be mentioned in seconds. + + + port (optional, int, None) + Port number for the PowerStore array. + + If not passed, it will take 443 as default. + + + + + +Notes +----- + +.. note:: + - The *check_mode* is supported. + - Either storage container name or ID required while deleting the storage container destination. + - The details of the storage container destination are embedded in the response of the storage container. + - The modules present in this collection named as 'dellemc.powerstore' are built to support the Dell PowerStore storage platform. + + + + +Examples +-------- + +.. code-block:: yaml+jinja + + + + - name: Create a storage_container + dellemc.powerstore.storage_container: + array_ip: "{{array_ip}}" + validate_certs: "{{validate_certs}}" + user: "{{user}}" + password: "{{password}}" + storage_container_name: "Ansible_storage_container_1" + quota: 0 + storage_protocol: "SCSI" + high_water_mark: 60 + + - name: Get the details of the storage container using id + dellemc.powerstore.storage_container: + array_ip: "{{array_ip}}" + validate_certs: "{{validate_certs}}" + user: "{{user}}" + password: "{{password}}" + storage_container_id: "storage_container_id" + state: "present" + + - name: Get the details of the storage container by name + dellemc.powerstore.storage_container: + array_ip: "{{array_ip}}" + validate_certs: "{{validate_certs}}" + user: "{{user}}" + password: "{{password}}" + storage_container_name: "Ansible_storage_container_1" + + - name: Modify a storage container + dellemc.powerstore.storage_container: + array_ip: "{{array_ip}}" + validate_certs: "{{validate_certs}}" + user: "{{user}}" + password: "{{password}}" + storage_container_name: "Ansible_storage_container_1" + quota: 20 + quota_unit: "GB" + storage_protocol: "NVMe" + state: "present" + + - name: Rename a storage container + dellemc.powerstore.storage_container: + array_ip: "{{array_ip}}" + validate_certs: "{{validate_certs}}" + user: "{{user}}" + password: "{{password}}" + storage_container_name: "Ansible_storage_container_1" + new_name: "Ansible_storage_container_1_new" + + - name: Delete a storage container containing vVols + dellemc.powerstore.storage_container: + array_ip: "{{array_ip}}" + validate_certs: "{{validate_certs}}" + user: "{{user}}" + password: "{{password}}" + storage_container_name: "Ansible_storage_container_1" + force_delete: True + state: "absent" + + - name: Delete a storage container using id + dellemc.powerstore.storage_container: + array_ip: "{{array_ip}}" + validate_certs: "{{validate_certs}}" + user: "{{user}}" + password: "{{password}}" + storage_container_id: "storage_container_id_1" + state: "absent" + + - name: Create a storage container destination + dellemc.powerstore.storage_container: + array_ip: "{{array_ip}}" + user: "{{user}}" + password: "{{password}}" + validate_certs: "{{validate_certs}}" + storage_container_name: "local_storage_container" + storage_container_destination: + remote_address: "x.x.x.x" + user: "{{user}}" + password: "{{password}}" + validate_certs: "{{validate_certs}}" + remote_system: "remote_system_name" + remote_storage_container: "remote_storage_container_name" + + - name: Delete a storage container destination + dellemc.powerstore.storage_container: + array_ip: "{{array_ip}}" + user: "{{user}}" + password: "{{password}}" + validate_certs: "{{validate_certs}}" + storage_container_id: "storage_container_id" + storage_container_destination_state: "absent" + storage_container_destination: + remote_address: "x.x.x.x" + user: "{{user}}" + password: "{{password}}" + validate_certs: "{{validate_certs}}" + remote_system: "remote_system_name" + remote_storage_container: "remote_storage_container_name" + + + +Return Values +------------- + +changed (always, bool, false) + Whether or not the resource has changed. + + +storage_container_details (When storage container exists., complex, {'datastores': [], 'destinations': [], 'id': 'e0ccd953-5650-41d8-9bce-f36d876d6a2a', 'name': 'Ansible_storage_container_1', 'quota': 21474836480, 'replication_groups': [], 'storage_protocol': 'NVMe', 'storage_protocol_l10n': 'NVMe', 'virtual_volumes': []}) + Details of the storage container. + + + id (, str, ) + The unique identifier of the storage container. + + + name (, str, ) + The name for the storage container. + + + storage_protocol (, str, ) + The type of storage container. + + + quota (, int, ) + The total number of bytes that can be provisioned/reserved against this storage container. + + + replication_groups (, list, ) + Properties of a Replication Group. + + + id (, str, ) + Unique identifier of the Replication Group instance. + + + name (, str, ) + Name of the Replication Group. + + + + virtual_volumes (, list, ) + The virtual volumes associated to the storage container. + + + id (, str, ) + The unique identifier of the virtual volume. + + + name (, str, ) + The name of the virtual volume. + + + + destinations (, list, ) + A storage container destination defines replication destination for a local storage container on a remote system. + + + id (, str, ) + The unique id of the storage container destination. + + + remote_system_id (, str, ) + The unique id of the remote system. + + + remote_system_name (, str, ) + The name of the remote system. + + + remote_storage_container_id (, str, ) + The unique id of the destination storage container on the remote system. + + + + datastores (, list, ) + List of associated datstores. + + + id (, str, ) + Unique identifier of the datastore instance. + + + name (, str, ) + User-assigned name of the datastore in vCenter. + + + + + + + +Status +------ + + + + + +Authors +~~~~~~~ + +- Trisha Datta (@trisha-dell) +- Bhavneet Sharma (@Bhavneet-Sharma) + diff --git a/docs/modules/vcenter.rst b/docs/modules/vcenter.rst index 98009d8..4190ceb 100644 --- a/docs/modules/vcenter.rst +++ b/docs/modules/vcenter.rst @@ -20,7 +20,10 @@ Requirements ------------ The below requirements are needed on the host that executes this module. -- A Dell PowerStore Storage System. Ansible 2.12, 2.13 or 2.14 +- A Dell PowerStore storage system version 3.0.0.0 or later. +- Ansible-core 2.13 or later. +- PyPowerStore 2.0.0. +- Python 3.9, 3.10 or 3.11. @@ -81,7 +84,7 @@ Parameters state (optional, str, present) The state of the vCenter instance after the task is performed. - For get, create, and modify operations it should be set to "present". + For get, create, and modify operations it should be set to ``present``. update_password (optional, str, always) @@ -98,12 +101,12 @@ Parameters IP or FQDN of the PowerStore management system. - verifycert (True, bool, None) + validate_certs (optional, bool, True) Boolean variable to specify whether to validate SSL certificate or not. - True - indicates that the SSL certificate should be verified. Set the environment variable REQUESTS_CA_BUNDLE to the path of the SSL certificate. + ``true`` - indicates that the SSL certificate should be verified. Set the environment variable REQUESTS_CA_BUNDLE to the path of the SSL certificate. - False - indicates that the SSL certificate should not be verified. + ``false`` - indicates that the SSL certificate should not be verified. user (True, str, None) @@ -152,7 +155,7 @@ Examples array_ip: "{{array_ip}}" user: "{{user}}" password: "{{password}}" - verifycert: "{{verifycert}}" + validate_certs: "{{validate_certs}}" vcenter_id: "24d333-59f-423c-205-c6181ea81b" - name: Add a vcenter @@ -160,7 +163,7 @@ Examples array_ip: "{{array_ip}}" user: "{{user}}" password: "{{password}}" - verifycert: "{{verifycert}}" + validate_certs: "{{validate_certs}}" address: "XX.XX.XX.XX" vcenter_username: "user-name" vcenter_password: "password" @@ -174,7 +177,7 @@ Examples array_ip: "{{array_ip}}" user: "{{user}}" password: "{{password}}" - verifycert: "{{verifycert}}" + validate_certs: "{{validate_certs}}" vcenter_id: "24d333-59f-423c-205-c6181ea81b" address: "XX.XX.XX.YY" vcenter_username: "user-name" @@ -186,7 +189,7 @@ Examples array_ip: "{{array_ip}}" user: "{{user}}" password: "{{password}}" - verifycert: "{{verifycert}}" + validate_certs: "{{validate_certs}}" vcenter_id: "24d333-59f-423c-205-c6181ea81b" delete_vasa_provider: true state: "absent" diff --git a/docs/modules/volume.rst b/docs/modules/volume.rst index b8c317d..a8a8923 100644 --- a/docs/modules/volume.rst +++ b/docs/modules/volume.rst @@ -22,7 +22,10 @@ Requirements ------------ The below requirements are needed on the host that executes this module. -- A Dell PowerStore Storage System. Ansible 2.12, 2.13 or 2.14 +- A Dell PowerStore storage system version 3.0.0.0 or later. +- Ansible-core 2.13 or later. +- PyPowerStore 2.0.0. +- Python 3.9, 3.10 or 3.11. @@ -58,7 +61,7 @@ Parameters Used to signify unit of the size provided for creation and expansion of volume. - It defaults to 'GB', if not specified. + It defaults to ``GB``, if not specified. new_name (optional, str, None) @@ -81,8 +84,20 @@ Parameters Application type for volume when *app_type* is set to ``*Other`` types. + appliance_id (optional, str, None) + ID of the appliance on which the volume is provisioned. + + *appliance_id* and *appliance_name* are mutually exclusive. + + + appliance_name (optional, str, None) + Name of the appliance on which the volume is provisioned. + + *appliance_id* and *appliance_name* are mutually exclusive. + + protection_policy (optional, str, None) - The protection_policy of the volume. + The *protection_policy* of the volume. To represent policy, both name or ID can be used interchangably. The module will detect both. @@ -96,7 +111,7 @@ Parameters performance_policy (optional, str, None) - The performance_policy for the volume. + The *performance_policy* for the volume. A volume can be assigned a performance policy at the time of creation of the volume, or later. @@ -104,7 +119,7 @@ Parameters Check examples for more clarity. - If not given, performance policy will be 'medium'. + If not given, performance policy will be ``medium``. host (optional, str, None) @@ -124,14 +139,14 @@ Parameters mapping_state (optional, str, None) Define whether the volume should be mapped to a host or hostgroup. - Value mapped - indicates that the volume should be mapped to the host or host group. + Value ``mapped`` - indicates that the volume should be mapped to the host or host group. - Value unmapped - indicates that the volume should not be mapped to the host or host group. + Value ``unmapped`` - indicates that the volume should not be mapped to the host or host group. Only one of a host or host group can be supplied in one call. - hlu (False, int, None) + hlu (optional, int, None) Logical unit number for the host/host group volume access. Optional parameter when mapping a volume to host/host group. @@ -160,9 +175,9 @@ Parameters logical_unit_number (optional, int, None) - logical unit number when creating a mapped volume. + logical unit number when creating a ``mapped`` volume. - If no host_id or host_group_id is specified, logical_unit_number is ignored. + If no ``host_id`` or ``host_group_id`` is specified, ``logical_unit_number`` is ignored. protection_policy (optional, str, None) @@ -212,12 +227,12 @@ Parameters state (True, str, None) Define whether the volume should exist or not. - Value present - indicates that the volume should exist on the system. + Value ``present`` - indicates that the volume should exist on the system. - Value absent - indicates that the volume should not exist on the system. + Value ``absent`` - indicates that the volume should not exist on the system. - remote_system (False, str, None) + remote_system (optional, str, None) The remote system to which metro relationship will be established. The remote system must support metro volume. @@ -229,19 +244,19 @@ Parameters This parameter is added in PowerStore version 3.0.0.0. - remote_appliance_id (False, str, None) + remote_appliance_id (optional, str, None) A remote system appliance ID to which volume will be assigned. This parameter is added in PowerStore version 3.0.0.0. - end_metro_config (False, bool, False) + end_metro_config (optional, bool, False) Whether to end the metro session from a volume. This is mandatory for end metro configuration operation. - delete_remote_volume (False, bool, None) + delete_remote_volume (optional, bool, None) Whether to delete the remote volume during removal of metro session. This is parameter is added in the PowerStore version 3.0.0.0. @@ -251,12 +266,12 @@ Parameters IP or FQDN of the PowerStore management system. - verifycert (True, bool, None) + validate_certs (optional, bool, True) Boolean variable to specify whether to validate SSL certificate or not. - True - indicates that the SSL certificate should be verified. Set the environment variable REQUESTS_CA_BUNDLE to the path of the SSL certificate. + ``true`` - indicates that the SSL certificate should be verified. Set the environment variable REQUESTS_CA_BUNDLE to the path of the SSL certificate. - False - indicates that the SSL certificate should not be verified. + ``false`` - indicates that the SSL certificate should not be verified. user (True, str, None) @@ -286,13 +301,13 @@ Notes ----- .. note:: - - To create a new volume, vol_name and size is required. cap_unit, description, vg_name, performance_policy, and protection_policy are optional. - - Parameter new_name should not be provided when creating a new volume. - - The size is a required parameter for expand volume. + - To create a new volume, *vol_name* and *size* is required. *cap_unit*, *description*, *vg_name*, *performance_policy*, and *protection_policy* are optional. + - Parameter *new_name* should not be provided when creating a new volume. + - The *size*is a required parameter for expand volume. - Clones or Snapshots of a deleted production volume or a clone are not deleted. - A volume that is attached to a host/host group, or that is part of a volume group cannot be deleted. - If volume in metro session, volume can only be modified, refreshed and restored when session is in the pause state. - - The Check_mode is not supported. + - The *Check_mode* is not supported. - The modules present in this collection named as 'dellemc.powerstore' are built to support the Dell PowerStore storage platform. @@ -307,7 +322,7 @@ Examples - name: Create volume dellemc.powerstore.volume: array_ip: "{{array_ip}}" - verifycert: "{{verifycert}}" + validate_certs: "{{validate_certs}}" user: "{{user}}" password: "{{password}}" vol_name: "{{vol_name}}" @@ -322,11 +337,12 @@ Examples host: "{{host_name}}" app_type: "Relational_Databases_Other" app_type_other: "MaxDB" + appliance_name: "Appliance_Name" - name: Get volume details using ID dellemc.powerstore.volume: array_ip: "{{array_ip}}" - verifycert: "{{verifycert}}" + validate_certs: "{{validate_certs}}" user: "{{user}}" password: "{{password}}" vol_id: "{{result.volume_details.id}}" @@ -335,7 +351,7 @@ Examples - name: Modify volume size, name, description, protection, performance policy and app_type dellemc.powerstore.volume: array_ip: "{{array_ip}}" - verifycert: "{{verifycert}}" + validate_certs: "{{validate_certs}}" user: "{{user}}" password: "{{password}}" new_name: "{{new_name}}" @@ -350,7 +366,7 @@ Examples - name: Map volume to a host with HLU dellemc.powerstore.volume: array_ip: "{{array_ip}}" - verifycert: "{{verifycert}}" + validate_certs: "{{validate_certs}}" user: "{{user}}" password: "{{password}}" vol_name: "{{vol_name}}" @@ -362,7 +378,7 @@ Examples - name: Clone a volume dellemc.powerstore.volume: array_ip: "{{array_ip}}" - verifycert: "{{verifycert}}" + validate_certs: "{{validate_certs}}" user: "{{user}}" password: "{{password}}" vol_name: "{{vol_name}}" @@ -379,7 +395,7 @@ Examples - name: Refresh a volume dellemc.powerstore.volume: array_ip: "{{array_ip}}" - verifycert: "{{verifycert}}" + validate_certs: "{{validate_certs}}" user: "{{user}}" password: "{{password}}" vol_name: "{{vol_name}}" @@ -395,7 +411,7 @@ Examples - name: Restore a volume dellemc.powerstore.volume: array_ip: "{{array_ip}}" - verifycert: "{{verifycert}}" + validate_certs: "{{validate_certs}}" user: "{{user}}" password: "{{password}}" vol_name: "{{vol_name}}" @@ -411,7 +427,7 @@ Examples - name: Configure a metro volume dellemc.powerstore.volume: array_ip: "{{array_ip}}" - verifycert: "{{verifycert}}" + validate_certs: "{{validate_certs}}" user: "{{user}}" password: "{{password}}" vol_name: "{{vol_name}}" @@ -421,18 +437,18 @@ Examples - name: End a metro volume configuration dellemc.powerstore.volume: array_ip: "{{array_ip}}" - verifycert: "{{verifycert}}" + validate_certs: "{{validate_certs}}" user: "{{user}}" password: "{{password}}" vol_name: "{{vol_name}}" - end_metro_config: True - delete_remote_volume: True + end_metro_config: true + delete_remote_volume: true state: "present" - name: Delete volume dellemc.powerstore.volume: array_ip: "{{array_ip}}" - verifycert: "{{verifycert}}" + validate_certs: "{{validate_certs}}" user: "{{user}}" password: "{{password}}" vol_id: "{{result.volume_details.id}}" @@ -495,6 +511,14 @@ volume_details (When volume exists, complex, {'appliance_id': 'A1', 'creation_ti The protection policy of the volume. + appliance_id (, str, ) + ID of appliance on which the volume is provisioned. + + + appliance_name (, str, ) + Name of appliance on which the volume is provisioned. + + snapshots (, complex, ) List of snapshot associated with the volume. @@ -619,4 +643,5 @@ Authors - Manisha Agrawal (@agrawm3) - Ananthu S Kuttattu (@kuttattz) - Bhavneet Sharma (@Bhavneet-Sharma) +- Pavan Mudunuri(@Pavan-Mudunuri) diff --git a/docs/modules/volumegroup.rst b/docs/modules/volumegroup.rst index 229f9a2..0d50458 100644 --- a/docs/modules/volumegroup.rst +++ b/docs/modules/volumegroup.rst @@ -22,18 +22,21 @@ Requirements ------------ The below requirements are needed on the host that executes this module. -- A Dell PowerStore Storage System. Ansible 2.12, 2.13 or 2.14 +- A Dell PowerStore storage system version 3.0.0.0 or later. +- Ansible-core 2.13 or later. +- PyPowerStore 2.0.0. +- Python 3.9, 3.10 or 3.11. Parameters ---------- - vg_name (False, str, None) + vg_name (optional, str, None) The name of the volume group. - vg_id (False, str, None) + vg_id (optional, str, None) The id of the volume group. It can be used only for Modify, Add/Remove, or Delete operation. @@ -44,13 +47,13 @@ Parameters Either the volume ID or name must be provided for adding/removing existing volumes from a volume group. - If volumes are given, then vol_state should also be specified. + If volumes are given, then *vol_state* should also be specified. vol_state (optional, str, None) String variable. Describes the state of volumes inside a volume group. - If volume is given, then vol_state should also be specified. + If volume is given, then *vol_state* should also be specified. new_vg_name (optional, str, None) @@ -61,16 +64,16 @@ Parameters Description about the volume group. - protection_policy (False, str, None) + protection_policy (optional, str, None) String variable. Represents Protection policy id or name used for volume group. Specifying an empty string or "" removes the existing protection policy from volume group. - is_write_order_consistent (False, bool, None) + is_write_order_consistent (optional, bool, None) A boolean flag to indicate whether Snapshot sets of the volume group will be write-order consistent. - If this parameter is not specified, the array by default sets it to true. + If this parameter is not specified, the array by default sets it to ``true``. source_vg (optional, str, None) @@ -84,7 +87,7 @@ Parameters create_backup_snap (optional, bool, None) Specifies whether a backup snapshot set of the target volume group needs to be created before attempting refresh or restore. - If not specified it will be set to True. + If not specified it will be set to ``true``. backup_snap_profile (optional, dict, None) @@ -129,12 +132,12 @@ Parameters IP or FQDN of the PowerStore management system. - verifycert (True, bool, None) + validate_certs (optional, bool, True) Boolean variable to specify whether to validate SSL certificate or not. - True - indicates that the SSL certificate should be verified. Set the environment variable REQUESTS_CA_BUNDLE to the path of the SSL certificate. + ``true`` - indicates that the SSL certificate should be verified. Set the environment variable REQUESTS_CA_BUNDLE to the path of the SSL certificate. - False - indicates that the SSL certificate should not be verified. + ``false`` - indicates that the SSL certificate should not be verified. user (True, str, None) @@ -164,11 +167,11 @@ Notes ----- .. note:: - - Parameter vol_state is mandatory if volumes are provided. + - Parameter *vol_state* is mandatory if volumes are provided. - A protection policy can be specified either for an volume group, or for the individual volumes inside the volume group. - A volume can be a member of at most one volume group. - - Specifying "protection_policy" as empty string or "" removes the existing protection policy from a volume group. - - The check_mode is not supported. + - Specifying *protection_policy* as empty string or "" removes the existing protection policy from a volume group. + - The *check_mode* is not supported. - The modules present in this collection named as 'dellemc.powerstore' are built to support the Dell PowerStore storage platform. @@ -183,7 +186,7 @@ Examples - name: Create volume group without protection policy dellemc.powerstore.volumegroup: array_ip: "{{array_ip}}" - verifycert: "{{verifycert}}" + validate_certs: "{{validate_certs}}" user: "{{user}}" password: "{{password}}" vg_name: "{{vg_name}}" @@ -193,7 +196,7 @@ Examples - name: Get details of volume group dellemc.powerstore.volumegroup: array_ip: "{{array_ip}}" - verifycert: "{{verifycert}}" + validate_certs: "{{validate_certs}}" user: "{{user}}" password: "{{password}}" vg_name: "{{vg_name}}" @@ -202,7 +205,7 @@ Examples - name: Add volumes to volume group dellemc.powerstore.volumegroup: array_ip: "{{array_ip}}" - verifycert: "{{verifycert}}" + validate_certs: "{{validate_certs}}" user: "{{user}}" password: "{{password}}" vg_name: "{{vg_name}}" @@ -216,7 +219,7 @@ Examples - name: Remove volumes from volume group dellemc.powerstore.volumegroup: array_ip: "{{array_ip}}" - verifycert: "{{verifycert}}" + validate_certs: "{{validate_certs}}" user: "{{user}}" password: "{{password}}" vg_name: "{{vg_name}}" @@ -229,18 +232,18 @@ Examples - name: Rename volume group and change is_write_order_consistent flag dellemc.powerstore.volumegroup: array_ip: "{{array_ip}}" - verifycert: "{{verifycert}}" + validate_certs: "{{validate_certs}}" user: "{{user}}" password: "{{password}}" vg_name: "{{vg_name}}" new_vg_name: "{{new_vg_name}}" - is_write_order_consistent: False + is_write_order_consistent: false state: "present" - name: Get details of volume group by ID dellemc.powerstore.volumegroup: array_ip: "{{array_ip}}" - verifycert: "{{verifycert}}" + validate_certs: "{{validate_certs}}" user: "{{user}}" password: "{{password}}" vg_id: "{{vg_id}}" @@ -249,7 +252,7 @@ Examples - name: Delete volume group dellemc.powerstore.volumegroup: array_ip: "{{array_ip}}" - verifycert: "{{verifycert}}" + validate_certs: "{{validate_certs}}" user: "{{user}}" password: "{{password}}" name: "{{new_vg_name}}" @@ -258,12 +261,12 @@ Examples - name: Refresh a volume group dellemc.powerstore.volumegroup: array_ip: "{{array_ip}}" - verifycert: "{{verifycert}}" + validate_certs: "{{validate_certs}}" user: "{{user}}" password: "{{password}}" vg_name: "ansible_vg" source_vg: "vg_source" - create_backup_snap: True + create_backup_snap: true backup_snap_profile: name: "test_snap" state: "present" @@ -271,12 +274,12 @@ Examples - name: Restore a volume group dellemc.powerstore.volumegroup: array_ip: "{{array_ip}}" - verifycert: "{{verifycert}}" + validate_certs: "{{validate_certs}}" user: "{{user}}" password: "{{password}}" vg_name: "ansible_vg" source_snap: "snap_source" - create_backup_snap: True + create_backup_snap: true backup_snap_profile: name: "test_snap_restore" state: "present" @@ -284,7 +287,7 @@ Examples - name: Clone a volume group dellemc.powerstore.volumegroup: array_ip: "{{array_ip}}" - verifycert: "{{verifycert}}" + validate_certs: "{{validate_certs}}" user: "{{user}}" password: "{{password}}" vg_name: "ansible_vg" diff --git a/galaxy.yml b/galaxy.yml index 27647a5..b6213bb 100644 --- a/galaxy.yml +++ b/galaxy.yml @@ -9,7 +9,7 @@ namespace: dellemc name: powerstore # The version of the collection. Must be compatible with semantic versioning -version: 1.9.0 +version: 2.0.0 # The path to the Markdown (.md) readme file. This path is relative to the root of the collection readme: README.md @@ -39,10 +39,6 @@ license: - GPL-3.0-or-later - Apache-2.0 -# The path to the license file for the collection. This path is relative to the root of the collection. This key is -# mutually exclusive with 'license' -license_file: - # A list of tags you want to associate with the collection for indexing/searching. A tag name has the same character # requirements as 'namespace' and 'name' tags: [storage] @@ -54,13 +50,13 @@ tags: [storage] dependencies: {} # The URL of the originating SCM repository -repository: https://github.com/dell/ansible-powerstore/tree/1.9.0 +repository: https://github.com/dell/ansible-powerstore/tree/2.0.0 # The URL to any online docs -documentation: https://github.com/dell/ansible-powerstore/tree/1.9.0/docs +documentation: https://github.com/dell/ansible-powerstore/tree/2.0.0/docs # The URL to the homepage of the collection/project -homepage: https://github.com/dell/ansible-powerstore/tree/1.9.0 +homepage: https://github.com/dell/ansible-powerstore/tree/2.0.0 # The URL to the collection issue tracker issues: https://www.dell.com/community/Automation/bd-p/Automation diff --git a/meta/runtime.yml b/meta/runtime.yml index 91da9fd..5a434ef 100644 --- a/meta/runtime.yml +++ b/meta/runtime.yml @@ -5,105 +5,105 @@ plugin_routing: dellemc_powerstore_gatherfacts: redirect: dellemc.powerstore.info deprecation: - removal_date: 2024-03-31 + removal_date: "2024-03-31" warning_text: Use info module instead. dellemc_powerstore_cluster: redirect: dellemc.powerstore.cluster deprecation: - removal_date: 2024-03-31 + removal_date: "2024-03-31" warning_text: Use cluster instead. dellemc_powerstore_filesystem: redirect: dellemc.powerstore.filesystem deprecation: - removal_date: 2024-03-31 + removal_date: "2024-03-31" warning_text: Use filesystem instead. dellemc_powerstore_filesystem_snapshot: redirect: dellemc.powerstore.filesystem_snapshot deprecation: - removal_date: 2024-03-31 + removal_date: "2024-03-31" warning_text: Use filesystem_snapshot instead. dellemc_powerstore_host: redirect: dellemc.powerstore.host deprecation: - removal_date: 2024-03-31 + removal_date: "2024-03-31" warning_text: Use host instead. dellemc_powerstore_hostgroup: redirect: dellemc.powerstore.hostgroup deprecation: - removal_date: 2024-03-31 + removal_date: "2024-03-31" warning_text: Use hostgroup instead. dellemc_powerstore_job: redirect: dellemc.powerstore.job deprecation: - removal_date: 2024-03-31 + removal_date: "2024-03-31" warning_text: Use job instead. dellemc_powerstore_local_user: redirect: dellemc.powerstore.local_user deprecation: - removal_date: 2024-03-31 + removal_date: "2024-03-31" warning_text: Use local_user instead. dellemc_powerstore_nasserver: redirect: dellemc.powerstore.nasserver deprecation: - removal_date: 2024-03-31 + removal_date: "2024-03-31" warning_text: Use nasserver instead. dellemc_powerstore_network: redirect: dellemc.powerstore.network deprecation: - removal_date: 2024-03-31 + removal_date: "2024-03-31" warning_text: Use network instead. dellemc_powerstore_nfs: redirect: dellemc.powerstore.nfs deprecation: - removal_date: 2024-03-31 + removal_date: "2024-03-31" warning_text: Use nfs instead. dellemc_powerstore_protectionpolicy: redirect: dellemc.powerstore.protectionpolicy deprecation: - removal_date: 2024-03-31 + removal_date: "2024-03-31" warning_text: Use protectionpolicy instead. dellemc_powerstore_quota: redirect: dellemc.powerstore.quota deprecation: - removal_date: 2024-03-31 + removal_date: "2024-03-31" warning_text: Use quota instead. dellemc_powerstore_replicationrule: redirect: dellemc.powerstore.replicationrule deprecation: - removal_date: 2024-03-31 + removal_date: "2024-03-31" warning_text: Use replicationrule instead. dellemc_powerstore_replicationsession: redirect: dellemc.powerstore.replicationsession deprecation: - removal_date: 2024-03-31 + removal_date: "2024-03-31" warning_text: Use replicationsession instead. dellemc_powerstore_role: redirect: dellemc.powerstore.role deprecation: - removal_date: 2024-03-31 + removal_date: "2024-03-31" warning_text: Use role instead. dellemc_powerstore_smbshare: redirect: dellemc.powerstore.smbshare deprecation: - removal_date: 2024-03-31 + removal_date: "2024-03-31" warning_text: Use smbshare instead. dellemc_powerstore_snapshot: redirect: dellemc.powerstore.snapshot deprecation: - removal_date: 2024-03-31 + removal_date: "2024-03-31" warning_text: Use snapshot instead. dellemc_powerstore_snapshotrule: redirect: dellemc.powerstore.snapshotrule deprecation: - removal_date: 2024-03-31 + removal_date: "2024-03-31" warning_text: Use snapshotrule instead. dellemc_powerstore_volume: redirect: dellemc.powerstore.volume deprecation: - removal_date: 2024-03-31 + removal_date: "2024-03-31" warning_text: Use volume instead. dellemc_powerstore_volumegroup: redirect: dellemc.powerstore.volumegroup deprecation: - removal_date: 2024-03-31 + removal_date: "2024-03-31" warning_text: Use volumegroup instead. diff --git a/playbooks/modules/certificate.yml b/playbooks/modules/certificate.yml new file mode 100644 index 0000000..e302f7d --- /dev/null +++ b/playbooks/modules/certificate.yml @@ -0,0 +1,78 @@ +--- +- name: Certificate Module Operations on Powerstore Array + hosts: localhost + connection: local + vars: + array_ip: "10.**.**.**" + validate_certs: false + user: "user" + password: "Password" + remote_address: "10.**.**.**" + remote_port: 443 + remote_user_sample: "user" + remote_password: "Password" + certificate_id: "xxx-xxx-xxx" + + tasks: + - name: Get details of certificate with certificate_id + dellemc.powerstore.certificate: + array_ip: "{{ array_ip }}" + user: "{{ user }}" + password: "{{ password }}" + validate_certs: "{{ validate_certs }}" + certificate_id: "{{ certificate_id }}" + state: "present" + + - name: Reset certificates + dellemc.powerstore.certificate: + array_ip: "{{ array_ip }}" + user: "{{ user }}" + password: "{{ password }}" + validate_certs: "{{ validate_certs }}" + service: "VASA_HTTP" + state: "present" + + - name: Exchange certificates + dellemc.powerstore.certificate: + array_ip: "{{ array_ip }}" + user: "{{ user }}" + password: "{{ password }}" + validate_certs: "{{ validate_certs }}" + service: "Replication_HTTP" + remote_address: "{{ remote_address }}" + remote_port: "{{ remote_port }}" + remote_user: "{{ remote_user_sample }}" + remote_password: "{{ remote_password }}" + state: "present" + + - name: Add/import a certificate + dellemc.powerstore.certificate: + array_ip: "{{ array_ip }}" + user: "{{ user }}" + password: "{{ password }}" + validate_certs: "{{ validate_certs }}" + certificate_type: "CA_Client_Validation" + service: "VASA_HTTP" + dellemc.powerstore.certificate: "-----BEGIN CERTIFICATE-----\nSAMPLEKEY\n-----END CERTIFICATE-----\n" + is_current: true + state: "present" + + - name: Modify certificate + dellemc.powerstore.certificate: + array_ip: "{{ array_ip }}" + user: "{{ user }}" + password: "{{ password }}" + validate_certs: "{{ validate_certs }}" + certificate_id: "{{ certificate_id }}" + is_current: true + state: "present" + + - name: Modify certificate - Idempotency + dellemc.powerstore.certificate: + array_ip: "{{ array_ip }}" + user: "{{ user }}" + password: "{{ password }}" + validate_certs: "{{ validate_certs }}" + certificate_id: "{{ certificate_id }}" + is_current: true + state: "present" diff --git a/playbooks/modules/cluster.yml b/playbooks/modules/cluster.yml new file mode 100644 index 0000000..65cb968 --- /dev/null +++ b/playbooks/modules/cluster.yml @@ -0,0 +1,190 @@ +--- +- name: Cluster Module Operations on Powerstore Array + hosts: localhost + connection: local + vars: + array_ip: "10.**.**.**" + validate_certs: false + user: "user" + password: "Password" + cluster_id: "0" + cluster_name: "RT-xxx" + ssh_enable: true + + tasks: + - name: Get details of a cluster by id + dellemc.powerstore.cluster: + array_ip: "{{ array_ip }}" + validate_certs: "{{ validate_certs }}" + user: "{{ user }}" + password: "{{ password }}" + cluster_id: "{{ cluster_id }}" + state: "present" + + - name: Get details of a cluster by name + dellemc.powerstore.cluster: + array_ip: "{{ array_ip }}" + validate_certs: "{{ validate_certs }}" + user: "{{ user }}" + password: "{{ password }}" + cluster_name: "{{ cluster_name }}" + state: "present" + + - name: Rename a cluster and update mtu + dellemc.powerstore.cluster: + array_ip: "{{ array_ip }}" + validate_certs: "{{ validate_certs }}" + user: "{{ user }}" + password: "{{ password }}" + cluster_name: "{{ cluster_name }}" + new_name: "RT-Dxxx" + physical_mtu: 1700 + state: "present" + + - name: Rename a cluster back to the original name and update mtu + dellemc.powerstore.cluster: + array_ip: "{{ array_ip }}" + validate_certs: "{{ validate_certs }}" + user: "{{ user }}" + password: "{{ password }}" + new_name: "{{ cluster_name }}" + cluster_id: "{{ cluster_id }}" + physical_mtu: 1500 + state: "present" + + - name: Update chap mode + dellemc.powerstore.cluster: + array_ip: "{{ array_ip }}" + validate_certs: "{{ validate_certs }}" + user: "{{ user }}" + password: "{{ password }}" + chap_mode: "Single" + cluster_name: "{{ cluster_name }}" + state: "present" + + - name: Disable chap mode + dellemc.powerstore.cluster: + array_ip: "{{ array_ip }}" + validate_certs: "{{ validate_certs }}" + user: "{{ user }}" + password: "{{ password }}" + chap_mode: "Disabled" + cluster_id: "{{ cluster_id }}" + state: "present" + + - name: Enable ssh + dellemc.powerstore.cluster: + array_ip: "{{ array_ip }}" + validate_certs: "{{ validate_certs }}" + user: "{{ user }}" + password: "{{ password }}" + cluster_name: "{{ cluster_name }}" + appliance_id: "A1" + is_ssh_enabled: true + state: "present" + + - name: Disable ssh + dellemc.powerstore.cluster: + array_ip: "{{ array_ip }}" + validate_certs: "{{ validate_certs }}" + user: "{{ user }}" + password: "{{ password }}" + cluster_id: "{{ cluster_id }}" + appliance_id: "A1" + is_ssh_enabled: false + state: "present" + + - name: Validate create cluster + dellemc.powerstore.cluster: + array_ip: "{{ array_ip }}" + validate_certs: "{{ validate_certs }}" + user: "{{ user }}" + password: "{{ password }}" + cluster_name: "{{ cluster_name }}" + ignore_network_warnings: true + appliances: + - link_local_address: "1.2.x.x" + name: "Ansible-cluster" + derive_failure_tolerance_level: "Double" + dns_servers: + - "1.1.x.x" + ntp_servers: + - "1.3.x.x" + networks: + - type: "Management" + vlan_id: 0 + prefix_length: 24 + gateway: "1.x.x.x" + cluster_mgmt_address: "1.x.x.x" + addresses: + - "2.x.x.x" + - "3.x.x.x" + - type: "Storage" + vlan_id: 0 + prefix_length: 42 + gateway: "1.x.x.x" + storage_discovery_address: "1.x.x.x" + addresses: + - "2.x.x.x" + - "3.x.x.x" + purpose: + - "ISCSI" + is_http_redirect_enabled: true + validate_create: true + state: "present" + + - name: Create cluster + dellemc.powerstore.cluster: + array_ip: "{{ array_ip }}" + validate_certs: "{{ validate_certs }}" + user: "{{ user }}" + password: "{{ password }}" + cluster_name: "{{ cluster_name }}" + ignore_network_warnings: true + appliances: + - link_local_address: "1.2.x.x" + name: "Ansible-cluster" + derive_failure_tolerance_level: "Double" + dns_servers: + - "1.1.x.x" + ntp_servers: + - "1.3.x.x" + physical_switch: + - name: "Ansible-switch" + purpose: "Management_Only" + connections: + - address: "1.x.x.x" + port: 20 + connect_method: "SSH" + username: "user" + ssh_password: "password" + networks: + - type: "Management" + vlan_id: 0 + prefix_length: 24 + gateway: "1.x.x.x" + cluster_mgmt_address: "1.x.x.x" + addresses: + - "2.x.x.x" + - "3.x.x.x" + - type: "Storage" + vlan_id: 0 + prefix_length: 42 + gateway: "1.x.x.x" + storage_discovery_address: "1.x.x.x" + addresses: + - "2.x.x.x" + - "3.x.x.x" + purpose: + - "ISCSI" + vcenters: + - address: "1.x.x.x" + username: "user" + password: "password" + is_verify_server_cert: true + vasa_provider_credentials: + username: "user" + password: "password" + is_http_redirect_enabled: true + wait_for_completion: false + state: "present" diff --git a/playbooks/modules/dns.yml b/playbooks/modules/dns.yml new file mode 100644 index 0000000..05b6984 --- /dev/null +++ b/playbooks/modules/dns.yml @@ -0,0 +1,43 @@ +--- +- name: DNS Module Operations on Powerstore Array + hosts: localhost + connection: local + vars: + array_ip: "10.**.**.**" + validate_certs: false + user: "user" + password: "Password" + + tasks: + - name: Get details of DNS instance + dellemc.powerstore.dns: + array_ip: "{{ array_ip }}" + user: "{{ user }}" + password: "{{ password }}" + validate_certs: "{{ validate_certs }}" + dns_id: "DNS1" + state: "present" + + - name: Add addresses to DNS instance + dellemc.powerstore.dns: + array_ip: "{{ array_ip }}" + user: "{{ user }}" + password: "{{ password }}" + validate_certs: "{{ validate_certs }}" + dns_id: "DNS1" + dns_addresses: + - "XX.XX.XX.XX" + dns_address_state: "present-in-dns" + state: "present" + + - name: Remove addresses from DNS instance + dellemc.powerstore.dns: + array_ip: "{{ array_ip }}" + user: "{{ user }}" + password: "{{ password }}" + validate_certs: "{{ validate_certs }}" + dns_id: "DNS1" + dns_addresses: + - "XX.XX.XX.XX" + dns_address_state: "absent-in-dns" + state: "present" diff --git a/playbooks/modules/email.yml b/playbooks/modules/email.yml new file mode 100644 index 0000000..2ce4532 --- /dev/null +++ b/playbooks/modules/email.yml @@ -0,0 +1,99 @@ +--- +- name: Email Module Operations on Powerstore Array + hosts: localhost + connection: local + vars: + array_ip: "10.**.**.**" + validate_certs: false + user: "user" + password: "Password" + + tasks: + - name: Get details of destination email with email_id + dellemc.powerstore.email: + array_ip: "{{ array_ip }}" + user: "{{ user }}" + password: "{{ password }}" + validate_certs: "{{ validate_certs }}" + email_id: "xxx-xxxx-xxxx-xxx-xxxxxxx" + state: "present" + + - name: Get details of destination email with email_address + dellemc.powerstore.email: + array_ip: "{{ array_ip }}" + user: "{{ user }}" + password: "{{ password }}" + validate_certs: "{{ validate_certs }}" + email_address: "abc@example.com" + state: "present" + + - name: Create destination email + dellemc.powerstore.email: + array_ip: "{{ array_ip }}" + user: "{{ user }}" + password: "{{ password }}" + validate_certs: "{{ validate_certs }}" + email_address: "abc@example.com" + notify: + info: true + critical: true + major: false + state: "present" + + - name: Create destination email - Idempotency + dellemc.powerstore.email: + array_ip: "{{ array_ip }}" + user: "{{ user }}" + password: "{{ password }}" + validate_certs: "{{ validate_certs }}" + email_address: "abc@example.com" + notify: + info: true + critical: true + major: false + state: "present" + + - name: Modify destination email + dellemc.powerstore.email: + array_ip: "{{ array_ip }}" + user: "{{ user }}" + password: "{{ password }}" + validate_certs: "{{ validate_certs }}" + email_address: "abc@example.com" + new_address: "xyz@example.com" + notify: + info: false + major: false + state: "present" + + - name: Modify destination email - Idempotency + dellemc.powerstore.email: + array_ip: "{{ array_ip }}" + user: "{{ user }}" + password: "{{ password }}" + validate_certs: "{{ validate_certs }}" + email_address: "abc@example.com" + new_address: "xyz@example.com" + notify: + info: false + major: false + state: "present" + + - name: Send a test mail to the destination email with email_id + dellemc.powerstore.email: + array_ip: "{{ array_ip }}" + user: "{{ user }}" + password: "{{ password }}" + validate_certs: "{{ validate_certs }}" + email_id: "xxx-xxxx-xxxx-xxx-xxxxxxx" + send_test_dellemc.powerstore.email: true + state: "present" + + - name: Delete destination email + dellemc.powerstore.email: + array_ip: "{{ array_ip }}" + user: "{{ user }}" + password: "{{ password }}" + validate_certs: "{{ validate_certs }}" + email_address: "xyz@example.com" + state: "absent" diff --git a/playbooks/modules/filesystem.yml b/playbooks/modules/filesystem.yml new file mode 100644 index 0000000..453c965 --- /dev/null +++ b/playbooks/modules/filesystem.yml @@ -0,0 +1,231 @@ +--- +- name: File system operations on Powerstore Storage System + hosts: localhost + connection: local + vars: + array_ip: "10.**.**.**" + validate_certs: false + user: "user" + password: "Password" + nas_server_id: "xxxx-xxxx-xxxx-xxxx-xxxxxx" + filesystem_name: "Ansible_test_fs" + filesystem_name_prime: "Ansible_test_fs_prime" + description: "Created through ansible" + + tasks: + - name: Create Filesystem by Name for prime attributes + register: result_fs_prime + dellemc.powerstore.filesystem: + array_ip: "{{ array_ip }}" + validate_certs: "{{ validate_certs }}" + user: "{{ user }}" + password: "{{ password }}" + filesystem_name: "{{ filesystem_name_prime }}" + nas_server: "{{ nas_server_id }}" + size: "5" + config_type: "GENERAL" + is_async_mtime_enabled: true + file_events_publishing_mode: "ALL" + flr_attributes: + mode: "Enterprise" + minimum_retention: "5D" + default_retention: "6D" + maximum_retention: "1M" + state: "present" + + - name: Create Filesystem by Name for prime attributes - Idempotency + dellemc.powerstore.filesystem: + array_ip: "{{ array_ip }}" + validate_certs: "{{ validate_certs }}" + user: "{{ user }}" + password: "{{ password }}" + filesystem_name: "{{ filesystem_name_prime }}" + nas_server: "{{ nas_server_id }}" + size: "5" + config_type: "GENERAL" + is_async_mtime_enabled: true + file_events_publishing_mode: "ALL" + flr_attributes: + mode: "Enterprise" + minimum_retention: "5D" + default_retention: "6D" + maximum_retention: "1M" + state: "present" + + - name: Create FileSystem by Name + register: result_fs + dellemc.powerstore.filesystem: + array_ip: "{{ array_ip }}" + validate_certs: "{{ validate_certs }}" + user: "{{ user }}" + password: "{{ password }}" + filesystem_name: "{{ filesystem_name }}" + description: "{{ description }}" + nas_server: "{{ nas_server_id }}" + size: "5" + access_policy: "UNIX" + locking_policy: "MANDATORY" + smb_properties: + is_smb_no_notify_enabled: true + is_smb_notify_on_access_enabled: true + protection_policy: "Test_Modify" + quota_defaults: + grace_period: 1 + grace_period_unit: "weeks" + default_hard_limit: 3 + default_soft_limit: 2 + state: "present" + + - name: Create FileSystem by Name - Idempotency + register: result_fs + dellemc.powerstore.filesystem: + array_ip: "{{ array_ip }}" + validate_certs: "{{ validate_certs }}" + user: "{{ user }}" + password: "{{ password }}" + filesystem_name: "{{ filesystem_name }}" + description: "{{ description }}" + nas_server: "{{ nas_server_id }}" + size: "5" + access_policy: "UNIX" + locking_policy: "MANDATORY" + smb_properties: + is_smb_no_notify_enabled: true + is_smb_notify_on_access_enabled: true + protection_policy: "Test_Modify" + quota_defaults: + grace_period: 1 + grace_period_unit: "weeks" + default_hard_limit: 3 + default_soft_limit: 2 + state: "present" + + - name: Modify File System by id for prime + dellemc.powerstore.filesystem: + array_ip: "{{ array_ip }}" + validate_certs: "{{ validate_certs }}" + user: "{{ user }}" + password: "{{ password }}" + filesystem_id: "{{ fs_id_prime }}" + is_async_mtime_enabled: false + file_events_publishing_mode: "SMB_ONLY" + flr_attributes: + minimum_retention: "10D" + default_retention: "16D" + maximum_retention: "20D" + auto_lock: false + auto_delete: true + policy_interval: 61 + state: "present" + + - name: Modify File System by id for prime - Idempotency + dellemc.powerstore.filesystem: + array_ip: "{{ array_ip }}" + validate_certs: "{{ validate_certs }}" + user: "{{ user }}" + password: "{{ password }}" + filesystem_id: "{{ fs_id_prime }}" + is_async_mtime_enabled: false + file_events_publishing_mode: "SMB_ONLY" + flr_attributes: + minimum_retention: "10D" + default_retention: "16D" + maximum_retention: "20D" + auto_lock: false + auto_delete: true + policy_interval: 61 + state: "present" + + - name: Modify File System by id + dellemc.powerstore.filesystem: + array_ip: "{{ array_ip }}" + validate_certs: "{{ validate_certs }}" + user: "{{ user }}" + password: "{{ password }}" + filesystem_id: "{{ fs_id }}" + folder_rename_policy: "ALL_ALLOWED" + smb_properties: + is_smb_op_locks_enabled: true + smb_notify_on_change_dir_depth: 3 + quota_defaults: + grace_period: 2 + grace_period_unit: "weeks" + default_hard_limit: 2 + default_soft_limit: 1 + state: "present" + + - name: Modify File System by id - Idempotency + dellemc.powerstore.filesystem: + array_ip: "{{ array_ip }}" + validate_certs: "{{ validate_certs }}" + user: "{{ user }}" + password: "{{ password }}" + filesystem_id: "{{ fs_id }}" + folder_rename_policy: "ALL_ALLOWED" + smb_properties: + is_smb_op_locks_enabled: true + smb_notify_on_change_dir_depth: 3 + quota_defaults: + grace_period: 2 + grace_period_unit: "weeks" + default_hard_limit: 2 + default_soft_limit: 1 + state: "present" + + - name: Remove Protection Policy from a File System + dellemc.powerstore.filesystem: + array_ip: "{{ array_ip }}" + validate_certs: "{{ validate_certs }}" + user: "{{ user }}" + password: "{{ password }}" + filesystem_id: "{{ fs_id }}" + protection_policy: "" + state: "present" + + - name: Remove Protection Policy from a File System - Idempotency + dellemc.powerstore.filesystem: + array_ip: "{{ array_ip }}" + validate_certs: "{{ validate_certs }}" + user: "{{ user }}" + password: "{{ password }}" + filesystem_id: "{{ fs_id }}" + protection_policy: "" + state: "present" + + + - name: Get File System details by id + dellemc.powerstore.filesystem: + array_ip: "{{ array_ip }}" + validate_certs: "{{ validate_certs }}" + user: "{{ user }}" + password: "{{ password }}" + filesystem_id: "{{ fs_id }}" + state: "present" + + - name: Delete File System details by id + dellemc.powerstore.filesystem: + array_ip: "{{ array_ip }}" + validate_certs: "{{ validate_certs }}" + user: "{{ user }}" + password: "{{ password }}" + filesystem_id: "{{ fs_id }}" + state: "absent" + + - name: Delete File System details by id -Idempotency + dellemc.powerstore.filesystem: + array_ip: "{{ array_ip }}" + validate_certs: "{{ validate_certs }}" + user: "{{ user }}" + password: "{{ password }}" + filesystem_id: "{{ fs_id }}" + state: "absent" + + - name: Delete File System details by name + dellemc.powerstore.filesystem: + array_ip: "{{ array_ip }}" + validate_certs: "{{ validate_certs }}" + user: "{{ user }}" + password: "{{ password }}" + filesystem_name: "{{ filesystem_name_prime }}" + nas_server: "{{ nas_server_id }}" + state: "absent" diff --git a/playbooks/modules/filesystem_snapshot.yml b/playbooks/modules/filesystem_snapshot.yml new file mode 100644 index 0000000..1dbd3cf --- /dev/null +++ b/playbooks/modules/filesystem_snapshot.yml @@ -0,0 +1,91 @@ +--- +- name: Filesystem Snapshot Operations + hosts: localhost + connection: local + vars: + array_ip: "10.**.**.**" + validate_certs: false + user: "user" + password: "Password" + + tasks: + - name: Create filesystem snapshot + register: result_fs_snapshot + dellemc.powerstore.filesystem_snapshot: + array_ip: "{{ array_ip }}" + validate_certs: "{{ validate_certs }}" + user: "{{ user }}" + password: "{{ password }}" + snapshot_name: "sample_filesystem_snapshot" + nas_server: "ansible_nas_server" + filesystem: "sample_filesystem" + description: "sample description" + desired_retention: 20 + retention_unit: "days" + state: "present" + + - name: Create filesystem snapshot - Idempotency + dellemc.powerstore.filesystem_snapshot: + array_ip: "{{ array_ip }}" + validate_certs: "{{ validate_certs }}" + user: "{{ user }}" + password: "{{ password }}" + snapshot_name: "sample_filesystem_snapshot" + nas_server: "ansible_nas_server" + filesystem: "sample_filesystem" + description: "sample description" + desired_retention: 20 + retention_unit: "days" + state: "present" + + - name: Get the details of filesystem snapshot + dellemc.powerstore.filesystem_snapshot: + array_ip: "{{ array_ip }}" + validate_certs: "{{ validate_certs }}" + user: "{{ user }}" + password: "{{ password }}" + snapshot_id: "{{ fs_snapshot_id }}" + state: "present" + + - name: Modify the filesystem snapshot + dellemc.powerstore.filesystem_snapshot: + array_ip: "{{ array_ip }}" + validate_certs: "{{ validate_certs }}" + user: "{{ user }}" + password: "{{ password }}" + snapshot_name: "sample_filesystem_snapshot" + nas_server: "ansible_nas_server" + description: "modify description" + expiration_timestamp: "" + state: "present" + + - name: Modify the filesystem snapshot - Idempotency + dellemc.powerstore.filesystem_snapshot: + array_ip: "{{ array_ip }}" + validate_certs: "{{ validate_certs }}" + user: "{{ user }}" + password: "{{ password }}" + snapshot_name: "sample_filesystem_snapshot" + nas_server: "ansible_nas_server" + description: "modify description" + expiration_timestamp: "" + state: "present" + + - name: Delete filesystem snapshot + dellemc.powerstore.filesystem_snapshot: + array_ip: "{{ array_ip }}" + validate_certs: "{{ validate_certs }}" + user: "{{ user }}" + password: "{{ password }}" + snapshot_id: "{{ fs_snapshot_id }}" + state: "absent" + + - name: Delete filesystem snapshot - Idempotency + dellemc.powerstore.filesystem_snapshot: + array_ip: "{{ array_ip }}" + validate_certs: "{{ validate_certs }}" + user: "{{ user }}" + password: "{{ password }}" + snapshot_name: "sample_filesystem_snapshot" + nas_server: "ansible_nas_server" + state: "absent" diff --git a/playbooks/modules/host.yml b/playbooks/modules/host.yml new file mode 100644 index 0000000..6fdb13d --- /dev/null +++ b/playbooks/modules/host.yml @@ -0,0 +1,232 @@ +--- +- name: Testing host operations + hosts: localhost + connection: local + vars: + array_ip: "10.**.**.**" + validate_certs: false + user: "user" + password: "Password" + host_name_fc: "Ansible_Testing_host_FC" + host_name_iscsi: "Ansible_Testing_host_ISCSI" + host_name_iscsi_2: "Ansible_Testing_host_ISCSI_2" + host_name_nvme: "Ansible_Testing_host_NVMe" + new_host_name: "Ansible_Testing_host2" + + tasks: + - name: Create host with FC type initiators + register: fc_host + dellemc.powerstore.host: + array_ip: "{{ array_ip }}" + validate_certs: "{{ validate_certs }}" + user: "{{ user }}" + password: "{{ password }}" + host_name: "{{ host_name_fc }}" + os_type: "Windows" + initiators: + - XX.XX.XX.XX + state: "present" + host_connectivity: "Metro_Optimize_Both" + initiator_state: "present-in-host" + + - name: Create host with ISCSI type initiators + register: iscsi_host + dellemc.powerstore.host: + array_ip: "{{ array_ip }}" + validate_certs: "{{ validate_certs }}" + user: "{{ user }}" + password: "{{ password }}" + host_name: "{{ host_name_iscsi }}" + os_type: "ESXi" + initiators: + - XX.XX.XX.XX + state: "present" + initiator_state: "present-in-host" + + - name: Create host with NVMe type initiators + register: nvme_host + dellemc.powerstore.host: + array_ip: "{{ array_ip }}" + validate_certs: "{{ validate_certs }}" + user: "{{ user }}" + password: "{{ password }}" + host_name: "{{ host_name_nvme }}" + os_type: "ESXi" + initiators: + - XX.XX.XX.XX + state: "present" + initiator_state: "present-in-host" + + - name: Create host with ISCSI type initiators and its details + register: iscsi_host_2 + dellemc.powerstore.host: + array_ip: "{{ array_ip }}" + validate_certs: "{{ validate_certs }}" + user: "{{ user }}" + password: "{{ password }}" + host_name: "{{ host_name_iscsi_2 }}" + os_type: "ESXi" + detailed_initiators: + - port_name: "XX.XX.XX.XX" + port_type: "iSCSI" + chap_single_username: "chapuser" + chap_single_password: "chappasswd" + state: "present" + initiator_state: "present-in-host" + + - name: Get host details with name + dellemc.powerstore.host: + array_ip: "{{ array_ip }}" + validate_certs: "{{ validate_certs }}" + user: "{{ user }}" + password: "{{ password }}" + host_name: "{{ fc_host.host_details.name }}" + state: "present" + + - name: Get host details with ID + dellemc.powerstore.host: + array_ip: "{{ array_ip }}" + validate_certs: "{{ validate_certs }}" + user: "{{ user }}" + password: "{{ password }}" + host_id: "{{ fc_host.host_details.id }}" + state: "present" + + - name: Adding initiator to host using host_name + dellemc.powerstore.host: + array_ip: "{{ array_ip }}" + validate_certs: "{{ validate_certs }}" + user: "{{ user }}" + password: "{{ password }}" + host_name: "{{ host_name_fc }}" + initiators: + - XX.XX.XX.XX + initiator_state: "present-in-host" + state: "present" + + - name: Adding initiator to host using host_name + dellemc.powerstore.host: + array_ip: "{{ array_ip }}" + validate_certs: "{{ validate_certs }}" + user: "{{ user }}" + password: "{{ password }}" + host_name: "{{ host_name_iscsi_2 }}" + detailed_initiators: + - port_name: "XX.XX.XX.XX" + port_type: "iSCSI" + chap_single_username: "chapuser" + chap_single_password: "chappasswd" + - port_name: "XX.XX.XX.XX" + port_type: "iSCSI" + chap_mutual_username: "chapuserMutual" + chap_mutual_password: "chappasswd" + initiator_state: present-in-host + state: present + + - name: Adding initiator to host using host_id + dellemc.powerstore.host: + array_ip: "{{ array_ip }}" + validate_certs: "{{ validate_certs }}" + user: "{{ user }}" + password: "{{ password }}" + host_id: "{{ iscsi_host.host_details.id }}" + initiators: + - XX.XX.XX.XX + initiator_state: "present-in-host" + state: "present" + + - name: Removing initiator from host using host_name + dellemc.powerstore.host: + array_ip: "{{ array_ip }}" + validate_certs: "{{ validate_certs }}" + user: "{{ user }}" + password: "{{ password }}" + host_name: "{{ host_name_fc }}" + initiators: + - XX.XX.XX.XX + initiator_state: "absent-in-host" + state: "present" + + - name: Removing initiator from host using host_name + dellemc.powerstore.host: + array_ip: "{{ array_ip }}" + validate_certs: "{{ validate_certs }}" + user: "{{ user }}" + password: "{{ password }}" + host_name: "{{ host_name_iscsi_2 }}" + detailed_initiators: + - port_name: "XX.XX.XX.XX" + port_type: "iSCSI" + chap_single_username: "chapuser" + chap_single_password: "chappasswd" + initiator_state: "absent-in-host" + state: "present" + + - name: Removing initiator from host using host_id + dellemc.powerstore.host: + array_ip: "{{ array_ip }}" + validate_certs: "{{ validate_certs }}" + user: "{{ user }}" + password: "{{ password }}" + host_id: "{{ iscsi_host.host_details.id }}" + initiators: + - XX.XX.XX.XX + initiator_state: "absent-in-host" + state: "present" + + - name: Modify Host connectivity of host + dellemc.powerstore.host: + array_ip: "{{ array_ip }}" + validate_certs: "{{ validate_certs }}" + user: "{{ user }}" + password: "{{ password }}" + host_name: "{{ host_name_fc }}" + host_connectivity: "Metro_Optimize_Local" + state: "present" + + - name: Rename host using host_name + dellemc.powerstore.host: + array_ip: "{{ array_ip }}" + validate_certs: "{{ validate_certs }}" + user: "{{ user }}" + password: "{{ password }}" + host_name: "{{ host_name_fc }}" + new_name: "{{ new_host_name }}" + state: "present" + + - name: Rename host using host_id + dellemc.powerstore.host: + array_ip: "{{ array_ip }}" + validate_certs: "{{ validate_certs }}" + user: "{{ user }}" + password: "{{ password }}" + host_id: "{{ fc_host.host_details.id }}" + new_name: "new_host_name2" + state: "present" + + - name: Delete host using host_name + dellemc.powerstore.host: + array_ip: "{{ array_ip }}" + validate_certs: "{{ validate_certs }}" + user: "{{ user }}" + password: "{{ password }}" + host_name: "new_host_name2" + state: "absent" + + - name: Delete host using host_id + dellemc.powerstore.host: + array_ip: "{{ array_ip }}" + validate_certs: "{{ validate_certs }}" + user: "{{ user }}" + password: "{{ password }}" + host_id: "{{ iscsi_host.host_details.id }}" + state: "absent" + + - name: Delete host using host_id + dellemc.powerstore.host: + array_ip: "{{ array_ip }}" + validate_certs: "{{ validate_certs }}" + user: "{{ user }}" + password: "{{ password }}" + host_id: "{{ nvme_host.host_details.id }}" + state: "absent" diff --git a/playbooks/modules/hostgroup.yml b/playbooks/modules/hostgroup.yml new file mode 100644 index 0000000..9d1e002 --- /dev/null +++ b/playbooks/modules/hostgroup.yml @@ -0,0 +1,132 @@ +--- +- name: Testing host group operations + hosts: localhost + connection: local + vars: + array_ip: "10.**.**.**" + validate_certs: false + user: "user" + password: "Password" + hostgroup_name1: "Ansible_Test_host_group1" + hostgroup_name2: "Ansible_Test_host_group2" + new_name1: "Ansible_Test_host_group_New1" + new_name2: "Ansible_Test_host_group_New2" + host_name_iscsi1: "host1" + host_name_iscsi2: "host2" + + tasks: + - name: Create host group with hosts using host name + register: hostgroup1 + dellemc.powerstore.hostgroup: + array_ip: "{{ array_ip }}" + validate_certs: "{{ validate_certs }}" + user: "{{ user }}" + password: "{{ password }}" + hostgroup_name: "{{ hostgroup_name1 }}" + hosts: "{{ host1.host_details.name }}" + host_state: present-in-group + state: present + + - name: Create host group with hosts using host ID + register: hostgroup2 + dellemc.powerstore.hostgroup: + array_ip: "{{ array_ip }}" + validate_certs: "{{ validate_certs }}" + user: "{{ user }}" + password: "{{ password }}" + hostgroup_name: "{{ hostgroup_name2 }}" + hosts: + - "{{ host2.host_details.id }}" + - "{{ host3.host_details.id }}" + host_state: present-in-group + state: present + + - name: Get host group details + dellemc.powerstore.hostgroup: + array_ip: "{{ array_ip }}" + validate_certs: "{{ validate_certs }}" + user: "{{ user }}" + password: "{{ password }}" + hostgroup_name: "{{ hostgroup_name1 }}" + state: "present" + + - name: Get host group details using hostgroup ID + dellemc.powerstore.hostgroup: + array_ip: "{{ array_ip }}" + validate_certs: "{{ validate_certs }}" + user: "{{ user }}" + password: "{{ password }}" + hostgroup_id: "{{ hostgroup1.hostgroup_details.id }}" + state: "present" + + - name: Adding host to host group + dellemc.powerstore.hostgroup: + array_ip: "{{ array_ip }}" + validate_certs: "{{ validate_certs }}" + user: "{{ user }}" + password: "{{ password }}" + hostgroup_name: "{{ hostgroup_name2 }}" + hosts: + - "{{ host4.host_details.id }}" + host_state: "present-in-group" + state: "present" + + - name: Removing host from host group + dellemc.powerstore.hostgroup: + array_ip: "{{ array_ip }}" + validate_certs: "{{ validate_certs }}" + user: "{{ user }}" + password: "{{ password }}" + hostgroup_id: "{{ hostgroup2.hostgroup_details.id }}" + hosts: + - host_name_ISCSI4 + host_state: "absent-in-group" + state: "present" + + - name: Modify host group + dellemc.powerstore.hostgroup: + array_ip: "{{ array_ip }}" + validate_certs: "{{ validate_certs }}" + user: "{{ user }}" + password: "{{ password }}" + hostgroup_name: "{{ hostgroup_name1 }}" + host_connectivity: "Metro_Optimize_Local" + state: "present" + + - name: Rename host group + dellemc.powerstore.hostgroup: + array_ip: "{{ array_ip }}" + validate_certs: "{{ validate_certs }}" + user: "{{ user }}" + password: "{{ password }}" + hostgroup_name: "{{ hostgroup_name1 }}" + new_name: "{{ new_name1 }}" + state: "present" + + - name: Rename host group using hostgroup ID + dellemc.powerstore.hostgroup: + array_ip: "{{ array_ip }}" + validate_certs: "{{ validate_certs }}" + user: "{{ user }}" + password: "{{ password }}" + hostgroup_id: "{{ hostgroup2.hostgroup_details.id }}" + new_name: "{{ new_name2 }}" + state: "present" + + - name: Delete host group + dellemc.powerstore.hostgroup: + array_ip: "{{ array_ip }}" + validate_certs: "{{ validate_certs }}" + user: "{{ user }}" + password: "{{ password }}" + hostgroup_name: "{{ new_name1 }}" + state: "absent" + + - name: Delete host group using hostgroup ID + dellemc.powerstore.hostgroup: + array_ip: "{{ array_ip }}" + validate_certs: "{{ validate_certs }}" + user: "{{ user }}" + password: "{{ password }}" + hostgroup_id: "{{ hostgroup2.hostgroup_details.id }}" + state: "absent" diff --git a/playbooks/modules/info.yml b/playbooks/modules/info.yml new file mode 100644 index 0000000..283d3af --- /dev/null +++ b/playbooks/modules/info.yml @@ -0,0 +1,478 @@ +--- +- name: Collect set of facts for a given Powerstore Storage System + hosts: localhost + connection: local + vars: + array_ip: "10.**.**.**" + validate_certs: false + user: "user" + password: "Password" + + tasks: + - name: Get the facts for a given Powerstore Storage System + dellemc.powerstore.info: + array_ip: "{{ array_ip }}" + validate_certs: "{{ validate_certs }}" + user: "{{ user }}" + password: "{{ password }}" + gather_subset: + - vol + - vg + - host + - hg + - snapshot_rule + - node + - nas_server + - nfs_export + - smb_share + - tree_quota + - user_quota + - file_system + - protection_policy + - replication_rule + - replication_session + - remote_system + - network + - role + - user + - appliance + - storage_container + all_pages: true + register: subset_result + - name: Store the subset result + ansible.builtin.debug: + var: subset_result + + - name: Get Volumes whose state not equal to ready + dellemc.powerstore.info: + array_ip: "{{ array_ip }}" + validate_certs: "{{ validate_certs }}" + user: "{{ user }}" + password: "{{ password }}" + gather_subset: + - vol + filters: + - filter_key: state + filter_operator: notequal + filter_value: ready + register: subset_result + - name: Store the subset result + ansible.builtin.debug: + var: subset_result + + - name: Get Volume Groups whose name contains the word "test" + dellemc.powerstore.info: + array_ip: "{{ array_ip }}" + validate_certs: "{{ validate_certs }}" + user: "{{ user }}" + password: "{{ password }}" + gather_subset: + - vg + filters: + - filter_key: name + filter_operator: like + filter_value: "*test*" + register: subset_result + - name: Store the subset result + ansible.builtin.debug: + var: subset_result + + - name: Get protection policies of type replication + dellemc.powerstore.info: + array_ip: "{{ array_ip }}" + validate_certs: "{{ validate_certs }}" + user: "{{ user }}" + password: "{{ password }}" + gather_subset: + - protection_policy + filters: + - filter_key: is_replica + filter_operator: equal + filter_value: "true" + register: subset_result + - name: Store the subset result + ansible.builtin.debug: + var: subset_result + + - name: Get all non-Linux hosts + dellemc.powerstore.info: + array_ip: "{{ array_ip }}" + validate_certs: "{{ validate_certs }}" + user: "{{ user }}" + password: "{{ password }}" + gather_subset: + - host + filters: + - filter_key: os_type + filter_operator: notequal + filter_value: Linux + register: subset_result + - name: Store the subset result + ansible.builtin.debug: + var: subset_result + + - name: Get Host Groups whose name endswith word "iscsi" + dellemc.powerstore.info: + array_ip: "{{ array_ip }}" + validate_certs: "{{ validate_certs }}" + user: "{{ user }}" + password: "{{ password }}" + gather_subset: + - hg + filters: + - filter_key: name + filter_operator: like + filter_value: "*iscsi" + register: subset_result + - name: Store the subset result + ansible.builtin.debug: + var: subset_result + + - name: Get Snapshot Rules whose desired_retention is between 101-499 + dellemc.powerstore.info: + array_ip: "{{ array_ip }}" + validate_certs: "{{ validate_certs }}" + user: "{{ user }}" + password: "{{ password }}" + gather_subset: + - snapshot_rule + filters: + - filter_key: desired_retention + filter_operator: greater + filter_value: "100" + - filter_key: desired_retention + filter_operator: lesser + filter_value: "500" + register: subset_result + - name: Store the subset result + ansible.builtin.debug: + var: subset_result + + - name: Get Nodes whose slot is greater than 0 + dellemc.powerstore.info: + array_ip: "{{ array_ip }}" + validate_certs: "{{ validate_certs }}" + user: "{{ user }}" + password: "{{ password }}" + gather_subset: + - node + filters: + - filter_key: slot + filter_operator: greater + filter_value: "0" + register: subset_result + - name: Store the subset result + ansible.builtin.debug: + var: subset_result + + - name: Get NAS Servers whose name & description equal to "ansible_nas_server" + dellemc.powerstore.info: + array_ip: "{{ array_ip }}" + validate_certs: "{{ validate_certs }}" + user: "{{ user }}" + password: "{{ password }}" + gather_subset: + - nas_server + filters: + - filter_key: name + filter_operator: equal + filter_value: ansible_nas_server + - filter_key: description + filter_operator: equal + filter_value: ansible_nas_server + register: subset_result + - name: Store the subset result + ansible.builtin.debug: + var: subset_result + + - name: Get NFS Exports whose name equal to "ansible_export" + dellemc.powerstore.info: + array_ip: "{{ array_ip }}" + validate_certs: "{{ validate_certs }}" + user: "{{ user }}" + password: "{{ password }}" + gather_subset: + - nfs_export + filters: + - filter_key: name + filter_operator: equal + filter_value: ansible_export + register: subset_result + - name: Store the subset result + ansible.builtin.debug: + var: subset_result + + - name: Get SMB Shares whose name startswith "smb_share" + dellemc.powerstore.info: + array_ip: "{{ array_ip }}" + validate_certs: "{{ validate_certs }}" + user: "{{ user }}" + password: "{{ password }}" + gather_subset: + - smb_share + filters: + - filter_key: name + filter_operator: like + filter_value: smb_share* + register: subset_result + - name: Store the subset result + ansible.builtin.debug: + var: subset_result + + - name: Get Tree Quotas whose hard_limit is greater than 20971520 + dellemc.powerstore.info: + array_ip: "{{ array_ip }}" + validate_certs: "{{ validate_certs }}" + user: "{{ user }}" + password: "{{ password }}" + gather_subset: + - tree_quota + filters: + - filter_key: hard_limit + filter_operator: greater + filter_value: "20971520" + register: subset_result + - name: Store the subset result + ansible.builtin.debug: + var: subset_result + + - name: Get Tree Quotas whose hard_limit is between 20971521-100971519 + dellemc.powerstore.info: + array_ip: "{{ array_ip }}" + validate_certs: "{{ validate_certs }}" + user: "{{ user }}" + password: "{{ password }}" + gather_subset: + - tree_quota + filters: + - filter_key: hard_limit + filter_operator: greater + filter_value: "20971520" + - filter_key: hard_limit + filter_operator: lesser + filter_value: "100971520" + register: subset_result + - name: Store the subset result + ansible.builtin.debug: + var: subset_result + + - name: Get Tree Quotas whose hard_limit is lesser than 100971520 + dellemc.powerstore.info: + array_ip: "{{ array_ip }}" + validate_certs: "{{ validate_certs }}" + user: "{{ user }}" + password: "{{ password }}" + gather_subset: + - tree_quota + filters: + - filter_key: hard_limit + filter_operator: lesser + filter_value: "100971520" + register: subset_result + - name: Store the subset result + ansible.builtin.debug: + var: subset_result + + - name: Get User Quotas whose uid equal to 1 + dellemc.powerstore.info: + array_ip: "{{ array_ip }}" + validate_certs: "{{ validate_certs }}" + user: "{{ user }}" + password: "{{ password }}" + gather_subset: + - user_quota + filters: + - filter_key: uid + filter_operator: equal + filter_value: "1" + register: subset_result + - name: Store the subset result + ansible.builtin.debug: + var: subset_result + + - name: Get User Quotas whose uid not equal to 1 + dellemc.powerstore.info: + array_ip: "{{ array_ip }}" + validate_certs: "{{ validate_certs }}" + user: "{{ user }}" + password: "{{ password }}" + gather_subset: + - user_quota + filters: + - filter_key: uid + filter_operator: notequal + filter_value: "1" + register: subset_result + - name: Store the subset result + ansible.builtin.debug: + var: subset_result + + - name: Get File Systems whose name startswith "ansible" + dellemc.powerstore.info: + array_ip: "{{ array_ip }}" + validate_certs: "{{ validate_certs }}" + user: "{{ user }}" + password: "{{ password }}" + gather_subset: + - file_system + filters: + - filter_key: name + filter_operator: like + filter_value: ansible* + register: subset_result + - name: Store the subset result + ansible.builtin.debug: + var: subset_result + + - name: Get Networks whose name contains the word "Management" + dellemc.powerstore.info: + array_ip: "{{ array_ip }}" + validate_certs: "{{ validate_certs }}" + user: "{{ user }}" + password: "{{ password }}" + gather_subset: + - network + filters: + - filter_key: name + filter_operator: like + filter_value: "*Management*" + + - name: Get Local users whose name is admin + dellemc.powerstore.info: + array_ip: "{{ array_ip }}" + validate_certs: "{{ validate_certs }}" + user: "{{ user }}" + password: "{{ password }}" + gather_subset: + - user + filters: + - filter_key: name + filter_operator: equal + filter_value: admin + + - name: Get Roles whose name contains the word "Admin" + dellemc.powerstore.info: + array_ip: "{{ array_ip }}" + validate_certs: "{{ validate_certs }}" + user: "{{ user }}" + password: "{{ password }}" + gather_subset: + - role + filters: + - filter_key: name + filter_operator: like + filter_value: "*Admin*" + + - name: Get list of ad, certificate, security config and ldaps + dellemc.powerstore.info: + array_ip: "{{ array_ip }}" + validate_certs: "{{ validate_certs }}" + user: "{{ user }}" + password: "{{ password }}" + gather_subset: + - ad + - ldap + - security_config + - certificate + + - name: Get LDAP where the nas server id is "XX.XX.XX.XX" + dellemc.powerstore.info: + array_ip: "{{ array_ip }}" + validate_certs: "{{ validate_certs }}" + user: "{{ user }}" + password: "{{ password }}" + gather_subset: + - ldap + filters: + - filter_key: nas_server_id + filter_operator: equal + filter_value: XX.XX.XX.XX + + - name: Get list of dns, email notification, ntp, remote support, remote support + contact and smtp config + dellemc.powerstore.info: + array_ip: "{{ array_ip }}" + validate_certs: "{{ validate_certs }}" + user: "{{ user }}" + password: "{{ password }}" + gather_subset: + - dns + - email_notification + - ntp + - remote_support + - remote_support_contact + - smtp_config + + - name: Get list of LDAP accounts + dellemc.powerstore.info: + array_ip: "{{ array_ip }}" + validate_certs: "{{ validate_certs }}" + user: "{{ user }}" + password: "{{ password }}" + gather_subset: + - ldap_account + + - name: Get list of LDAP domain configurations + dellemc.powerstore.info: + array_ip: "{{ array_ip }}" + validate_certs: "{{ validate_certs }}" + user: "{{ user }}" + password: "{{ password }}" + gather_subset: + - ldap_domain + + - name: Get list of vCenter + dellemc.powerstore.info: + array_ip: "{{ array_ip }}" + validate_certs: "{{ validate_certs }}" + user: "{{ user }}" + password: "{{ password }}" + gather_subset: + - vcenter + + - name: Get list of virtual volumes + dellemc.powerstore.info: + array_ip: "{{ array_ip }}" + validate_certs: "{{ validate_certs }}" + user: "{{ user }}" + password: "{{ password }}" + gather_subset: + - virtual_volume + + - name: Get list of virtual volumes with nsid between 14440-14460 + dellemc.powerstore.info: + array_ip: "{{ array_ip }}" + validate_certs: "{{ validate_certs }}" + user: "{{ user }}" + password: "{{ password }}" + gather_subset: + - virtual_volume + filters: + - filter_key: nsid + filter_operator: greater + filter_value: "14440" + - filter_key: nsid + filter_operator: lesser + filter_value: "14460" + + - name: Get list of storage containers + dellemc.powerstore.info: + array_ip: "{{ array_ip }}" + validate_certs: "{{ validate_certs }}" + user: "{{ user }}" + password: "{{ password }}" + gather_subset: + - storage_container + + - name: Get list of storage containers with filter + dellemc.powerstore.info: + array_ip: "{{ array_ip }}" + validate_certs: "{{ validate_certs }}" + user: "{{ user }}" + password: "{{ password }}" + gather_subset: + - storage_container + filters: + - filter_key: storage_protocol + filter_operator: equal + filter_value: SCSI diff --git a/playbooks/modules/job.yml b/playbooks/modules/job.yml new file mode 100644 index 0000000..8ae9352 --- /dev/null +++ b/playbooks/modules/job.yml @@ -0,0 +1,18 @@ +--- +- name: Perform Job operations for a given PowerStore storage system + hosts: localhost + connection: local + vars: + array_ip: "10.**.**.**" + validate_certs: false + user: "user" + password: "Password" + + tasks: + - name: Get Job Details + dellemc.powerstore.job: + array_ip: "{{ array_ip }}" + validate_certs: "{{ validate_certs }}" + user: "{{ user }}" + password: "{{ password }}" + job_id: "XX.XX.XX.XX" diff --git a/playbooks/modules/ldap_account.yml b/playbooks/modules/ldap_account.yml new file mode 100644 index 0000000..3ff7659 --- /dev/null +++ b/playbooks/modules/ldap_account.yml @@ -0,0 +1,127 @@ +--- +- name: LDAP Account Module Operations on Powerstore Array + hosts: localhost + connection: local + vars: + array_ip: "10.**.**.**" + validate_certs: false + user: "user" + password: "Password" + + tasks: + - name: Create an LDAP account - check mode + register: result + dellemc.powerstore.ldap_account: + array_ip: "{{ array_ip }}" + validate_certs: "{{ validate_certs }}" + user: "{{ user }}" + password: "{{ password }}" + ldap_account_name: "ldap_test_user_1" + ldap_domain_id: "2" + role_name: "Administrator" + ldap_account_type: "User" + state: "present" + check_mode: true + + - name: Create an LDAP account + register: result + dellemc.powerstore.ldap_account: + array_ip: "{{ array_ip }}" + validate_certs: "{{ validate_certs }}" + user: "{{ user }}" + password: "{{ password }}" + ldap_account_name: "ldap_test_user_1" + ldap_domain_id: "2" + role_name: "Administrator" + ldap_account_type: "User" + state: "present" + + - name: Create an LDAP account - Idempotency + register: result + dellemc.powerstore.ldap_account: + array_ip: "{{ array_ip }}" + validate_certs: "{{ validate_certs }}" + user: "{{ user }}" + password: "{{ password }}" + ldap_account_name: "ldap_test_user_1" + ldap_domain_id: "2" + role_id: "1" + ldap_account_type: "User" + state: "present" + + - name: Get the details of the LDAP account + dellemc.powerstore.ldap_account: + array_ip: "{{ array_ip }}" + validate_certs: "{{ validate_certs }}" + user: "{{ user }}" + password: "{{ password }}" + ldap_account_id: "{{ result.ldap_account_details.id }}" + state: "present" + + - name: Get the details of the LDAP account by name + dellemc.powerstore.ldap_account: + array_ip: "{{ array_ip }}" + validate_certs: "{{ validate_certs }}" + user: "{{ user }}" + password: "{{ password }}" + ldap_account_name: "ldap_test_user_1" + state: "present" + + - name: Modify an LDAP account - check mode + dellemc.powerstore.ldap_account: + array_ip: "{{ array_ip }}" + validate_certs: "{{ validate_certs }}" + user: "{{ user }}" + password: "{{ password }}" + ldap_account_name: "ldap_test_user_1" + role_id: "5" + state: "present" + check_mode: true + + - name: Modify an LDAP account + dellemc.powerstore.ldap_account: + array_ip: "{{ array_ip }}" + validate_certs: "{{ validate_certs }}" + user: "{{ user }}" + password: "{{ password }}" + ldap_account_name: "ldap_test_user_1" + role_id: "5" + state: "present" + + - name: Modify an LDAP account - Idempotency + dellemc.powerstore.ldap_account: + array_ip: "{{ array_ip }}" + validate_certs: "{{ validate_certs }}" + user: "{{ user }}" + password: "{{ password }}" + ldap_account_name: "ldap_test_user_1" + role_id: "5" + state: "present" + + - name: Delete an LDAP account - check mode + dellemc.powerstore.ldap_account: + array_ip: "{{ array_ip }}" + validate_certs: "{{ validate_certs }}" + user: "{{ user }}" + password: "{{ password }}" + ldap_account_name: "ldap_test_user_1" + state: "absent" + check_mode: true + + - name: Delete an LDAP account + dellemc.powerstore.ldap_account: + array_ip: "{{ array_ip }}" + validate_certs: "{{ validate_certs }}" + user: "{{ user }}" + password: "{{ password }}" + ldap_account_name: "ldap_test_user_1" + state: "absent" + + - name: Delete an LDAP account - Idempotency + dellemc.powerstore.ldap_account: + array_ip: "{{ array_ip }}" + validate_certs: "{{ validate_certs }}" + user: "{{ user }}" + password: "{{ password }}" + ldap_account_name: "ldap_test_user_1" + state: "absent" diff --git a/playbooks/modules/ldap_domain.yml b/playbooks/modules/ldap_domain.yml new file mode 100644 index 0000000..d942b1e --- /dev/null +++ b/playbooks/modules/ldap_domain.yml @@ -0,0 +1,238 @@ +--- +- name: LDAP Domain Operations on Powerstore Array + hosts: localhost + connection: local + gather_facts: false + vars: + array_ip: "10.**.**.**" + validate_certs: false + user: "user" + password: "Password" + + tasks: + - name: Create LDAP domain with check mode + dellemc.powerstore.ldap_domain: + array_ip: "{{ array_ip }}" + validate_certs: "{{ validate_certs }}" + user: "{{ user }}" + password: "{{ password }}" + ldap_domain_name: "ansildap.com" + ldap_servers: ["XX.XX.XX.XX"] + ldap_server_state: "present-in-domain" + protocol: "LDAP" + ldap_server_type: "OpenLDAP" + bind_user: "cn=cn_user,dc=exampleldap,dc=com" + bind_password: "Password" + ldap_domain_user_settings: + user_search_path: "cn=Users" + ldap_domain_group_settings: + group_search_path: "cn=Users" + state: "present" + check_mode: true + + - name: Create LDAP domain + register: result + dellemc.powerstore.ldap_domain: + array_ip: "{{ array_ip }}" + validate_certs: "{{ validate_certs }}" + user: "{{ user }}" + password: "{{ password }}" + ldap_domain_name: "ansildap.com" + ldap_servers: ["XX.XX.XX.XX"] + ldap_server_state: "present-in-domain" + protocol: "LDAP" + ldap_server_type: "OpenLDAP" + bind_user: "cn=cn_user,dc=exampleldap,dc=com" + bind_password: "Password" + ldap_domain_user_settings: + user_search_path: "cn=Users" + ldap_domain_group_settings: + group_search_path: "cn=Users" + state: "present" + + - name: Create LDAP domain idempotency + dellemc.powerstore.ldap_domain: + array_ip: "{{ array_ip }}" + validate_certs: "{{ validate_certs }}" + user: "{{ user }}" + password: "{{ password }}" + ldap_domain_name: "ansildap.com" + ldap_servers: ["XX.XX.XX.XX"] + ldap_server_state: "present-in-domain" + protocol: "LDAP" + ldap_server_type: "OpenLDAP" + bind_user: "cn=cn_user,dc=exampleldap,dc=com" + bind_password: "Password" + ldap_domain_user_settings: + user_search_path: "cn=Users" + ldap_domain_group_settings: + group_search_path: "cn=Users" + state: "present" + + - name: Get LDAP domain details using ID + dellemc.powerstore.ldap_domain: + array_ip: "{{ array_ip }}" + validate_certs: "{{ validate_certs }}" + user: "{{ user }}" + password: "{{ password }}" + ldap_domain_id: "{{ result.ldap_domain_details.id }}" + state: "present" + + - name: Verify LDAP domain configuration + dellemc.powerstore.ldap_domain: + array_ip: "{{ array_ip }}" + validate_certs: "{{ validate_certs }}" + user: "{{ user }}" + password: "{{ password }}" + ldap_domain_id: "{{ result.ldap_domain_details.id }}" + verify_configuration: true + state: "present" + + - name: Modify LDAP domain configuration with check mode + dellemc.powerstore.ldap_domain: + array_ip: "{{ array_ip }}" + validate_certs: "{{ validate_certs }}" + user: "{{ user }}" + password: "{{ password }}" + ldap_domain_id: "{{ result.ldap_domain_details.id }}" + ldap_domain_user_settings: + user_search_path: "cn=admin" + user_object_class: "posixAccount" + state: "present" + check_mode: true + + - name: Modify LDAP domain configuration + dellemc.powerstore.ldap_domain: + array_ip: "{{ array_ip }}" + validate_certs: "{{ validate_certs }}" + user: "{{ user }}" + password: "{{ password }}" + ldap_domain_id: "{{ result.ldap_domain_details.id }}" + ldap_domain_user_settings: + user_search_path: "cn=admin" + user_object_class: "posixAccount" + state: "present" + + - name: Modify LDAP domain configuration idempotency + dellemc.powerstore.ldap_domain: + array_ip: "{{ array_ip }}" + validate_certs: "{{ validate_certs }}" + user: "{{ user }}" + password: "{{ password }}" + ldap_domain_id: "{{ result.ldap_domain_details.id }}" + ldap_domain_user_settings: + user_search_path: "cn=admin" + user_object_class: "posixAccount" + state: "present" + + - name: Delete LDAP domain configuration with check mode + dellemc.powerstore.ldap_domain: + array_ip: "{{ array_ip }}" + validate_certs: "{{ validate_certs }}" + user: "{{ user }}" + password: "{{ password }}" + ldap_domain_id: "{{ result.ldap_domain_details.id }}" + state: "absent" + check_mode: true + + - name: Delete LDAP domain configuration + dellemc.powerstore.ldap_domain: + array_ip: "{{ array_ip }}" + validate_certs: "{{ validate_certs }}" + user: "{{ user }}" + password: "{{ password }}" + ldap_domain_id: "{{ result.ldap_domain_details.id }}" + state: "absent" + + - name: Delete LDAP domain configuration idempotency + dellemc.powerstore.ldap_domain: + array_ip: "{{ array_ip }}" + validate_certs: "{{ validate_certs }}" + user: "{{ user }}" + password: "{{ password }}" + ldap_domain_id: "{{ result.ldap_domain_details.id }}" + state: "absent" + + - name: Create LDAP domain with AD server type + dellemc.powerstore.ldap_domain: + array_ip: "{{ array_ip }}" + validate_certs: "{{ validate_certs }}" + user: "{{ user }}" + password: "{{ password }}" + ldap_domain_name: "example.com" + ldap_servers: + - "XX.XX.XX.XX" + ldap_server_state: "present-in-domain" + ldap_server_type: "AD" + bind_user: "cn=user,dc=example,dc=com" + bind_password: "Password" + is_global_catalog: true + ldap_server_port: 3268 + protocol: "LDAP" + ldap_domain_user_settings: + user_search_path: "" + ldap_domain_group_settings: + group_search_path: "" + state: "present" + + - name: Create LDAP domain with AD server type - idempotency + dellemc.powerstore.ldap_domain: + array_ip: "{{ array_ip }}" + validate_certs: "{{ validate_certs }}" + user: "{{ user }}" + password: "{{ password }}" + ldap_domain_name: "example.com" + ldap_servers: + - "XX.XX.XX.XX" + ldap_server_state: "present-in-domain" + ldap_server_type: "AD" + bind_user: "cn=user,dc=example,dc=com" + bind_password: "Password" + is_global_catalog: true + ldap_server_port: 3268 + protocol: "LDAP" + ldap_domain_user_settings: + user_search_path: "" + state: "present" + + - name: Get LDAP domain details + dellemc.powerstore.ldap_domain: + array_ip: "{{ array_ip }}" + validate_certs: "{{ validate_certs }}" + user: "{{ user }}" + password: "{{ password }}" + ldap_domain_name: "example.com" + state: "present" + + - name: Modify LDAP domain details + dellemc.powerstore.ldap_domain: + array_ip: "{{ array_ip }}" + validate_certs: "{{ validate_certs }}" + user: "{{ user }}" + password: "{{ password }}" + ldap_domain_name: "example.com" + is_global_catalog: false + ldap_server_port: 389 + ldap_domain_user_settings: + user_search_path: "cn=Users,dc=example,dc=com" + ldap_domain_group_settings: + group_search_path: "cn=Users,dc=example,dc=com" + state: "present" + + - name: Delete LDAP domain + dellemc.powerstore.ldap_domain: + array_ip: "{{ array_ip }}" + validate_certs: "{{ validate_certs }}" + user: "{{ user }}" + password: "{{ password }}" + ldap_domain_name: "example.com" + state: "absent" + + - name: Delete LDAP domain idempotency + dellemc.powerstore.ldap_domain: + array_ip: "{{ array_ip }}" + validate_certs: "{{ validate_certs }}" + user: "{{ user }}" + password: "{{ password }}" + ldap_domain_name: "example.com" + state: "absent" diff --git a/playbooks/modules/local_user.yml b/playbooks/modules/local_user.yml new file mode 100644 index 0000000..6b41166 --- /dev/null +++ b/playbooks/modules/local_user.yml @@ -0,0 +1,98 @@ +--- +- name: Local User Operations + hosts: localhost + connection: local + vars: + array_ip: "10.**.**.**" + validate_certs: false + user: "user" + password: "Password" + + tasks: + - name: Create local user + register: result + dellemc.powerstore.local_user: + array_ip: "{{ array_ip }}" + validate_certs: "{{ validate_certs }}" + user: "{{ user }}" + password: "{{ password }}" + user_name: "sample_user" + user_password: "samplepassword" + role_name: "Operator" + is_locked: false + state: "present" + + - name: Create local user Idempotency + register: result + dellemc.powerstore.local_user: + array_ip: "{{ array_ip }}" + validate_certs: "{{ validate_certs }}" + user: "{{ user }}" + password: "{{ password }}" + user_name: "sample_user" + user_password: "samplepassword" + role_name: "Operator" + is_locked: false + state: "present" + + - name: Get local user details using ID + dellemc.powerstore.local_user: + array_ip: "{{ array_ip }}" + validate_certs: "{{ validate_certs }}" + user: "{{ user }}" + password: "{{ password }}" + user_id: "{{ result.local_user_details.id }}" + state: "present" + + - name: Get local user details using name + dellemc.powerstore.local_user: + array_ip: "{{ array_ip }}" + validate_certs: "{{ validate_certs }}" + user: "{{ user }}" + password: "{{ password }}" + user_name: "{{ result.local_user_details.name }}" + state: "present" + + - name: Modify attributes of local user + dellemc.powerstore.local_user: + array_ip: "{{ array_ip }}" + validate_certs: "{{ validate_certs }}" + user: "{{ user }}" + password: "{{ password }}" + user_name: "{{ result.local_user_details.name }}" + user_password: "samplepassword" + new_password: "samplenewpassword" + role_id: 4 + is_locked: true + state: "present" + + - name: Modify local user attributes Idempotency + dellemc.powerstore.local_user: + array_ip: "{{ array_ip }}" + validate_certs: "{{ validate_certs }}" + user: "{{ user }}" + password: "{{ password }}" + user_name: "{{ result.local_user_details.name }}" + user_password: "samplepassword" + new_password: "samplenewpassword" + role_id: 4 + is_locked: true + state: "present" + + - name: Delete local user + dellemc.powerstore.local_user: + array_ip: "{{ array_ip }}" + validate_certs: "{{ validate_certs }}" + user: "{{ user }}" + password: "{{ password }}" + user_name: "sample_user" + state: "absent" + + - name: Delete local user Idempotency + dellemc.powerstore.local_user: + array_ip: "{{ array_ip }}" + validate_certs: "{{ validate_certs }}" + user: "{{ user }}" + password: "{{ password }}" + user_name: "sample_user" + state: "absent" diff --git a/playbooks/modules/nasserver.yml b/playbooks/modules/nasserver.yml new file mode 100644 index 0000000..4b725ae --- /dev/null +++ b/playbooks/modules/nasserver.yml @@ -0,0 +1,133 @@ +--- +- name: Nas Server operations on Powerstore Storage System + hosts: localhost + connection: local + vars: + array_ip: "10.**.**.**" + validate_certs: false + user: "user" + password: "Password" + nas_server_name: "ansible_nas_server" + nas_server_new_name: "ansible_new_nas_server" + description: "Modifying through ansible" + cur_node_n1: "XX.XX.XX.XX" + prefered_node: "N2" + + tasks: + - name: Get details of NAS Server by name + register: result_nas + dellemc.powerstore.nasserver: + array_ip: "{{ array_ip }}" + validate_certs: "{{ validate_certs }}" + user: "{{ user }}" + password: "{{ password }}" + nas_server_name: "{{ nas_server_name }}" + state: "present" + + - name: Set nas_server_id + ansible.builtin.set_fact: + nas_id: "{{ result_nas.nasserver_details.id }}" + + - name: Rename NAS Server + dellemc.powerstore.nasserver: + array_ip: "{{ array_ip }}" + validate_certs: "{{ validate_certs }}" + user: "{{ user }}" + password: "{{ password }}" + nas_server_name: "{{ nas_server_name }}" + nas_server_new_name: "{{ nas_server_new_name }}" + state: "present" + + - name: Rename NAS Server - Idempotency + dellemc.powerstore.nasserver: + array_ip: "{{ array_ip }}" + validate_certs: "{{ validate_certs }}" + user: "{{ user }}" + password: "{{ password }}" + nas_server_name: "{{ nas_server_new_name }}" + nas_server_new_name: "{{ nas_server_new_name }}" + state: "present" + + - name: Modify NAS Server attributes by ID + dellemc.powerstore.nasserver: + array_ip: "{{ array_ip }}" + validate_certs: "{{ validate_certs }}" + user: "{{ user }}" + password: "{{ password }}" + nas_server_id: "{{ nas_id }}" + current_unix_directory_service: "LOCAL_FILES" + current_node: "{{ cur_node_n1 }}" + preferred_node: "{{ prefered_node }}" + state: "present" + + - name: Modify NAS Server attributes by ID - Idempotency + dellemc.powerstore.nasserver: + array_ip: "{{ array_ip }}" + validate_certs: "{{ validate_certs }}" + user: "{{ user }}" + password: "{{ password }}" + nas_server_id: "{{ nas_id }}" + current_unix_directory_service: "LOCAL_FILES" + current_node: "{{ cur_node_n1 }}" + preferred_node: "{{ prefered_node }}" + state: "present" + + - name: Rename NAS Server + dellemc.powerstore.nasserver: + array_ip: "{{ array_ip }}" + validate_certs: "{{ validate_certs }}" + user: "{{ user }}" + password: "{{ password }}" + nas_server_name: "{{ nas_server_new_name }}" + nas_server_new_name: "{{ nas_server_name }}" + state: "present" + + + - name: Get Deatails NAS Server by ID + dellemc.powerstore.nasserver: + array_ip: "{{ array_ip }}" + validate_certs: "{{ validate_certs }}" + user: "{{ user }}" + password: "{{ password }}" + nas_server_id: "{{ nas_id }}" + state: "present" + + - name: Associate protection policy to a NAS Server + dellemc.powerstore.nasserver: + array_ip: "{{ array_ip }}" + validate_certs: "{{ validate_certs }}" + user: "{{ user }}" + password: "{{ password }}" + nas_server_name: "{{ nas_server_name }}" + protection_policy: "sra-nas-pp" + state: "present" + + - name: Associate protection policy to a NAS Server - Idempotency + dellemc.powerstore.nasserver: + array_ip: "{{ array_ip }}" + validate_certs: "{{ validate_certs }}" + user: "{{ user }}" + password: "{{ password }}" + nas_server_name: "{{ nas_server_name }}" + protection_policy: "sra-nas-pp" + state: "present" + + - name: Disassociate protection policy from a NAS Server + dellemc.powerstore.nasserver: + array_ip: "{{ array_ip }}" + validate_certs: "{{ validate_certs }}" + user: "{{ user }}" + password: "{{ password }}" + nas_server_name: "{{ nas_server_name }}" + protection_policy: "" + state: "present" + + - name: Disassociate protection policy from a NAS Server - Idempotency + dellemc.powerstore.nasserver: + array_ip: "{{ array_ip }}" + validate_certs: "{{ validate_certs }}" + user: "{{ user }}" + password: "{{ password }}" + nas_server_name: "{{ nas_server_name }}" + protection_policy: "" + state: "present" diff --git a/playbooks/modules/network.yml b/playbooks/modules/network.yml new file mode 100644 index 0000000..ac1c423 --- /dev/null +++ b/playbooks/modules/network.yml @@ -0,0 +1,122 @@ +--- +- name: Network Operations + hosts: localhost + connection: local + vars: + array_ip: "10.**.**.**" + validate_certs: false + user: "user" + password: "Password" + + tasks: + - name: Get Management Network Details using network ID + dellemc.powerstore.network: + array_ip: "{{ array_ip }}" + validate_certs: "{{ validate_certs }}" + user: "{{ user }}" + password: "{{ password }}" + network_id: "NW1" + state: "present" + + - name: Get Storage Network Details using network name + dellemc.powerstore.network: + array_ip: "{{ array_ip }}" + validate_certs: "{{ validate_certs }}" + user: "{{ user }}" + password: "{{ password }}" + network_name: "Storage Network" + state: "present" + + - name: Add ports to storage network + dellemc.powerstore.network: + array_ip: "{{ array_ip }}" + validate_certs: "{{ validate_certs }}" + user: "{{ user }}" + password: "{{ password }}" + network_id: "NW6" + ports: + - "IP_PORT" + port_state: "present-in-network" + state: "present" + + - name: Add ports to storage network - Idempotency + dellemc.powerstore.network: + array_ip: "{{ array_ip }}" + validate_certs: "{{ validate_certs }}" + user: "{{ user }}" + password: "{{ password }}" + network_id: "NW6" + ports: + - "IP_PORT" + port_state: "present-in-network" + state: "present" + + - name: Remove ports from storage network + dellemc.powerstore.network: + array_ip: "{{ array_ip }}" + validate_certs: "{{ validate_certs }}" + user: "{{ user }}" + password: "{{ password }}" + network_id: "NW6" + ports: + - "IP_PORT" + port_state: "absent-in-network" + state: "present" + + - name: Remove ports from storage network - Idempotency + dellemc.powerstore.network: + array_ip: "{{ array_ip }}" + validate_certs: "{{ validate_certs }}" + user: "{{ user }}" + password: "{{ password }}" + network_id: "NW6" + ports: + - "IP_PORT" + port_state: "absent-in-network" + state: "present" + + - name: Modify Storage Network attributes + dellemc.powerstore.network: + array_ip: "{{ array_ip }}" + validate_certs: "{{ validate_certs }}" + user: "{{ user }}" + password: "{{ password }}" + network_id: "NW6" + mtu: 1400 + new_name: "storage network renamed" + storage_discovery_address: "XX.XX.XX.XX" + wait_for_completion: true + state: "present" + + - name: Modify Storage Network attributes - Idempotency + dellemc.powerstore.network: + array_ip: "{{ array_ip }}" + validate_certs: "{{ validate_certs }}" + user: "{{ user }}" + password: "{{ password }}" + network_id: "NW6" + mtu: 1400 + new_name: "storage network renamed" + storage_discovery_address: "XX.XX.XX.XX" + wait_for_completion: true + state: "present" + + - name: Modify Management Network attributes and re-register VASA provider + dellemc.powerstore.network: + array_ip: "{{ array_ip }}" + validate_certs: "{{ validate_certs }}" + user: "{{ user }}" + password: "{{ password }}" + network_id: "NW1" + new_cluster_mgmt_address: "XX.XX.XX.XY" + addresses: + - "new_address": "XX.XX.XX.YX" + "current_address": "XX.XX.XX.XX" + - "new_address": "XX.XX.XX.YY" + "current_address": "XX.XX.XX.XX" + - "new_address": "XX.XX.XY.XX" + "current_address": "XX.XX.XX.XX" + vasa_provider_credentials: + username: "vasa_user" + password: "vasa_password" + state: "present" diff --git a/playbooks/modules/nfs.yml b/playbooks/modules/nfs.yml new file mode 100644 index 0000000..59f2096 --- /dev/null +++ b/playbooks/modules/nfs.yml @@ -0,0 +1,182 @@ +--- +- name: Testing NFS export operations on Powerstore + hosts: localhost + connection: local + gather_facts: false + vars: + array_ip: "10.**.**.**" + validate_certs: false + user: "user" + password: "Password" + export_name1: "sample_fs_export" + export_name2: "sample_snap_export" + filesystem: "ansible_export_fs" + snapshot: "ansible_export_snap" + path1: "/ansible_export_fs" + path2: "/ansible_export_snap" + nas_server: "ansible_nas_server_2" + host1: "abc.example.com" + host2: "10.XX.XX.XX" + host3: "10.XX.XX.XY/2x" + host4: "10.XX.XX.YX/255.xxx.xxx.x" + host5: "fdfe:XXX:XXX:XXX:XXX" + + tasks: + - name: Create NFS export (filesystem) + dellemc.powerstore.nfs: + array_ip: "{{ array_ip }}" + validate_certs: "{{ validate_certs }}" + user: "{{ user }}" + password: "{{ password }}" + nfs_export_name: "{{ export_name1 }}" + filesystem: "{{ filesystem }}" + nas_server: "{{ nas_server }}" + path: "{{ path1 }}" + description: "sample description" + default_access: "NO_ACCESS" + no_access_hosts: + - "{{ host5 }}" + read_only_hosts: + - "{{ host1 }}" + read_only_root_hosts: + - "{{ host2 }}" + read_write_hosts: + - "{{ host3 }}" + read_write_root_hosts: + - "{{ host4 }}" + min_security: "SYS" + anonymous_uid: 0 + anonymous_gid: 0 + is_no_suid: true + host_state: "present-in-export" + state: "present" + + - name: Create NFS export (filesystem) - Idempotency + dellemc.powerstore.nfs: + array_ip: "{{ array_ip }}" + validate_certs: "{{ validate_certs }}" + user: "{{ user }}" + password: "{{ password }}" + nfs_export_name: "{{ export_name1 }}" + filesystem: "{{ filesystem }}" + nas_server: "{{ nas_server }}" + path: "{{ path1 }}" + description: "sample description" + default_access: "NO_ACCESS" + no_access_hosts: + - "{{ host5 }}" + read_only_hosts: + - "{{ host1 }}" + read_only_root_hosts: + - "{{ host2 }}" + read_write_hosts: + - "{{ host3 }}" + read_write_root_hosts: + - "{{ host4 }}" + min_security: "SYS" + anonymous_uid: 0 + anonymous_gid: 0 + is_no_suid: true + host_state: "present-in-export" + state: "present" + + - name: Create NFS export for filesystem snapshot with mandatory parameters + register: result + dellemc.powerstore.nfs: + array_ip: "{{ array_ip }}" + validate_certs: "{{ validate_certs }}" + user: "{{ user }}" + password: "{{ password }}" + nfs_export_name: "{{ export_name2 }}" + snapshot: "{{ snapshot }}" + nas_server: "{{ nas_server }}" + path: "{{ path2 }}" + state: "present" + + - name: Get NFS export details using ID + dellemc.powerstore.nfs: + array_ip: "{{ array_ip }}" + validate_certs: "{{ validate_certs }}" + user: "{{ user }}" + password: "{{ password }}" + nfs_export_id: "{{ export_id }}" + state: "present" + + - name: Add Read-Only and Read-Write hosts to NFS export + dellemc.powerstore.nfs: + array_ip: "{{ array_ip }}" + validate_certs: "{{ validate_certs }}" + user: "{{ user }}" + password: "{{ password }}" + nfs_export_id: "{{ export_id }}" + read_only_hosts: + - "{{ host1 }}" + read_write_hosts: + - "{{ host3 }}" + host_state: "present-in-export" + state: "present" + + - name: Remove Read-Only and Read-Write hosts from NFS export + dellemc.powerstore.nfs: + array_ip: "{{ array_ip }}" + validate_certs: "{{ validate_certs }}" + user: "{{ user }}" + password: "{{ password }}" + nfs_export_id: "{{ export_id }}" + read_only_hosts: + - "{{ host1 }}" + read_write_hosts: + - "{{ host3 }}" + host_state: "absent-in-export" + state: "present" + + - name: Modify the attributes of NFS export + dellemc.powerstore.nfs: + array_ip: "{{ array_ip }}" + validate_certs: "{{ validate_certs }}" + user: "{{ user }}" + password: "{{ password }}" + nfs_export_id: "{{ export_id }}" + description: "modify description" + default_access: "ROOT" + state: "present" + + - name: Modify the attributes of NFS export (Idempotency) + dellemc.powerstore.nfs: + array_ip: "{{ array_ip }}" + validate_certs: "{{ validate_certs }}" + user: "{{ user }}" + password: "{{ password }}" + nfs_export_id: "{{ export_id }}" + description: "modify description" + default_access: "ROOT" + state: "present" + + - name: Delete NFS export using ID + dellemc.powerstore.nfs: + array_ip: "{{ array_ip }}" + validate_certs: "{{ validate_certs }}" + user: "{{ user }}" + password: "{{ password }}" + nfs_export_id: "{{ export_id }}" + state: "absent" + + - name: Delete NFS export using name + dellemc.powerstore.nfs: + array_ip: "{{ array_ip }}" + validate_certs: "{{ validate_certs }}" + user: "{{ user }}" + password: "{{ password }}" + nfs_export_name: "{{ export_name1 }}" + nas_server: "{{ nas_server }}" + state: "absent" + + - name: Delete NFS export using name (Idempotency) + dellemc.powerstore.nfs: + array_ip: "{{ array_ip }}" + validate_certs: "{{ validate_certs }}" + user: "{{ user }}" + password: "{{ password }}" + nfs_export_name: "{{ export_name1 }}" + nas_server: "{{ nas_server }}" + state: "absent" diff --git a/playbooks/modules/ntp.yml b/playbooks/modules/ntp.yml new file mode 100644 index 0000000..ffe08c7 --- /dev/null +++ b/playbooks/modules/ntp.yml @@ -0,0 +1,67 @@ +--- +- name: NTP Module Operations on Powerstore Array + hosts: localhost + connection: local + vars: + array_ip: "10.**.**.**" + validate_certs: false + user: "user" + password: "Password" + + tasks: + - name: Get details of NTP instance + dellemc.powerstore.ntp: + array_ip: "{{ array_ip }}" + user: "{{ user }}" + password: "{{ password }}" + validate_certs: "{{ validate_certs }}" + ntp_id: "NTP1" + state: "present" + + - name: Add address to NTP addresses list + dellemc.powerstore.ntp: + array_ip: "{{ array_ip }}" + user: "{{ user }}" + password: "{{ password }}" + validate_certs: "{{ validate_certs }}" + ntp_id: "NTP1" + ntp_addresses: + - "10.XX.XX.XX" + ntp_address_state: "present-in-ntp" + state: "present" + + - name: Add address to NTP addresses list - Idempotency + dellemc.powerstore.ntp: + array_ip: "{{ array_ip }}" + user: "{{ user }}" + password: "{{ password }}" + validate_certs: "{{ validate_certs }}" + ntp_id: "NTP1" + ntp_addresses: + - "10.XX.XX.XX" + ntp_address_state: "present-in-ntp" + state: "present" + + - name: Remove address from NTP addresses list + dellemc.powerstore.ntp: + array_ip: "{{ array_ip }}" + user: "{{ user }}" + password: "{{ password }}" + validate_certs: "{{ validate_certs }}" + ntp_id: "NTP1" + ntp_addresses: + - "10.XX.XX.XX" + ntp_address_state: "absent-in-ntp" + state: "present" + + - name: Remove address from NTP addresses list - Idempotency + dellemc.powerstore.ntp: + array_ip: "{{ array_ip }}" + user: "{{ user }}" + password: "{{ password }}" + validate_certs: "{{ validate_certs }}" + ntp_id: "NTP1" + ntp_addresses: + - "10.XX.XX.XX" + ntp_address_state: "absent-in-ntp" + state: "present" diff --git a/playbooks/modules/protectionpolicy.yml b/playbooks/modules/protectionpolicy.yml new file mode 100644 index 0000000..3f6dd16 --- /dev/null +++ b/playbooks/modules/protectionpolicy.yml @@ -0,0 +1,165 @@ +--- +- name: Protection policy operations on Powerstore Storage System + hosts: localhost + connection: local + vars: + array_ip: "10.**.**.**" + validate_certs: false + user: "user" + password: "Password" + protection_policy_name: "sample_protection_policy" + protectionpolicy_id: "" + new_name: "new_sample_protection_policy" + description: "protection policy through ansible" + new_description: "Modified DevCon Ansible protectionpolicy Test" + state: "present" + snapshotrules: "" + snapshot_rule_1: "ansible_snap_rule_1" + snapshot_rule_2: "ansible_snap_rule_2" + replication_rule: "ansible_rep_rule_1" + new_replication_rule: "ansible_rep_rule_2" + snapshotrule_state: "present-in-policy" + + tasks: + - name: Create new protection policy + dellemc.powerstore.protectionpolicy: + array_ip: "{{ array_ip }}" + validate_certs: "{{ validate_certs }}" + user: "{{ user }}" + password: "{{ password }}" + name: "{{ protection_policy_name }}" + description: "{{ description }}" + snapshotrules: + - "{{ snapshot_rule_1 }}" + snapshotrule_state: "present-in-policy" + replicationrule: "{{ replication_rule }}" + state: "present" + register: protectionpolicy + + - name: Create new protection policy Idempotency test + dellemc.powerstore.protectionpolicy: + array_ip: "{{ array_ip }}" + validate_certs: "{{ validate_certs }}" + user: "{{ user }}" + password: "{{ password }}" + name: "{{ protection_policy_name }}" + description: "{{ description }}" + snapshotrules: + - "{{ snapshot_rule_1 }}" + snapshotrule_state: "present-in-policy" + replicationrule: "{{ replication_rule }}" + state: "present" + register: protectionpolicy + + - name: Get details of existing snapshot rule by name + dellemc.powerstore.snapshotrule: + array_ip: "{{ array_ip }}" + validate_certs: "{{ validate_certs }}" + user: "{{ user }}" + password: "{{ password }}" + name: "{{ snapshot_rule_2 }}" + state: "present" + register: snaprule_result + + - name: Modify protection policy . modify name,description, add snapshotrule and replace replication rule + dellemc.powerstore.protectionpolicy: + array_ip: "{{ array_ip }}" + validate_certs: "{{ validate_certs }}" + user: "{{ user }}" + password: "{{ password }}" + protectionpolicy_id: "{{ protectionpolicy_id }}" + new_name: "{{ new_name }}" + description: "{{ new_description }}" + snapshotrules: + - "{{ snap_rule_id_2 }}" + snapshotrule_state: "present-in-policy" + replicationrule: "{{ new_replication_rule }}" + state: "present" + register: protectionpolicy + + - name: Modify protection policy . modify name,description, add snapshotrule and replace replication rule Idempotency + dellemc.powerstore.protectionpolicy: + array_ip: "{{ array_ip }}" + validate_certs: "{{ validate_certs }}" + user: "{{ user }}" + password: "{{ password }}" + protectionpolicy_id: "{{ protectionpolicy_id }}" + new_name: "{{ new_name }}" + description: "{{ new_description }}" + snapshotrules: + - "{{ snap_rule_id_2 }}" + snapshotrule_state: "present-in-policy" + replicationrule: "{{ new_replication_rule }}" + state: "present" + register: protectionpolicy + + - name: Modify protection policy modify name, remove snapshotrule and remove replication rule + dellemc.powerstore.protectionpolicy: + array_ip: "{{ array_ip }}" + validate_certs: "{{ validate_certs }}" + user: "{{ user }}" + password: "{{ password }}" + protectionpolicy_id: "{{ protectionpolicy_id }}" + new_name: "{{ protection_policy_name }}" + snapshotrules: + - "{{ snap_rule_id_2 }}" + snapshotrule_state: "absent-in-policy" + replicationrule: "" + state: "present" + register: protectionpolicy + + - name: Modify protection policy modify name, remove snapshotrule and remove replication rule Idempotency + dellemc.powerstore.protectionpolicy: + array_ip: "{{ array_ip }}" + validate_certs: "{{ validate_certs }}" + user: "{{ user }}" + password: "{{ password }}" + protectionpolicy_id: "{{ protectionpolicy_id }}" + new_name: "{{ protection_policy_name }}" + snapshotrules: + - "{{ snap_rule_id_2 }}" + snapshotrule_state: "absent-in-policy" + replicationrule: "" + state: "present" + register: protectionpolicy + + - name: Get details of protection policy by name + dellemc.powerstore.protectionpolicy: + array_ip: "{{ array_ip }}" + validate_certs: "{{ validate_certs }}" + user: "{{ user }}" + password: "{{ password }}" + name: "{{ protection_policy_name }}" + state: "present" + register: protectionpolicy + + - name: Get details of protection policy by ID + dellemc.powerstore.protectionpolicy: + array_ip: "{{ array_ip }}" + validate_certs: "{{ validate_certs }}" + user: "{{ user }}" + password: "{{ password }}" + protectionpolicy_id: "{{ protectionpolicy_id }}" + state: "present" + register: protectionpolicy + + + - name: Delete protection policy + dellemc.powerstore.protectionpolicy: + array_ip: "{{ array_ip }}" + validate_certs: "{{ validate_certs }}" + user: "{{ user }}" + password: "{{ password }}" + name: "{{ protection_policy_name }}" + state: "absent" + register: protectionpolicy + + - name: Delete protection policy Idempotency + dellemc.powerstore.protectionpolicy: + array_ip: "{{ array_ip }}" + validate_certs: "{{ validate_certs }}" + user: "{{ user }}" + password: "{{ password }}" + name: "{{ protection_policy_name }}" + state: "absent" + register: protectionpolicy diff --git a/playbooks/modules/quota.yml b/playbooks/modules/quota.yml new file mode 100644 index 0000000..d45e201 --- /dev/null +++ b/playbooks/modules/quota.yml @@ -0,0 +1,306 @@ +--- +- name: Quota Module Operations on Powerstore Array + hosts: localhost + connection: local + vars: + array_ip: '10.xx.xx.xx' + validate_certs: false + user: 'user' + password: 'Password' + path: "/sample_path" + filesystem: "ansible_quota_fs" + nas_server: "ansible_nas_server_2" + description: "Added description during Creation of Quota." + mod_description: "Updated the description of the quota." + cap_unit: "GB" + + tasks: + - name: Create a Tree Quota for a filesystem + dellemc.powerstore.quota: + array_ip: "{{ array_ip }}" + validate_certs: "{{ validate_certs }}" + user: "{{ user }}" + password: "{{ password }}" + quota_type: "tree" + description: "{{ description }}" + path: "{{ path }}" + filesystem: "ansible_quota_fs" + nas_server: "ansible_nas_server_2" + dellemc.powerstore.quota: + hard_limit: 2 + soft_limit: 1 + cap_unit: "{{ cap_unit }}" + state: 'present' + + - name: Create a Tree Quota for a filesystem Idempotency + register: result + dellemc.powerstore.quota: + array_ip: "{{ array_ip }}" + validate_certs: "{{ validate_certs }}" + user: "{{ user }}" + password: "{{ password }}" + quota_type: "tree" + description: "{{ description }}" + path: "{{ path }}" + filesystem: "ansible_quota_fs" + nas_server: "ansible_nas_server_2" + dellemc.powerstore.quota: + hard_limit: 2 + soft_limit: 1 + cap_unit: "{{ cap_unit }}" + state: 'present' + + - name: Fetch Tree Quota ID, Filesystem ID and NAS Server ID + ansible.builtin.set_fact: + tree_quota_id: "{{ result['quota_details']['id'] }}" + fs_id: "{{ result['quota_details']['file_system']['id'] }}" + nas_id: "{{ result['quota_details']['file_system']['nas_server']['id'] }}" + + - name: Create a User Quota on a Tree Quota for a filesystem + dellemc.powerstore.quota: + array_ip: "{{ array_ip }}" + validate_certs: "{{ validate_certs }}" + user: "{{ user }}" + password: "{{ password }}" + quota_type: "user" + uid: 100 + path: "{{ path }}" + filesystem: "{{ fs_id }}" + dellemc.powerstore.quota: + hard_limit: 4 + soft_limit: 3 + cap_unit: "{{ cap_unit }}" + state: 'present' + + - name: Create a User Quota on a Tree Quota for a filesystem Idempotency + register: result + dellemc.powerstore.quota: + array_ip: "{{ array_ip }}" + validate_certs: "{{ validate_certs }}" + user: "{{ user }}" + password: "{{ password }}" + quota_type: "user" + uid: 100 + path: "{{ path }}" + filesystem: "{{ fs_id }}" + dellemc.powerstore.quota: + hard_limit: 4 + soft_limit: 3 + cap_unit: "{{ cap_unit }}" + state: 'present' + + - name: Fetch User Quota ID, Filesystem ID and NAS Server ID + ansible.builtin.set_fact: + user_quota_id_1: "{{ result['quota_details']['id'] }}" + + - name: Create a User Quota on filesystem + dellemc.powerstore.quota: + array_ip: "{{ array_ip }}" + validate_certs: "{{ validate_certs }}" + user: "{{ user }}" + password: "{{ password }}" + quota_type: "user" + uid: 100 + filesystem: "ansible_quota_fs" + nas_server: "{{ nas_id }}" + dellemc.powerstore.quota: + hard_limit: 6 + soft_limit: 5 + cap_unit: "{{ cap_unit }}" + state: 'present' + + - name: Create a User Quota on filesystem Idempotency + register: result + dellemc.powerstore.quota: + array_ip: "{{ array_ip }}" + validate_certs: "{{ validate_certs }}" + user: "{{ user }}" + password: "{{ password }}" + quota_type: "user" + uid: 100 + filesystem: "ansible_quota_fs" + nas_server: "{{ nas_id }}" + dellemc.powerstore.quota: + hard_limit: 6 + soft_limit: 5 + cap_unit: "{{ cap_unit }}" + state: 'present' + + - name: Fetch User Quota ID, Filesystem ID and NAS Server ID + ansible.builtin.set_fact: + user_quota_id_2: "{{ result['quota_details']['id'] }}" + + - name: Get details of a User Quota on a Tree Quota for a filesystem + dellemc.powerstore.quota: + array_ip: "{{ array_ip }}" + validate_certs: "{{ validate_certs }}" + user: "{{ user }}" + password: "{{ password }}" + quota_id: "{{ user_quota_id_1 }}" + state: 'present' + + - name: Get details of a User Quota on filesystem + dellemc.powerstore.quota: + array_ip: "{{ array_ip }}" + validate_certs: "{{ validate_certs }}" + user: "{{ user }}" + password: "{{ password }}" + quota_id: "{{ user_quota_id_2 }}" + state: 'present' + + - name: Get details of a Tree Quota for a filesystem + dellemc.powerstore.quota: + array_ip: "{{ array_ip }}" + validate_certs: "{{ validate_certs }}" + user: "{{ user }}" + password: "{{ password }}" + quota_id: "{{ tree_quota_id }}" + state: 'present' + + - name: Update attributes of Tree Quota for a filesystem + dellemc.powerstore.quota: + array_ip: "{{ array_ip }}" + validate_certs: "{{ validate_certs }}" + user: "{{ user }}" + password: "{{ password }}" + quota_type: "tree" + description: "{{ mod_description }}" + path: "{{ path }}" + filesystem: "ansible_quota_fs" + nas_server: "ansible_nas_server_2" + dellemc.powerstore.quota: + hard_limit: 4 + soft_limit: 2 + cap_unit: "{{ cap_unit }}" + state: 'present' + + - name: Update attributes of Tree Quota for a filesystem Idempotency + dellemc.powerstore.quota: + array_ip: "{{ array_ip }}" + validate_certs: "{{ validate_certs }}" + user: "{{ user }}" + password: "{{ password }}" + quota_type: "tree" + description: "{{ mod_description }}" + path: "{{ path }}" + filesystem: "ansible_quota_fs" + nas_server: "ansible_nas_server_2" + dellemc.powerstore.quota: + hard_limit: 4 + soft_limit: 2 + cap_unit: "{{ cap_unit }}" + state: 'present' + + - name: Update limits for a User Quota on Tree Quota for a filesystem + dellemc.powerstore.quota: + array_ip: "{{ array_ip }}" + validate_certs: "{{ validate_certs }}" + user: "{{ user }}" + password: "{{ password }}" + quota_id: "{{ user_quota_id_2 }}" + dellemc.powerstore.quota: + hard_limit: 4 + soft_limit: 2 + cap_unit: "{{ cap_unit }}" + state: 'present' + + - name: Update limits for a User Quota on Tree Quota for a filesystem Idempotency + dellemc.powerstore.quota: + array_ip: "{{ array_ip }}" + validate_certs: "{{ validate_certs }}" + user: "{{ user }}" + password: "{{ password }}" + quota_id: "{{ user_quota_id_2 }}" + dellemc.powerstore.quota: + hard_limit: 4 + soft_limit: 2 + cap_unit: "{{ cap_unit }}" + state: 'present' + + - name: Update limits for a User Quota for a filesystem + dellemc.powerstore.quota: + array_ip: "{{ array_ip }}" + validate_certs: "{{ validate_certs }}" + user: "{{ user }}" + password: "{{ password }}" + quota_id: "{{ user_quota_id_1 }}" + dellemc.powerstore.quota: + hard_limit: 6 + soft_limit: 5 + cap_unit: "{{ cap_unit }}" + state: 'present' + + - name: Update limits for a User Quota for a filesystem Idempotency + dellemc.powerstore.quota: + array_ip: "{{ array_ip }}" + validate_certs: "{{ validate_certs }}" + user: "{{ user }}" + password: "{{ password }}" + quota_id: "{{ user_quota_id_1 }}" + dellemc.powerstore.quota: + hard_limit: 6 + soft_limit: 5 + cap_unit: "{{ cap_unit }}" + state: 'present' + + + - name: Delete a Tree Quota + dellemc.powerstore.quota: + array_ip: "{{ array_ip }}" + validate_certs: "{{ validate_certs }}" + user: "{{ user }}" + password: "{{ password }}" + quota_type: "tree" + path: "{{ path }}" + filesystem: "ansible_quota_fs" + nas_server: "ansible_nas_server_2" + state: 'absent' + + - name: Delete a Tree Quota Idempotency + dellemc.powerstore.quota: + array_ip: "{{ array_ip }}" + validate_certs: "{{ validate_certs }}" + user: "{{ user }}" + password: "{{ password }}" + quota_type: "tree" + path: "{{ path }}" + filesystem: "ansible_quota_fs" + nas_server: "ansible_nas_server_2" + state: 'absent' + + - name: Get details of a User Quota with Windows SID + dellemc.powerstore.quota: + array_ip: "{{ array_ip }}" + validate_certs: "{{ validate_certs }}" + user: "{{ user }}" + password: "{{ password }}" + quota_type: "user" + windows_sid: "S-xxx-xxx-xxx-xxx" + filesystem: "ansible_quota_fs" + nas_server: "ansible_nas_server_2" + state: 'present' + + - name: Get details of a User Quota with Unix Name + dellemc.powerstore.quota: + array_ip: "{{ array_ip }}" + validate_certs: "{{ validate_certs }}" + user: "{{ user }}" + password: "{{ password }}" + quota_type: "user" + unix_name: "ldap_test_user_1" + filesystem: "ansible_quota_fs" + nas_server: "ansible_nas_server_2" + state: 'present' + + - name: Get details of a User Quota with Windows Name + dellemc.powerstore.quota: + array_ip: "{{ array_ip }}" + validate_certs: "{{ validate_certs }}" + user: "{{ user }}" + password: "{{ password }}" + quota_type: "user" + # Windows Name can also be mentioned as "DEVCONAD\\ad_user_3" + windows_name: 'DEVCONAD\ad_user_3' + filesystem: "ansible_quota_fs" + nas_server: "ansible_nas_server_2" + state: 'present' diff --git a/playbooks/modules/remote_support.yml b/playbooks/modules/remote_support.yml new file mode 100644 index 0000000..7102b51 --- /dev/null +++ b/playbooks/modules/remote_support.yml @@ -0,0 +1,94 @@ +--- +- name: Remote Support Module Operations on Powerstore Array + hosts: localhost + connection: local + vars: + array_ip: '10.xx.xx.xx' + validate_certs: false + user: 'user' + password: 'Password' + + tasks: + - name: Get details of remote support configuration + dellemc.powerstore.remote_support: + array_ip: "{{ array_ip }}" + user: "{{ user }}" + password: "{{ password }}" + validate_certs: "{{ validate_certs }}" + remote_support_id: 0 + state: "present" + + - name: Modify remote support configuration - SRS_Gateway_Tier3 + dellemc.powerstore.remote_support: + array_ip: "{{ array_ip }}" + user: "{{ user }}" + password: "{{ password }}" + validate_certs: "{{ validate_certs }}" + remote_support_id: 0 + support_type: "SRS_Gateway_Tier3" + remote_support_servers: + - address: "10.XX.XX.XX" + port: 9443 + is_primary: true + - address: "10.XX.XX.YX" + port: 9443 + is_primary: false + server_state: "present-in-server" + is_rsc_enabled: true + is_cloudiq_enabled: false + timeout: 300 + state: "present" + + - name: Remove remote support servers + dellemc.powerstore.remote_support: + array_ip: "{{ array_ip }}" + user: "{{ user }}" + password: "{{ password }}" + validate_certs: "{{ validate_certs }}" + remote_support_id: 0 + support_type: "SRS_Gateway_Tier3" + remote_support_servers: + - address: "10.XX.XX.XX" + port: 9443 + is_primary: true + - address: "10.XX.XX.XX" + server_state: "absent-in-server" + timeout: 300 + state: "present" + + - name: Modify remote support configuration - SRS_Integrated_Tier2 + dellemc.powerstore.remote_support: + array_ip: "{{ array_ip }}" + user: "{{ user }}" + password: "{{ password }}" + validate_certs: "{{ validate_certs }}" + remote_support_id: 0 + support_type: "SRS_Integrated_Tier2" + proxy_address: "10.XX.XX.XY" + proxy_port: 3128 + proxy_username: "user" + proxy_password: "password" + timeout: 300 + state: "present" + + - name: Verify remote support configuration + dellemc.powerstore.remote_support: + array_ip: "{{ array_ip }}" + user: "{{ user }}" + password: "{{ password }}" + validate_certs: "{{ validate_certs }}" + remote_support_id: 0 + support_type: "SRS_Integrated_Tier3" + timeout: 300 + verify_connection: true + state: "present" + + - name: Send a test alert + dellemc.powerstore.remote_support: + array_ip: "{{ array_ip }}" + user: "{{ user }}" + password: "{{ password }}" + validate_certs: "{{ validate_certs }}" + remote_support_id: 0 + send_test_alert: true + state: "present" diff --git a/playbooks/modules/remote_support_contact.yml b/playbooks/modules/remote_support_contact.yml new file mode 100644 index 0000000..d0dedbd --- /dev/null +++ b/playbooks/modules/remote_support_contact.yml @@ -0,0 +1,43 @@ +--- +- name: Email Module Operations on Powerstore Array + hosts: localhost + connection: local + vars: + array_ip: '10.xx.xx.xx' + validate_certs: false + user: 'user' + password: 'Password' + + tasks: + - name: Get details of remote support contact + dellemc.powerstore.remote_support_contact: + array_ip: "{{ array_ip }}" + user: "{{ user }}" + password: "{{ password }}" + validate_certs: "{{ validate_certs }}" + contact_id: 0 + state: "present" + + - name: Modify remote support contact + dellemc.powerstore.remote_support_contact: + array_ip: "{{ array_ip }}" + user: "{{ user }}" + password: "{{ password }}" + validate_certs: "{{ validate_certs }}" + contact_id: 0 + first_name: "abc" + last_name: "xyz" + email: "abc_xy@dell.com" + state: "present" + + - name: Modify remote support contact - Idempotency + dellemc.powerstore.remote_support_contact: + array_ip: "{{ array_ip }}" + user: "{{ user }}" + password: "{{ password }}" + validate_certs: "{{ validate_certs }}" + contact_id: 0 + first_name: "abc" + last_name: "xyz" + email: "abc_xy@dell.com" + state: "present" diff --git a/playbooks/modules/remotesystem.yml b/playbooks/modules/remotesystem.yml new file mode 100644 index 0000000..bfbcee7 --- /dev/null +++ b/playbooks/modules/remotesystem.yml @@ -0,0 +1,90 @@ +--- +- name: Remote system operations on Powerstore storage system + hosts: localhost + connection: local + vars: + array_ip: "10.**.**.**" + validate_certs: false + user: "user" + password: "Password" + remote_name: "RT-D1005" + remote_address: "10.XX.XX.XY" + remote_user_1: "admin" + + tasks: + - name: Create a remote system + dellemc.powerstore.remotesystem: + array_ip: "{{ array_ip }}" + validate_certs: "{{ validate_certs }}" + user: "{{ user }}" + password: "{{ password }}" + remote_address: "10.XX.XX.XX" + remote_user: "{{ remote_user_1 }}" + remote_password: "Password" + remote_port: 443 + port: 443 + description: "created via ansible playbook" + network_latency: "Low" + state: "present" + register: create_remote_system_result + + - name: Create a remote system idemoptency case + dellemc.powerstore.remotesystem: + array_ip: "{{ array_ip }}" + validate_certs: "{{ validate_certs }}" + user: "{{ user }}" + password: "{{ password }}" + remote_address: "10.XX.XX.XX" + remote_user: "{{ remote_user_1 }}" + remote_password: "Password" + remote_port: 443 + port: 443 + description: "created via ansible playbook" + network_latency: "Low" + state: "present" + register: create_remote_system_result + + - name: Get the details of remote system using remote name and address + dellemc.powerstore.remotesystem: + array_ip: "{{ array_ip }}" + validate_certs: "{{ validate_certs }}" + user: "{{ user }}" + password: "{{ password }}" + remote_name: "{{ remote_name }}" + remote_address: "{{ remote_address }}" + state: "present" + register: remote_system_dict + + - name: Get the details of remote system using remote id + dellemc.powerstore.remotesystem: + array_ip: "{{ array_ip }}" + validate_certs: "{{ validate_certs }}" + user: "{{ user }}" + password: "{{ password }}" + remote_id: "{{ remote_id }}" + state: "present" + register: remote_system_dict + + - name: Update remote system attributes + dellemc.powerstore.remotesystem: + array_ip: "{{ array_ip }}" + validate_certs: "{{ validate_certs }}" + user: "{{ user }}" + password: "{{ password }}" + remote_address: "10.XX.XX.XX" + description: "updated via ansible playbook" + state: "present" + network_latency: "High" + wait_for_completion: true + conn_timeout: 300 + register: update_remote_system_result + + - name: Delete remote system using remote id + dellemc.powerstore.remotesystem: + array_ip: "{{ array_ip }}" + validate_certs: "{{ validate_certs }}" + user: "{{ user }}" + password: "{{ password }}" + remote_id: "{{ remote_id }}" + state: "absent" + register: delete_output diff --git a/playbooks/modules/replicationrule.yml b/playbooks/modules/replicationrule.yml new file mode 100644 index 0000000..a7ac05f --- /dev/null +++ b/playbooks/modules/replicationrule.yml @@ -0,0 +1,108 @@ +--- +- name: Replication rule operations on Powerstore storage system + hosts: localhost + connection: local + vars: + array_ip: "10.**.**.**" + validate_certs: false + user: "user" + password: "Password" + name_1: "sample_replication_rule_2" + new_name: "new_sample_replication_rule_2" + rpo: "Five_Minutes" + new_rpo: "One_Hour" + alert_threshold: 24 + new_alert_threshold: 72 + remote_system: "WN-D8978" + new_remote_system: "WN-D0517" + state: "present" + + tasks: + - name: Create new replication rule + dellemc.powerstore.replicationrule: + array_ip: "{{ array_ip }}" + validate_certs: "{{ validate_certs }}" + user: "{{ user }}" + password: "{{ password }}" + replication_rule_name: "{{ name_1 }}" + rpo: "{{ rpo }}" + alert_threshold: "{{ alert_threshold }}" + remote_system: "{{ remote_system }}" + state: "present" + register: reprule_result + - name: Store replication rule details + ansible.builtin.debug: + var: reprule_result + + - name: Create new replication rule Idempotency + dellemc.powerstore.replicationrule: + array_ip: "{{ array_ip }}" + validate_certs: "{{ validate_certs }}" + user: "{{ user }}" + password: "{{ password }}" + replication_rule_name: "{{ name_1 }}" + rpo: "{{ rpo }}" + alert_threshold: "{{ alert_threshold }}" + remote_system: "{{ remote_system }}" + state: "present" + register: reprule_result + - name: Store replication rule details + ansible.builtin.debug: + var: reprule_result + + - name: Modify existing replication rule + dellemc.powerstore.replicationrule: + array_ip: "{{ array_ip }}" + validate_certs: "{{ validate_certs }}" + user: "{{ user }}" + password: "{{ password }}" + replication_rule_name: "{{ name_1 }}" + new_name: "{{ new_name }}" + rpo: "{{ new_rpo }}" + alert_threshold: "{{ new_alert_threshold }}" + remote_system: "{{ new_remote_system }}" + state: "present" + register: reprule_result + - name: Store replication rule details + ansible.builtin.debug: + var: reprule_result + + - name: Modify existing replication rule Idempotency + dellemc.powerstore.replicationrule: + array_ip: "{{ array_ip }}" + validate_certs: "{{ validate_certs }}" + user: "{{ user }}" + password: "{{ password }}" + replication_rule_name: "{{ new_name }}" + new_name: "{{ new_name }}" + rpo: "{{ new_rpo }}" + alert_threshold: "{{ new_alert_threshold }}" + remote_system: "{{ new_remote_system }}" + state: "present" + register: reprule_result + - name: Store replication rule details + ansible.builtin.debug: + var: reprule_result + + - name: Delete an existing replication rule + dellemc.powerstore.replicationrule: + array_ip: "{{ array_ip }}" + validate_certs: "{{ validate_certs }}" + user: "{{ user }}" + password: "{{ password }}" + replication_rule_name: "{{ new_name }}" + state: "absent" + register: reprule_result + + - name: Delete an existing replication rule Idempotency + dellemc.powerstore.replicationrule: + array_ip: "{{ array_ip }}" + validate_certs: "{{ validate_certs }}" + user: "{{ user }}" + password: "{{ password }}" + replication_rule_name: "{{ new_name }}" + state: "absent" + register: reprule_result + - name: Store replication rule details + ansible.builtin.debug: + var: reprule_result diff --git a/playbooks/modules/replicationsession.yml b/playbooks/modules/replicationsession.yml new file mode 100644 index 0000000..d083b09 --- /dev/null +++ b/playbooks/modules/replicationsession.yml @@ -0,0 +1,98 @@ +--- +- name: Replication session operations on Powerstore storage system + hosts: localhost + connection: local + vars: + array_ip: "10.**.**.**" + validate_certs: false + user: "user" + password: "Password" + session_id: "dfcc63f6-xxx-xxx-xxx-xxx" + vg_1: "ansible_vg_1" + + tasks: + - name: Get replication session details by session id + dellemc.powerstore.replicationsession: + array_ip: "{{ array_ip }}" + validate_certs: "{{ validate_certs }}" + user: "{{ user }}" + password: "{{ password }}" + session_id: "{{ session_id }}" + + - name: Get replication session details by volume group name + dellemc.powerstore.replicationsession: + array_ip: "{{ array_ip }}" + validate_certs: "{{ validate_certs }}" + user: "{{ user }}" + password: "{{ password }}" + volume_group: "{{ vg_1 }}" + + - name: Get replication session details by replication group name + dellemc.powerstore.replicationsession: + array_ip: "{{ array_ip }}" + validate_certs: "{{ validate_certs }}" + user: "{{ user }}" + password: "{{ password }}" + replication_group: "replication_group" + + - name: Get replication session details by filesystem name + dellemc.powerstore.replicationsession: + array_ip: "{{ array_ip }}" + validate_certs: "{{ validate_certs }}" + user: "{{ user }}" + password: "{{ password }}" + filesystem: "sample_filesystem" + nas_server: "sample_nas_server" + + - name: Get replication session details by nas server name + dellemc.powerstore.replicationsession: + array_ip: "{{ array_ip }}" + validate_certs: "{{ validate_certs }}" + user: "{{ user }}" + password: "{{ password }}" + nas_server: "sample_nas_server" + + - name: Pause a replication session when in OK state + dellemc.powerstore.replicationsession: + array_ip: "{{ array_ip }}" + validate_certs: "{{ validate_certs }}" + user: "{{ user }}" + password: "{{ password }}" + volume_group: "{{ vg_1 }}" + session_state: "paused" + + - name: Failover a replication session when in paused state + dellemc.powerstore.replicationsession: + array_ip: "{{ array_ip }}" + validate_certs: "{{ validate_certs }}" + user: "{{ user }}" + password: "{{ password }}" + volume_group: "{{ vg_1 }}" + session_state: "failed_over" + + - name: Sync a session when in failed_over state + dellemc.powerstore.replicationsession: + array_ip: "{{ array_ip }}" + validate_certs: "{{ validate_certs }}" + user: "{{ user }}" + password: "{{ password }}" + volume_group: "{{ vg_1 }}" + session_state: "synchronizing" + + - name: Sync a replication session when in synchronizing state idempotency + dellemc.powerstore.replicationsession: + array_ip: "{{ array_ip }}" + validate_certs: "{{ validate_certs }}" + user: "{{ user }}" + password: "{{ password }}" + volume_group: "{{ vg_1 }}" + session_state: "synchronizing" + + - name: Modify the role of replication session + dellemc.powerstore.replicationsession: + array_ip: "{{ array_ip }}" + validate_certs: "{{ validate_certs }}" + user: "{{ user }}" + password: "{{ password }}" + volume: "{{ vg_1 }}" + role: "Metro_Preferred" diff --git a/playbooks/modules/role.yml b/playbooks/modules/role.yml new file mode 100644 index 0000000..a260ed7 --- /dev/null +++ b/playbooks/modules/role.yml @@ -0,0 +1,28 @@ +--- +- name: Role module operations on PowerStore storage system + hosts: localhost + connection: local + vars: + array_ip: "10.**.**.**" + validate_certs: false + user: "user" + password: "Password" + + tasks: + - name: Get details of a role by id + dellemc.powerstore.role: + array_ip: "{{ array_ip }}" + validate_certs: "{{ validate_certs }}" + user: "{{ user }}" + password: "{{ password }}" + role_id: "1" + state: "present" + + - name: Get details of a role by name + dellemc.powerstore.role: + array_ip: "{{ array_ip }}" + validate_certs: "{{ validate_certs }}" + user: "{{ user }}" + password: "{{ password }}" + role_name: "Storage Administrator" + state: "present" diff --git a/playbooks/modules/security_config.yml b/playbooks/modules/security_config.yml new file mode 100644 index 0000000..0063fc6 --- /dev/null +++ b/playbooks/modules/security_config.yml @@ -0,0 +1,39 @@ +--- +- name: Security Config module operations on PowerStore storage system + hosts: localhost + connection: local + vars: + array_ip: "10.**.**.**" + validate_certs: false + user: "user" + password: "Password" + + tasks: + - name: Get details of a security config + dellemc.powerstore.security_config: + array_ip: "{{ array_ip }}" + validate_certs: "{{ validate_certs }}" + user: "{{ user }}" + password: "{{ password }}" + security_config_id: 1 + state: "present" + + - name: Modify the protocol_mode of security config + dellemc.powerstore.security_config: + array_ip: "{{ array_ip }}" + validate_certs: "{{ validate_certs }}" + user: "{{ user }}" + password: "{{ password }}" + security_config_id: 1 + protocol_mode: "TLSv1_1" + state: "present" + + - name: Modify the protocol_mode of security config - Idempotency + dellemc.powerstore.security_config: + array_ip: "{{ array_ip }}" + validate_certs: "{{ validate_certs }}" + user: "{{ user }}" + password: "{{ password }}" + security_config_id: 1 + protocol_mode: "TLSv1_1" + state: "present" diff --git a/playbooks/modules/smbshare.yml b/playbooks/modules/smbshare.yml new file mode 100644 index 0000000..132f491 --- /dev/null +++ b/playbooks/modules/smbshare.yml @@ -0,0 +1,164 @@ +--- +- name: SMB Share Module Operations + hosts: localhost + connection: local + vars: + array_ip: "10.**.**.**" + validate_certs: false + user: "user" + password: "Password" + share_name: "sample_smb_share" + filesystem: "ansible_share_fs" + nas_server: "ansible_nas_server_2" + snapshot: "sample_snapshot_1" + share_name_1: "sample_share_1" + share_name_2: "sample_share_2" + + tasks: + - name: Create a SMB share for a filesystem + register: result + dellemc.powerstore.smbshare: + array_ip: "{{ array_ip }}" + validate_certs: "{{ validate_certs }}" + user: "{{ user }}" + password: "{{ password }}" + share_name: "{{ share_name_1 }}" + filesystem: "{{ filesystem }}" + path: "/ansible_share_fs/" + nas_server: "{{ nas_server }}" + state: "present" + + - name: Create a SMB share for a filesystem Idempotency + dellemc.powerstore.smbshare: + array_ip: "{{ array_ip }}" + validate_certs: "{{ validate_certs }}" + user: "{{ user }}" + password: "{{ password }}" + share_name: "{{ share_name_1 }}" + filesystem: "{{ filesystem }}" + path: "/ansible_share_fs/" + nas_server: "{{ nas_server }}" + state: "present" + + - name: Create a SMB share for filesystem Snapshot + register: result + dellemc.powerstore.smbshare: + array_ip: "{{ array_ip }}" + validate_certs: "{{ validate_certs }}" + user: "{{ user }}" + password: "{{ password }}" + share_name: "{{ share_name_2 }}" + snapshot: "{{ snapshot }}" + path: "/sample_snapshot_1" + nas_server: "{{ nas_server }}" + description: "Share for Snapshot created" + offline_availability: "PROGRAMS" + is_continuous_availability_enabled: true + umask: "027" + is_branch_cache_enabled: true + is_abe_enabled: true + state: "present" + + - name: Create a SMB share for filesystem Snapshot Idempotency + dellemc.powerstore.smbshare: + array_ip: "{{ array_ip }}" + validate_certs: "{{ validate_certs }}" + user: "{{ user }}" + password: "{{ password }}" + share_name: "{{ share_name_2 }}" + snapshot: "{{ snapshot }}" + path: "/sample_snapshot_1" + nas_server: "{{ nas_server }}" + description: "Share for Snapshot created" + offline_availability: "PROGRAMS" + is_continuous_availability_enabled: true + umask: "027" + is_branch_cache_enabled: true + is_abe_enabled: true + state: "present" + + - name: Get details of SMB share + dellemc.powerstore.smbshare: + array_ip: "{{ array_ip }}" + validate_certs: "{{ validate_certs }}" + user: "{{ user }}" + password: "{{ password }}" + share_name: "{{ share_name_1 }}" + filesystem: "{{ filesystem }}" + nas_server: "{{ nas_server }}" + state: "present" + + - name: Get details of Snapshot"s SMB share + dellemc.powerstore.smbshare: + array_ip: "{{ array_ip }}" + validate_certs: "{{ validate_certs }}" + user: "{{ user }}" + password: "{{ password }}" + share_id: "{{ snap_share_id }}" + state: "present" + + - name: Update a SMB share for filesystem + dellemc.powerstore.smbshare: + array_ip: "{{ array_ip }}" + validate_certs: "{{ validate_certs }}" + user: "{{ user }}" + password: "{{ password }}" + share_name: "{{ share_name_1 }}" + filesystem: "{{ fs_id }}" + is_continuous_availability_enabled: true + is_encryption_enabled: true + umask: "027" + is_branch_cache_enabled: true + is_abe_enabled: true + state: "present" + + - name: Update a SMB share for a filesystem Idempotency + dellemc.powerstore.smbshare: + array_ip: "{{ array_ip }}" + validate_certs: "{{ validate_certs }}" + user: "{{ user }}" + password: "{{ password }}" + share_name: "{{ share_name_1 }}" + filesystem: "{{ fs_id }}" + is_continuous_availability_enabled: true + is_encryption_enabled: true + umask: "027" + is_branch_cache_enabled: true + is_abe_enabled: true + state: "present" + + - name: Delete SMB share (filesystem) + dellemc.powerstore.smbshare: + array_ip: "{{ array_ip }}" + validate_certs: "{{ validate_certs }}" + user: "{{ user }}" + password: "{{ password }}" + share_id: "{{ fs_share_id }}" + state: "absent" + + - name: Delete SMB share (filesystem) Idempotency + dellemc.powerstore.smbshare: + array_ip: "{{ array_ip }}" + validate_certs: "{{ validate_certs }}" + user: "{{ user }}" + password: "{{ password }}" + share_id: "{{ fs_share_id }}" + state: "absent" + + - name: Delete SMB share (snapshot) + dellemc.powerstore.smbshare: + array_ip: "{{ array_ip }}" + validate_certs: "{{ validate_certs }}" + user: "{{ user }}" + password: "{{ password }}" + share_id: "{{ snap_share_id }}" + state: "absent" + + - name: Delete SMB share (snapshot) Idempotency + dellemc.powerstore.smbshare: + array_ip: "{{ array_ip }}" + validate_certs: "{{ validate_certs }}" + user: "{{ user }}" + password: "{{ password }}" + share_id: "{{ snap_share_id }}" + state: "absent" diff --git a/playbooks/modules/smtp_config.yml b/playbooks/modules/smtp_config.yml new file mode 100644 index 0000000..378b704 --- /dev/null +++ b/playbooks/modules/smtp_config.yml @@ -0,0 +1,51 @@ +--- +- name: SMTP Config Module Operations on Powerstore Array + hosts: localhost + connection: local + vars: + array_ip: "10.**.**.**" + validate_certs: false + user: "user" + password: "Password" + + tasks: + - name: Get details of SMTP configuration + dellemc.powerstore.smtp_config: + array_ip: "{{ array_ip }}" + user: "{{ user }}" + password: "{{ password }}" + validate_certs: "{{ validate_certs }}" + smtp_id: 0 + state: "present" + + - name: Modify SMTP config details + dellemc.powerstore.smtp_config: + array_ip: "{{ array_ip }}" + user: "{{ user }}" + password: "{{ password }}" + validate_certs: "{{ validate_certs }}" + smtp_id: 0 + smtp_address: "sample.smtp.com" + source_email: "xyz@example.com" + state: "present" + + - name: Modify SMTP config details - Idempotency + dellemc.powerstore.smtp_config: + array_ip: "{{ array_ip }}" + user: "{{ user }}" + password: "{{ password }}" + validate_certs: "{{ validate_certs }}" + smtp_id: 0 + smtp_address: "sample.smtp.com" + source_email: "xyz@example.com" + state: "present" + + - name: Send a test mail through the SMTP server + dellemc.powerstore.smtp_config: + array_ip: "{{ array_ip }}" + user: "{{ user }}" + password: "{{ password }}" + validate_certs: "{{ validate_certs }}" + smtp_id: 0 + destination_email: "abc@example.com" + state: "present" diff --git a/playbooks/modules/snapshot.yml b/playbooks/modules/snapshot.yml new file mode 100644 index 0000000..0e5a8c2 --- /dev/null +++ b/playbooks/modules/snapshot.yml @@ -0,0 +1,205 @@ +--- +- name: Sample playbook for managing Snapshots on Dell EMC PowerStore. + hosts: localhost + connection: local + vars: + array_ip: "10.**.**.**" + validate_certs: false + user: "user" + password: "Password" + snapshot_name: "ansible_snapshot" + new_snapshot_name: "ansible_rename" + volume: "ansible_snap_test_volume" + volume_group: "ansible_snap_test_volume_group" + description: "Snap created using Ansible" + desired_retention: "2" + desired_retention_new: "3" + retention_unit_days: "days" + retention_unit_hours: "hours" + expiration_timestamp: "2050-07-24T11:50:20Z" + expiration_timestamp_new: "2050-08-24T11:50:20Z" + state_present: "present" + state_absent: "absent" + + tasks: + - name: Create a vol snap on PowerStore + dellemc.powerstore.snapshot: + array_ip: "{{ array_ip }}" + validate_certs: "{{ validate_certs }}" + user: "{{ user }}" + password: "{{ password }}" + snapshot_name: "{{ snapshot_name }}" + volume: "{{ volume }}" + description: "{{ description }}" + desired_retention: "{{ desired_retention }}" + retention_unit: "{{ retention_unit_days }}" + state: "{{ state_present }}" + + - name: Create a vol snap on PowerStore - Idempotency + dellemc.powerstore.snapshot: + array_ip: "{{ array_ip }}" + validate_certs: "{{ validate_certs }}" + user: "{{ user }}" + password: "{{ password }}" + snapshot_name: "{{ snapshot_name }}" + volume: "{{ volume }}" + description: "{{ description }}" + desired_retention: "{{ desired_retention }}" + retention_unit: "{{ retention_unit_days }}" + state: "{{ state_present }}" + + - name: Get details of a volume snapshot + dellemc.powerstore.snapshot: + array_ip: "{{ array_ip }}" + validate_certs: "{{ validate_certs }}" + user: "{{ user }}" + password: "{{ password }}" + snapshot_name: "{{ snapshot_name }}" + volume: "{{ volume }}" + state: "{{ state_present }}" + + - name: Modify vol snapshot desired retention + dellemc.powerstore.snapshot: + array_ip: "{{ array_ip }}" + validate_certs: "{{ validate_certs }}" + user: "{{ user }}" + password: "{{ password }}" + snapshot_name: "{{ snapshot_name }}" + volume: "{{ volume }}" + description: "{{ description }}" + desired_retention: "{{ desired_retention_new }}" + retention_unit: "{{ retention_unit_days }}" + state: "{{ state_present }}" + + - name: Modify vol snapshot desired retention - Idempotency + dellemc.powerstore.snapshot: + array_ip: "{{ array_ip }}" + validate_certs: "{{ validate_certs }}" + user: "{{ user }}" + password: "{{ password }}" + snapshot_name: "{{ snapshot_name }}" + volume: "{{ volume }}" + description: "{{ description }}" + desired_retention: "{{ desired_retention_new }}" + retention_unit: "{{ retention_unit_days }}" + state: "{{ state_present }}" + + - name: Rename vol snapshot + dellemc.powerstore.snapshot: + array_ip: "{{ array_ip }}" + validate_certs: "{{ validate_certs }}" + user: "{{ user }}" + password: "{{ password }}" + snapshot_name: "{{ snapshot_name }}" + new_snapshot_name: "{{ new_snapshot_name }}" + volume: "{{ volume }}" + state: "{{ state_present }}" + + - name: Delete vol snapshot + dellemc.powerstore.snapshot: + array_ip: "{{ array_ip }}" + validate_certs: "{{ validate_certs }}" + user: "{{ user }}" + password: "{{ password }}" + snapshot_name: "{{ new_snapshot_name }}" + volume: "{{ volume }}" + state: "{{ state_absent }}" + + - name: Delete vol snapshot - Idempotency + dellemc.powerstore.snapshot: + array_ip: "{{ array_ip }}" + validate_certs: "{{ validate_certs }}" + user: "{{ user }}" + password: "{{ password }}" + snapshot_name: "{{ new_snapshot_name }}" + volume: "{{ volume }}" + state: "{{ state_absent }}" + + - name: Create a vol group snap on PowerStore + dellemc.powerstore.snapshot: + array_ip: "{{ array_ip }}" + validate_certs: "{{ validate_certs }}" + user: "{{ user }}" + password: "{{ password }}" + snapshot_name: "{{ snapshot_name }}" + volume_group: "{{ volume_group }}" + description: "{{ description }}" + expiration_timestamp: "{{ expiration_timestamp }}" + state: "{{ state_present }}" + + - name: Create a vol group snap on PowerStore - Idempotency + dellemc.powerstore.snapshot: + array_ip: "{{ array_ip }}" + validate_certs: "{{ validate_certs }}" + user: "{{ user }}" + password: "{{ password }}" + snapshot_name: "{{ snapshot_name }}" + volume_group: "{{ volume_group }}" + description: "{{ description }}" + expiration_timestamp: "{{ expiration_timestamp }}" + state: "{{ state_present }}" + + - name: Get details of a volume group snapshot + dellemc.powerstore.snapshot: + array_ip: "{{ array_ip }}" + validate_certs: "{{ validate_certs }}" + user: "{{ user }}" + password: "{{ password }}" + snapshot_name: "{{ snapshot_name }}" + volume_group: "{{ volume_group }}" + state: "{{ state_present }}" + + - name: Modify vol group snapshot expiration timestamp + dellemc.powerstore.snapshot: + array_ip: "{{ array_ip }}" + validate_certs: "{{ validate_certs }}" + user: "{{ user }}" + password: "{{ password }}" + snapshot_name: "{{ snapshot_name }}" + volume_group: "{{ volume_group }}" + description: "{{ description }}" + expiration_timestamp: "{{ expiration_timestamp_new }}" + state: "{{ state_present }}" + + - name: Modify vol group snapshot desired retention - Idempotency + dellemc.powerstore.snapshot: + array_ip: "{{ array_ip }}" + validate_certs: "{{ validate_certs }}" + user: "{{ user }}" + password: "{{ password }}" + snapshot_name: "{{ snapshot_name }}" + volume_group: "{{ volume_group }}" + description: "{{ description }}" + expiration_timestamp: "{{ expiration_timestamp_new }}" + state: "{{ state_present }}" + + - name: Rename vol group snapshot + dellemc.powerstore.snapshot: + array_ip: "{{ array_ip }}" + validate_certs: "{{ validate_certs }}" + user: "{{ user }}" + password: "{{ password }}" + snapshot_name: "{{ snapshot_name }}" + new_snapshot_name: "{{ new_snapshot_name }}" + volume_group: "{{ volume_group }}" + state: "{{ state_present }}" + + - name: Delete vol group snapshot + dellemc.powerstore.snapshot: + array_ip: "{{ array_ip }}" + validate_certs: "{{ validate_certs }}" + user: "{{ user }}" + password: "{{ password }}" + snapshot_name: "{{ new_snapshot_name }}" + volume_group: "{{ volume_group }}" + state: "{{ state_absent }}" + + - name: Delete vol snapshot - Idempotency + dellemc.powerstore.snapshot: + array_ip: "{{ array_ip }}" + validate_certs: "{{ validate_certs }}" + user: "{{ user }}" + password: "{{ password }}" + snapshot_name: "{{ new_snapshot_name }}" + volume_group: "{{ volume_group }}" + state: "{{ state_absent }}" diff --git a/playbooks/modules/snapshotrule.yml b/playbooks/modules/snapshotrule.yml new file mode 100644 index 0000000..091750a --- /dev/null +++ b/playbooks/modules/snapshotrule.yml @@ -0,0 +1,218 @@ +--- +- name: Snapshot rule operations on Powerstore Storage System + hosts: localhost + connection: local + vars: + array_ip: "10.**.**.**" + validate_certs: false + user: "user" + password: "Password" + snap_rule_name: "DevCon_Ansible_SnapRule_Test" + snapshotrule_id: "" + new_name: "Modified_DevCon_Ansible_SnapRule_Test" + days_of_week: "" + interval: "Five_Minutes" + new_interval: "One_Hour" + time_of_day: "12:00" + new_time_of_day: "00:45" + desired_retention: 24 + new_desired_retention: 72 + delete_snaps: true + state: "present" + + tasks: + - name: Create new snapshot rule by interval + dellemc.powerstore.snapshotrule: + array_ip: "{{ array_ip }}" + validate_certs: "{{ validate_certs }}" + user: "{{ user }}" + password: "{{ password }}" + name: "{{ snap_rule_name }}" + interval: "{{ interval }}" + days_of_week: + - Monday + desired_retention: "{{ desired_retention }}" + state: "present" + register: snaprule_result + - name: Store snapshot rule details + ansible.builtin.debug: + var: snaprule_result + + - name: Create new snapshot rule by interval Idempotency + dellemc.powerstore.snapshotrule: + array_ip: "{{ array_ip }}" + validate_certs: "{{ validate_certs }}" + user: "{{ user }}" + password: "{{ password }}" + name: "{{ snap_rule_name }}" + interval: "{{ interval }}" + days_of_week: + - Monday + desired_retention: "{{ desired_retention }}" + state: "present" + register: snaprule_result + - name: Store snapshot rule details + ansible.builtin.debug: + var: snaprule_result + + - name: Modify existing snapshot rule by interval + dellemc.powerstore.snapshotrule: + array_ip: "{{ array_ip }}" + validate_certs: "{{ validate_certs }}" + user: "{{ user }}" + password: "{{ password }}" + name: "{{ snap_rule_name }}" + new_name: "{{ new_name }}" + interval: "{{ new_interval }}" + days_of_week: + - Sunday + desired_retention: "{{ new_desired_retention }}" + state: "present" + register: snaprule_result + - name: Store snapshot rule details + ansible.builtin.debug: + var: snaprule_result + + - name: Modify existing snapshot rule by interval Idempotency + dellemc.powerstore.snapshotrule: + array_ip: "{{ array_ip }}" + validate_certs: "{{ validate_certs }}" + user: "{{ user }}" + password: "{{ password }}" + name: "{{ new_name }}" + interval: "{{ new_interval }}" + days_of_week: + - Sunday + desired_retention: "{{ new_desired_retention }}" + state: "present" + register: snaprule_result + - name: Store snapshot rule details + ansible.builtin.debug: + var: snaprule_result + + - name: Delete an existing snapshot rule + dellemc.powerstore.snapshotrule: + array_ip: "{{ array_ip }}" + validate_certs: "{{ validate_certs }}" + user: "{{ user }}" + password: "{{ password }}" + name: "{{ new_name }}" + delete_snaps: true + state: "absent" + register: snaprule_result + - name: Store snapshot rule details + ansible.builtin.debug: + var: snaprule_result + + - name: Create new snapshot rule by time_of_day and days_of_week + dellemc.powerstore.snapshotrule: + array_ip: "{{ array_ip }}" + validate_certs: "{{ validate_certs }}" + user: "{{ user }}" + password: "{{ password }}" + name: "{{ snap_rule_name }}" + desired_retention: "{{ desired_retention }}" + days_of_week: + - Monday + - Wednesday + - Friday + time_of_day: "{{ time_of_day }}" + state: "present" + register: snaprule_result + - name: Store snapshot rule details + ansible.builtin.debug: + var: snaprule_result + + - name: Create new snapshot rule by time_of_day and days_of_week Idempotency + dellemc.powerstore.snapshotrule: + array_ip: "{{ array_ip }}" + validate_certs: "{{ validate_certs }}" + user: "{{ user }}" + password: "{{ password }}" + name: "{{ snap_rule_name }}" + desired_retention: "{{ desired_retention }}" + days_of_week: + - Monday + - Wednesday + - Friday + time_of_day: "{{ time_of_day }}" + state: "present" + register: snaprule_result + - name: Store snapshot rule details + ansible.builtin.debug: + var: snaprule_result + + - name: Modify existing snapshot rule by time_of_day and days_of_week + dellemc.powerstore.snapshotrule: + array_ip: "{{ array_ip }}" + validate_certs: "{{ validate_certs }}" + user: "{{ user }}" + password: "{{ password }}" + name: "{{ snap_rule_name }}" + new_name: "{{ new_name }}" + desired_retention: "{{ desired_retention }}" + days_of_week: + - Monday + - Wednesday + - Friday + - Sunday + time_of_day: "{{ new_time_of_day }}" + state: "present" + register: snaprule_result + - name: Store snapshot rule details + ansible.builtin.debug: + var: snaprule_result + + - name: Get details of existing snapshot rule by name + dellemc.powerstore.snapshotrule: + array_ip: "{{ array_ip }}" + validate_certs: "{{ validate_certs }}" + user: "{{ user }}" + password: "{{ password }}" + name: "{{ new_name }}" + state: "present" + register: snaprule_result + - name: Store snapshot rule details + ansible.builtin.debug: + var: snaprule_result + + - name: Get details of existing snapshot rule by snapshotrule_id + dellemc.powerstore.snapshotrule: + array_ip: "{{ array_ip }}" + validate_certs: "{{ validate_certs }}" + user: "{{ user }}" + password: "{{ password }}" + snapshotrule_id: "{{ snapshotrule_id }}" + state: "present" + register: snaprule_result + - name: Store snapshot rule details + ansible.builtin.debug: + var: snaprule_result + + - name: Delete an existing snapshot rule + dellemc.powerstore.snapshotrule: + array_ip: "{{ array_ip }}" + validate_certs: "{{ validate_certs }}" + user: "{{ user }}" + password: "{{ password }}" + name: "{{ new_name }}" + delete_snaps: true + state: "absent" + register: snaprule_result + - name: Store snapshot rule details + ansible.builtin.debug: + var: snaprule_result + + - name: Delete an existing snapshot rule Idempotency + dellemc.powerstore.snapshotrule: + array_ip: "{{ array_ip }}" + validate_certs: "{{ validate_certs }}" + user: "{{ user }}" + password: "{{ password }}" + name: "{{ new_name }}" + delete_snaps: true + state: "absent" + register: snaprule_result + - name: Store snapshot rule details + ansible.builtin.debug: + var: snaprule_result diff --git a/playbooks/modules/storage_container.yml b/playbooks/modules/storage_container.yml new file mode 100644 index 0000000..57f30b3 --- /dev/null +++ b/playbooks/modules/storage_container.yml @@ -0,0 +1,236 @@ +--- +- name: Storage container Module Operations on Powerstore Array + hosts: localhost + connection: local + vars: + array_ip: '10.**.**.**' + validate_certs: false + user: "user" + password: "Password" + storage_con_name_1: "Ansible_storage_container_1" + storage_con_new_name: "Ansible_storage_container_1_new_name" + + tasks: + - name: Create a storage_container - check mode + dellemc.powerstore.storage_container: + array_ip: "{{ array_ip }}" + validate_certs: "{{ validate_certs }}" + user: "{{ user }}" + password: "{{ password }}" + storage_container_name: "{{ storage_con_name_1 }}" + quota: 0 + storage_protocol: "SCSI" + high_water_mark: 60 + check_mode: true + + - name: Create a storage_container + dellemc.powerstore.storage_container: + array_ip: "{{ array_ip }}" + validate_certs: "{{ validate_certs }}" + user: "{{ user }}" + password: "{{ password }}" + storage_container_name: "{{ storage_con_name_1 }}" + quota: 0 + storage_protocol: "SCSI" + high_water_mark: 60 + + - name: Create a storage container - Idempotency + register: result + dellemc.powerstore.storage_container: + array_ip: "{{ array_ip }}" + validate_certs: "{{ validate_certs }}" + user: "{{ user }}" + password: "{{ password }}" + storage_container_name: "{{ storage_con_name_1 }}" + quota: 0 + storage_protocol: "SCSI" + high_water_mark: 60 + state: "present" + + - name: Get the details of the storage container + dellemc.powerstore.storage_container: + array_ip: "{{ array_ip }}" + validate_certs: "{{ validate_certs }}" + user: "{{ user }}" + password: "{{ password }}" + storage_container_id: "{{ result.storage_container_details.id }}" + state: "present" + + - name: Get the details of the storage container by name + dellemc.powerstore.storage_container: + array_ip: "{{ array_ip }}" + validate_certs: "{{ validate_certs }}" + user: "{{ user }}" + password: "{{ password }}" + storage_container_name: "{{ storage_con_name_1 }}" + state: "present" + + - name: Modify a storage container - check mode + dellemc.powerstore.storage_container: + array_ip: "{{ array_ip }}" + validate_certs: "{{ validate_certs }}" + user: "{{ user }}" + password: "{{ password }}" + storage_container_name: "{{ storage_con_name_1 }}" + quota: 20 + quota_unit: "GB" + storage_protocol: "NVMe" + check_mode: true + + - name: Modify a storage container + dellemc.powerstore.storage_container: + array_ip: "{{ array_ip }}" + validate_certs: "{{ validate_certs }}" + user: "{{ user }}" + password: "{{ password }}" + storage_container_name: "{{ storage_con_name_1 }}" + quota: 20 + quota_unit: "GB" + storage_protocol: "NVMe" + state: "present" + + - name: Modify a storage container - Idempotency + dellemc.powerstore.storage_container: + array_ip: "{{ array_ip }}" + validate_certs: "{{ validate_certs }}" + user: "{{ user }}" + password: "{{ password }}" + storage_container_name: "{{ storage_con_name_1 }}" + quota: 20 + quota_unit: "GB" + storage_protocol: "NVMe" + + - name: Rename a storage container + dellemc.powerstore.storage_container: + array_ip: "{{ array_ip }}" + validate_certs: "{{ validate_certs }}" + user: "{{ user }}" + password: "{{ password }}" + storage_container_name: "{{ storage_con_name_1 }}" + new_name: "{{ storage_con_new_name }}" + + - name: Delete a storage container - check mode + dellemc.powerstore.storage_container: + array_ip: "{{ array_ip }}" + validate_certs: "{{ validate_certs }}" + user: "{{ user }}" + password: "{{ password }}" + storage_container_name: "{{ storage_con_new_name }}" + state: "absent" + check_mode: true + + - name: Delete a storage container + dellemc.powerstore.storage_container: + array_ip: "{{ array_ip }}" + validate_certs: "{{ validate_certs }}" + user: "{{ user }}" + password: "{{ password }}" + storage_container_id: "{{ result.storage_container_details.id }}" + state: "absent" + + - name: Delete a storage container - Idempotency + dellemc.powerstore.storage_container: + array_ip: "{{ array_ip }}" + validate_certs: "{{ validate_certs }}" + user: "{{ user }}" + password: "{{ password }}" + storage_container_name: "{{ storage_con_new_name }}" + state: "absent" + + - name: Create storage container destination - check_mode + dellemc.powerstore.storage_container: + array_ip: "{{ array_ip }}" + validate_certs: "{{ validate_certs }}" + user: "{{ user }}" + password: "{{ password }}" + storage_container_name: "{{ storage_con_name_1 }}" + storage_container_destination: + remote_address: "10.x.x.y" + user: "{{ user }}" + password: "{{ password }}" + validate_certs: false + remote_system: "AA-D902" + remote_storage_container: "{{ remote_storage_container_name }}" + check_mode: true + + - name: Create storage container destination + dellemc.powerstore.storage_container: + array_ip: "{{ array_ip }}" + validate_certs: "{{ validate_certs }}" + user: "{{ user }}" + password: "{{ password }}" + storage_container_name: "{{ storage_con_name_1 }}" + storage_container_destination: + remote_address: "10.x.x.y" + user: "{{ user }}" + password: "{{ password }}" + validate_certs: false + remote_system: "AA-D902" + remote_storage_container: "{{ remote_storage_container_name }}" + + - name: Create storage container destination - Idempotency + dellemc.powerstore.storage_container: + array_ip: "{{ array_ip }}" + validate_certs: "{{ validate_certs }}" + user: "{{ user }}" + password: "{{ password }}" + storage_container_name: "{{ storage_con_name_1 }}" + storage_container_destination: + remote_address: "10.x.x.y" + user: "{{ user }}" + password: "{{ password }}" + validate_certs: false + remote_system: "AA-D902" + remote_storage_container: "{{ remote_storage_container_name }}" + + - name: Delete storage container destination - check_mode + dellemc.powerstore.storage_container: + array_ip: "{{ array_ip }}" + validate_certs: "{{ validate_certs }}" + user: "{{ user }}" + password: "{{ password }}" + storage_container_name: "{{ storage_con_name_1 }}" + state: "present" + storge_container_destination_state: "absent" + storage_container_destination: + remote_address: "10.x.x.y" + user: "{{ user }}" + password: "{{ password }}" + validate_certs: false + remote_system: "AA-D902" + remote_storage_container: "{{ remote_storage_container_name }}" + check_mode: true + + - name: Delete storage container destination + dellemc.powerstore.storage_container: + array_ip: "{{ array_ip }}" + validate_certs: "{{ validate_certs }}" + user: "{{ user }}" + password: "{{ password }}" + storage_container_name: "{{ storage_con_name_1 }}" + state: "present" + storge_container_destination_state: "absent" + storage_container_destination: + remote_address: "10.x.x.y" + user: "{{ user }}" + password: "{{ password }}" + validate_certs: false + remote_system: "AA-D902" + remote_storage_container: "{{ remote_storage_container_name }}" + + - name: Delete storage container destination - Idempotency + dellemc.powerstore.storage_container: + array_ip: "{{ array_ip }}" + validate_certs: "{{ validate_certs }}" + user: "{{ user }}" + password: "{{ password }}" + storage_container_name: "{{ storage_con_name_1 }}" + state: "present" + storge_container_destination_state: "absent" + storage_container_destination: + remote_address: "10.x.x.y" + user: "{{ user }}" + password: "{{ password }}" + validate_certs: false + remote_system: "AA-D902" + remote_storage_container: "{{ remote_storage_container_name }}" diff --git a/playbooks/modules/vcenter.yml b/playbooks/modules/vcenter.yml new file mode 100644 index 0000000..e284ed8 --- /dev/null +++ b/playbooks/modules/vcenter.yml @@ -0,0 +1,91 @@ +--- +- name: Testing vCenter operations on Powerstore + hosts: localhost + connection: local + vars: + array_ip: "10.**.**.**" + validate_certs: false + user: "user" + password: "Password" + + tasks: + - name: Add a vcenter + register: result + dellemc.powerstore.vcenter: + array_ip: "{{ array_ip }}" + user: "{{ user }}" + password: "{{ password }}" + validate_certs: "{{ validate_certs }}" + address: "XX.XX.XX.XX" + vcenter_username: "user-name" + vcenter_password: "password" + update_password: "on_create" + vasa_provider_credentials: + username: "admin" + password: "pass" + + - name: Add a vcenter - Idempotency + dellemc.powerstore.vcenter: + array_ip: "{{ array_ip }}" + user: "{{ user }}" + password: "{{ password }}" + validate_certs: "{{ validate_certs }}" + address: "XX.XX.XX.XX" + vcenter_username: "user-name" + vcenter_password: "password" + update_password: "on_create" + vasa_provider_credentials: + username: "admin" + password: "pass" + + - name: Get details of vCenter + dellemc.powerstore.vcenter: + array_ip: "{{ array_ip }}" + user: "{{ user }}" + password: "{{ password }}" + validate_certs: "{{ validate_certs }}" + vcenter_id: "{{ result.vcenter_details.id }}" + + - name: Modify a vCenter attribute + dellemc.powerstore.vcenter: + array_ip: "{{ array_ip }}" + user: "{{ user }}" + password: "{{ password }}" + validate_certs: "{{ validate_certs }}" + vcenter_id: "{{ result.vcenter_details.id }}" + address: "XX.XX.XX.YY" + vcenter_username: "user-name" + vcenter_password: "password" + update_password: "always" + + - name: Modify a vCenter attribute - Idempotency + dellemc.powerstore.vcenter: + array_ip: "{{ array_ip }}" + user: "{{ user }}" + password: "{{ password }}" + validate_certs: "{{ validate_certs }}" + vcenter_id: "{{ result.vcenter_details.id }}" + address: "XX.XX.XX.YY" + vcenter_username: "user-name" + vcenter_password: "password" + update_password: "on_create" + + - name: Remove a vcenter + dellemc.powerstore.vcenter: + array_ip: "{{ array_ip }}" + user: "{{ user }}" + password: "{{ password }}" + validate_certs: "{{ validate_certs }}" + vcenter_id: "{{ result.vcenter_details.id }}" + delete_vasa_provider: true + state: "absent" + + - name: Remove a vcenter - Idempotency + dellemc.powerstore.vcenter: + array_ip: "{{ array_ip }}" + user: "{{ user }}" + password: "{{ password }}" + validate_certs: "{{ validate_certs }}" + vcenter_id: "{{ result.vcenter_details.id }}" + delete_vasa_provider: true + state: "absent" diff --git a/playbooks/modules/volume.yml b/playbooks/modules/volume.yml new file mode 100644 index 0000000..447fa18 --- /dev/null +++ b/playbooks/modules/volume.yml @@ -0,0 +1,308 @@ +--- +- name: Testing Volume operations on Powerstore + hosts: localhost + connection: local + vars: + array_ip: '10.xx.xx.xx' + validate_certs: false + user: 'user' + password: 'Password' + vg_name: "Volume_Module_Test" + vol_name: 'test_volume' + vol_name2: 'Volume_Module_Test2' + cap_unit: 'GB' + + tasks: + - name: Create stand-alone volume + register: result_vol + dellemc.powerstore.volume: + array_ip: "{{ array_ip }}" + validate_certs: "{{ validate_certs }}" + user: "{{ user }}" + password: "{{ password }}" + vol_name: "{{ vol_name }}" + size: 1 + cap_unit: "{{ cap_unit }}" + state: 'present' + description: '{{ vol_name }}' + protection_policy: 'pro_policy1' + performance_policy: 'medium' + appliance_name: "Appliance_name" + + - name: Create volume in volume group + dellemc.powerstore.volume: + array_ip: "{{ array_ip }}" + validate_certs: "{{ validate_certs }}" + user: "{{ user }}" + password: "{{ password }}" + vol_name: "{{ vol_name2 }}" + vg_name: "{{ vg_name }}" + size: 1 + cap_unit: "{{ cap_unit }}" + state: "present" + + - name: Get volume details using ID + dellemc.powerstore.volume: + array_ip: "{{ array_ip }}" + validate_certs: "{{ validate_certs }}" + user: "{{ user }}" + password: "{{ password }}" + vol_id: "{{ result_vol.volume_details.id }}" + state: "present" + + - name: Get volume details using name + dellemc.powerstore.volume: + array_ip: "{{ array_ip }}" + validate_certs: "{{ validate_certs }}" + user: "{{ user }}" + password: "{{ password }}" + vol_name: "{{ vol_name2 }}" + state: "present" + + - name: Modify volume size, name, description and performance policy + dellemc.powerstore.volume: + array_ip: "{{ array_ip }}" + validate_certs: "{{ validate_certs }}" + user: "{{ user }}" + password: "{{ password }}" + new_name: "Volume_Module_Test3" + vol_name: "{{ vol_name2 }}" + state: "present" + size: 2 + performance_policy: 'high' + description: 'new description' + + - name: Expand volume using ID + dellemc.powerstore.volume: + array_ip: "{{ array_ip }}" + validate_certs: "{{ validate_certs }}" + user: "{{ user }}" + password: "{{ password }}" + vol_id: "{{ result_vol.volume_details.id }}" + size: 2 + cap_unit: "{{ cap_unit }}" + state: 'present' + + - name: Rename volume using ID + dellemc.powerstore.volume: + array_ip: "{{ array_ip }}" + validate_certs: "{{ validate_certs }}" + user: "{{ user }}" + password: "{{ password }}" + vol_id: "{{ result_vol.volume_details.id }}" + new_name: "Ansible_Volume_Renamed" + state: "present" + + - name: Rename volume using name + dellemc.powerstore.volume: + array_ip: "{{ array_ip }}" + validate_certs: "{{ validate_certs }}" + user: "{{ user }}" + password: "{{ password }}" + vol_name: "Ansible_Volume_Renamed" + new_name: "{{ vol_name }}" + state: "present" + + - name: Modify description of the volume + dellemc.powerstore.volume: + array_ip: "{{ array_ip }}" + validate_certs: "{{ validate_certs }}" + user: "{{ user }}" + password: "{{ password }}" + vol_name: "{{ vol_name }}" + description: "new description" + state: "present" + + - name: Modify protection policy of the volume + dellemc.powerstore.volume: + array_ip: "{{ array_ip }}" + validate_certs: "{{ validate_certs }}" + user: "{{ user }}" + password: "{{ password }}" + vol_name: "{{ vol_name }}" + protection_policy: "pro_policy2" + state: "present" + + - name: Modify performance policy of the volume + dellemc.powerstore.volume: + array_ip: "{{ array_ip }}" + validate_certs: "{{ validate_certs }}" + user: "{{ user }}" + password: "{{ password }}" + vol_name: "{{ vol_name }}" + performance_policy: "high" + state: "present" + + - name: Map volume to host with HLU + dellemc.powerstore.volume: + array_ip: "{{ array_ip }}" + validate_certs: "{{ validate_certs }}" + user: "{{ user }}" + password: "{{ password }}" + vol_name: "{{ vol_name }}" + host: "{{ result_host2.host_details.id }}" + mapping_state: "mapped" + state: "present" + hlu: 234 + + - name: Map volume to volume using host name, without HLU + dellemc.powerstore.volume: + array_ip: "{{ array_ip }}" + validate_certs: "{{ validate_certs }}" + user: "{{ user }}" + password: "{{ password }}" + vol_name: "{{ vol_name }}" + host: "host1_Ansible_Test" + mapping_state: "mapped" + state: "present" + + - name: Map volume to hostgroup + dellemc.powerstore.volume: + array_ip: "{{ array_ip }}" + validate_certs: "{{ validate_certs }}" + user: "{{ user }}" + password: "{{ password }}" + vol_id: "{{ result_vol.volume_details.id }}" + hostgroup: "hostgroup1_Ansible_test" + mapping_state: "mapped" + state: "present" + + - name: Unmap volume from host + dellemc.powerstore.volume: + array_ip: "{{ array_ip }}" + validate_certs: "{{ validate_certs }}" + user: "{{ user }}" + password: "{{ password }}" + vol_name: "{{ vol_name }}" + host: "{{ result_host2.host_details.id }}" + mapping_state: "unmapped" + state: "present" + + - name: Unmap volume from host + dellemc.powerstore.volume: + array_ip: "{{ array_ip }}" + validate_certs: "{{ validate_certs }}" + user: "{{ user }}" + password: "{{ password }}" + vol_name: "{{ vol_name }}" + host: "host1_Ansible_Test" + mapping_state: "unmapped" + state: "present" + + - name: Unmap volume from host group + dellemc.powerstore.volume: + array_ip: "{{ array_ip }}" + validate_certs: "{{ validate_certs }}" + user: "{{ user }}" + password: "{{ password }}" + vol_name: "{{ vol_name }}" + hostgroup: "hostgroup1_Ansible_test" + mapping_state: "unmapped" + state: "present" + + - name: Remove protection_policy from volume + dellemc.powerstore.volume: + array_ip: "{{ array_ip }}" + validate_certs: "{{ validate_certs }}" + user: "{{ user }}" + password: "{{ password }}" + vol_name: "{{ vol_name }}" + protection_policy: '' + state: "present" + + - name: Delete volume using volume name + dellemc.powerstore.volume: + array_ip: "{{ array_ip }}" + validate_certs: "{{ validate_certs }}" + user: "{{ user }}" + password: "{{ password }}" + vol_name: "{{ vol_name }}" + state: "absent" + + - name: Remove protection_policy from volume + dellemc.powerstore.volume: + array_ip: "{{ array_ip }}" + user: "{{ user }}" + password: "{{ password }}" + validate_certs: "{{ validate_certs }}" + vol_name: "Volume_Module_Test3" + protection_policy: '' + state: "present" + + - name: Delete volume using volume name + dellemc.powerstore.volume: + array_ip: "{{ array_ip }}" + validate_certs: "{{ validate_certs }}" + user: "{{ user }}" + password: "{{ password }}" + vol_name: "Volume_Module_Test3" + state: "absent" + + - name: Clone a volume + dellemc.powerstore.volume: + array_ip: "{{ array_ip }}" + validate_certs: "{{ validate_certs }}" + user: "{{ user }}" + password: "{{ password }}" + vol_name: "{{ vol_name }}" + clone_dellemc.powerstore.volume: + name: 'test_1' + description: 'test demo' + host: '1234-xxx-xxx-xxx' + logical_unit_number: 19 + protection_policy: 'PP1' + performance_policy: 'low' + state: "present" + + - name: Refresh a volume + dellemc.powerstore.volume: + array_ip: "{{ array_ip }}" + validate_certs: "{{ validate_certs }}" + user: "{{ user }}" + password: "{{ password }}" + vol_name: "{{ vol_name }}" + source_dellemc.powerstore.volume: 'test_1' + create_backup_snap: true + backup_snap_profile: + name: 'refresh_test_1' + description: 'test refresh demo backup snap' + expiration_timestamp: '2022-12-23T01:20:00Z' + performance_policy: 'low' + state: "present" + + - name: Restore a volume + dellemc.powerstore.volume: + array_ip: "{{ array_ip }}" + validate_certs: "{{ validate_certs }}" + user: "{{ user }}" + password: "{{ password }}" + vol_name: "{{ vol_name }}" + source_snap: 'refresh_test_1' + create_backup_snap: true + backup_snap_profile: + name: 'restore_test_snap_1' + description: 'test backup snap' + expiration_timestamp: '2022-12-23T01:20:00Z' + performance_policy: 'low' + state: "present" + + - name: Configure a metro volume + dellemc.powerstore.volume: + array_ip: "{{ array_ip }}" + validate_certs: "{{ validate_certs }}" + user: "{{ user }}" + password: "{{ password }}" + vol_name: "{{ vol_name }}" + remote_system: "RS-123" + state: 'present' + + - name: End metro volume configuration + dellemc.powerstore.volume: + array_ip: "{{ array_ip }}" + validate_certs: "{{ validate_certs }}" + user: "{{ user }}" + password: "{{ password }}" + vol_name: "{{ vol_name }}" + end_metro_config: true + delete_remote_volume: false + state: 'present' diff --git a/playbooks/modules/volumegroup.yml b/playbooks/modules/volumegroup.yml new file mode 100644 index 0000000..59456a0 --- /dev/null +++ b/playbooks/modules/volumegroup.yml @@ -0,0 +1,187 @@ +--- +- name: Volume Group Operations + hosts: localhost + connection: local + vars: + array_ip: "10.**.**.**" + validate_certs: false + user: "user" + password: "Password" + vg_name: "Ansible_VG_Testing" + new_vg_name: "Ansible_PowerStore_VG_Renamed" + protection_policy: "ansible_prot_pol_1" + vg_id: "" + vol_1: "ansible_vol_1" + vol_2: "ansible_vol_2" + + tasks: + - name: Create VolumeGroup with Protection Policy + dellemc.powerstore.volumegroup: + array_ip: "{{ array_ip }}" + validate_certs: "{{ validate_certs }}" + user: "{{ user }}" + password: "{{ password }}" + vg_name: "{{ vg_name }}" + protection_policy: "{{ protection_policy }}" + state: "present" + + - name: Create VolumeGroup with Protection Policy Idempotency Test + dellemc.powerstore.volumegroup: + array_ip: "{{ array_ip }}" + validate_certs: "{{ validate_certs }}" + user: "{{ user }}" + password: "{{ password }}" + vg_name: "{{ vg_name }}" + protection_policy: "{{ protection_policy }}" + state: "present" + + - name: Modify Volume Group to change Name + dellemc.powerstore.volumegroup: + array_ip: "{{ array_ip }}" + validate_certs: "{{ validate_certs }}" + user: "{{ user }}" + password: "{{ password }}" + vg_name: "{{ vg_name }}" + new_vg_name: "{{ new_vg_name }}" + protection_policy: "{{ protection_policy }}" + is_write_order_consistent: false + state: "present" + + - name: Modify Volume Group to change Name and remove Protection Policy + dellemc.powerstore.volumegroup: + array_ip: "{{ array_ip }}" + validate_certs: "{{ validate_certs }}" + user: "{{ user }}" + password: "{{ password }}" + vg_name: "{{ new_vg_name }}" + new_vg_name: "{{ vg_name }}" + protection_policy: "" + is_write_order_consistent: false + state: "present" + + - name: Add volumes to Volume Group + dellemc.powerstore.volumegroup: + array_ip: "{{ array_ip }}" + validate_certs: "{{ validate_certs }}" + user: "{{ user }}" + password: "{{ password }}" + vg_name: "{{ vg_name }}" + volumes: + - "{{ vol_id_1 }}" + - "{{ vol_2 }}" + vol_state: "present-in-group" + state: "present" + + - name: Add volumes to Volume Group Idempotency + dellemc.powerstore.volumegroup: + array_ip: "{{ array_ip }}" + validate_certs: "{{ validate_certs }}" + user: "{{ user }}" + password: "{{ password }}" + vg_name: "{{ vg_name }}" + volumes: + - "{{ vol_id_1 }}" + - "{{ vol_2 }}" + vol_state: "present-in-group" + state: "present" + + - name: Remove volumes from Volume Group + dellemc.powerstore.volumegroup: + array_ip: "{{ array_ip }}" + validate_certs: "{{ validate_certs }}" + user: "{{ user }}" + password: "{{ password }}" + vg_name: "{{ vg_name }}" + volumes: + - "{{ vol_id_1 }}" + - "{{ vol_2 }}" + vol_state: "absent-in-group" + state: "present" + + - name: Remove volumes from Volume Group Idempotency + dellemc.powerstore.volumegroup: + array_ip: "{{ array_ip }}" + validate_certs: "{{ validate_certs }}" + user: "{{ user }}" + password: "{{ password }}" + vg_name: "{{ vg_name }}" + volumes: + - "{{ vol_id_1 }}" + - "{{ vol_2 }}" + vol_state: "absent-in-group" + state: "present" + + - name: Get Volume Group Details by Name + dellemc.powerstore.volumegroup: + array_ip: "{{ array_ip }}" + validate_certs: "{{ validate_certs }}" + user: "{{ user }}" + password: "{{ password }}" + vg_name: "{{ vg_name }}" + state: "present" + register: vg_result + + - name: Get Volume Group Details by id + dellemc.powerstore.volumegroup: + array_ip: "{{ array_ip }}" + validate_certs: "{{ validate_certs }}" + user: "{{ user }}" + password: "{{ password }}" + vg_id: "{{ vg_id }}" + state: "present" + + - name: Delete Volume Group + dellemc.powerstore.volumegroup: + array_ip: "{{ array_ip }}" + validate_certs: "{{ validate_certs }}" + user: "{{ user }}" + password: "{{ password }}" + vg_name: "{{ vg_name }}" + state: "absent" + + - name: Delete Volume Group Idempotency test + dellemc.powerstore.volumegroup: + array_ip: "{{ array_ip }}" + validate_certs: "{{ validate_certs }}" + user: "{{ user }}" + password: "{{ password }}" + vg_name: "{{ vg_name }}" + state: "absent" + + - name: Clone a VolumeGroup + dellemc.powerstore.volumegroup: + array_ip: "{{ array_ip }}" + validate_certs: "{{ validate_certs }}" + user: "{{ user }}" + password: "{{ password }}" + vg_name: "ansible_vg" + vg_clone: + name: "ansible_vg_clone1" + state: "present" + + - name: Restore a VolumeGroup + dellemc.powerstore.volumegroup: + array_ip: "{{ array_ip }}" + validate_certs: "{{ validate_certs }}" + user: "{{ user }}" + password: "{{ password }}" + vg_name: "ansible_vg" + source_snap: "test1" + create_backup_snap: true + backup_snap_profile: + name: "test13" + expiration_timestamp: '2022-08-13T11:50:20Z' + state: "present" + + - name: Refresh a VolumeGroup + dellemc.powerstore.volumegroup: + array_ip: "{{ array_ip }}" + validate_certs: "{{ validate_certs }}" + user: "{{ user }}" + password: "{{ password }}" + vg_name: "ansible_vg" + source_vg: "ansible_vg_clone" + create_backup_snap: true + backup_snap_profile: + name: "test" + state: "present" diff --git a/plugins/doc_fragments/powerstore.py b/plugins/doc_fragments/powerstore.py index 9970763..a3bc726 100644 --- a/plugins/doc_fragments/powerstore.py +++ b/plugins/doc_fragments/powerstore.py @@ -1,5 +1,5 @@ -# -*- coding: utf-8 -*- # Copyright: (c) 2019, Dell Technologies. +# Apache License version 2.0 (see MODULE-LICENSE or http://www.apache.org/licenses/LICENSE-2.0.txt) from __future__ import absolute_import, division, print_function __metaclass__ = type @@ -13,29 +13,30 @@ class ModuleDocFragment(object): description: - IP or FQDN of the PowerStore management system. type: str - required: True - verifycert: + required: true + validate_certs: description: - Boolean variable to specify whether to validate SSL certificate or not. - - True - indicates that the SSL certificate should be + - C(true) - indicates that the SSL certificate should be verified. Set the environment variable REQUESTS_CA_BUNDLE to the path of the SSL certificate. - - False - indicates that the SSL certificate should not be + - C(false) - indicates that the SSL certificate should not be verified. type: bool - required: True - choices: [True, False] + default: true + aliases: + - verifycert user: description: - The username of the PowerStore host. type: str - required: True + required: true password: description: - The password of the PowerStore host. type: str - required: True + required: true timeout: description: - Time after which the connection will get terminated. @@ -47,9 +48,11 @@ class ModuleDocFragment(object): - Port number for the PowerStore array. - If not passed, it will take 443 as default. type: int - requirements: - - A Dell PowerStore Storage System. Ansible 2.12, 2.13 or 2.14 + - A Dell PowerStore storage system version 3.0.0.0 or later. + - Ansible-core 2.13 or later. + - PyPowerStore 2.0.0. + - Python 3.9, 3.10 or 3.11. notes: - The modules present in this collection named as 'dellemc.powerstore' are built to support the Dell PowerStore storage platform. diff --git a/plugins/module_utils/storage/dell/utils.py b/plugins/module_utils/storage/dell/utils.py index d1da3ec..2912361 100644 --- a/plugins/module_utils/storage/dell/utils.py +++ b/plugins/module_utils/storage/dell/utils.py @@ -22,7 +22,6 @@ ''' try: from pkg_resources import parse_version - import pkg_resources PKG_RSRC_IMPORTED = True except ImportError: PKG_RSRC_IMPORTED = False @@ -57,11 +56,11 @@ def has_pyu4ps_sdk(): def py4ps_version_check(): try: - supported_version = False, + supported_version = False if not PKG_RSRC_IMPORTED: - unsupported_version_message = "Unable to import " \ - "'pkg_resources', please install" \ - " the required package" + unsupported_version_message = "Unable to import 'pkg_resources'," \ + " please install the required" \ + " package" else: min_ver = '1.9.0' curr_version = PyPowerStore.__version__ @@ -98,18 +97,19 @@ def get_powerstore_management_host_parameters(): array_ip=dict(type='str', required=True), port=dict(type='int', required=False), timeout=dict(type='int', required=False, default=120), - verifycert=dict(type='bool', required=True, choices=[True, False]) + validate_certs=dict(type='bool', required=False, + aliases=['verifycert'], default=True) ) def get_powerstore_connection(module_params, application_type=None, enable_log=False): if HAS_Py4PS: - conn = PyPowerStore.powerstore_conn.PowerStoreConn( + conn = powerstore_conn.PowerStoreConn( server_ip=module_params['array_ip'], username=module_params['user'], password=module_params['password'], - verify=module_params['verifycert'], + verify=module_params['validate_certs'], timeout=module_params['timeout'], application_type=application_type, port_no=module_params['port'], @@ -147,6 +147,7 @@ def get_logger(module_name, log_file_name='ansible_powerstore.log', log_devel=lo MB_IN_BYTES = 1024 * 1024 GB_IN_BYTES = 1024 * 1024 * 1024 TB_IN_BYTES = 1024 * 1024 * 1024 * 1024 +PB_IN_BYTES = 1024 * 1024 * 1024 * 1024 * 1024 def get_size_bytes(size, cap_units): @@ -159,6 +160,8 @@ def get_size_bytes(size, cap_units): return size * GB_IN_BYTES elif cap_units in ('tb', 'TB'): return size * TB_IN_BYTES + elif cap_units in ('Pb', 'PB'): + return size * PB_IN_BYTES else: return size else: diff --git a/plugins/modules/certificate.py b/plugins/modules/certificate.py index eca61a0..3d2f105 100644 --- a/plugins/modules/certificate.py +++ b/plugins/modules/certificate.py @@ -13,7 +13,7 @@ version_added: '1.4.0' short_description: Certificate operations for PowerStore Storage System description: -- Supports the provisioning operations on a Certificate such as add/import, modify, +- Supports the provisioning operations on a certificate such as add/import, modify, reset, exchange and get the details of a certificate. extends_documentation_fragment: @@ -41,7 +41,7 @@ type: str scope: description: - - Defines a subset of certificates belonging to one Service. + - Defines a subset of certificates belonging to one service. type: str certificate: description: @@ -73,15 +73,15 @@ description: - Define whether the certificate should exist or not. choices: ['absent', 'present'] - required: True + required: true type: str notes: - Idempotency is not supported for adding/importing certificates, exchange of certificates and the reset of certificates. -- Only is_current parameter is supported for modification of certificate. +- Only I(is_current) parameter is supported for modification of certificate. - Reset operation can reset more than one certificate at a time. - Add/import, modify and reset are supported for PowerStore versions 2.0 and above only. -- The check_mode is not supported. +- The I(check_mode) is not supported. ''' EXAMPLES = r''' @@ -90,7 +90,7 @@ array_ip: "{{array_ip}}" user: "{{user}}" password: "{{password}}" - verifycert: "{{verifycert}}" + validate_certs: "{{validate_certs}}" certificate_id: "e940144f-393f-4e9c-8f54-9a4d57b38c48" state: "present" @@ -99,7 +99,7 @@ array_ip: "{{array_ip}}" user: "{{user}}" password: "{{password}}" - verifycert: "{{verifycert}}" + validate_certs: "{{validate_certs}}" service: "VASA_HTTP" state: "present" @@ -108,7 +108,7 @@ array_ip: "{{array_ip}}" user: "{{user}}" password: "{{password}}" - verifycert: "{{verifycert}}" + validate_certs: "{{validate_certs}}" service: "Replication_HTTP" remote_address: "{{remote_array_ip}}" remote_port: 443 @@ -121,11 +121,11 @@ array_ip: "{{array_ip}}" user: "{{user}}" password: "{{password}}" - verifycert: "{{verifycert}}" + validate_certs: "{{validate_certs}}" certificate_type: "CA_Client_Validation" service: "VASA_HTTP" certificate: "{{certificate_string}}" - is_current: True + is_current: true state: "present" - name: Modify certificate @@ -133,9 +133,9 @@ array_ip: "{{array_ip}}" user: "{{user}}" password: "{{password}}" - verifycert: "{{verifycert}}" + validate_certs: "{{validate_certs}}" certificate_id: "37b76535-612b-456a-a694-1389f17632c7" - is_current: True + is_current: true state: "present" ''' @@ -262,7 +262,7 @@ VERSION_ERROR = py4ps_version['unsupported_version_message'] # Application type -APPLICATION_TYPE = 'Ansible/1.9.0' +APPLICATION_TYPE = 'Ansible/2.0.0' class PowerStoreCertificate(object): diff --git a/plugins/modules/cluster.py b/plugins/modules/cluster.py index a0c07a0..f6b1657 100644 --- a/plugins/modules/cluster.py +++ b/plugins/modules/cluster.py @@ -51,20 +51,20 @@ appliance_id: description: - ID of the appliance. - - Parameters appliance_id and appliance_name are mutually exclusive. - - Parameter is_ssh_enabled has to be passed along with appliance_id. + - Parameters I(appliance_id) and I(appliance_name) are mutually exclusive. + - Parameter I(is_ssh_enabled) has to be passed along with I(appliance_id). type: str appliance_name: description: - Name of the appliance. - - Parameters appliance_id and appliance_name are mutually exclusive. - - Parameter is_ssh_enabled has to be passed along with appliance_name. + - Parameters I(appliance_id) and I(appliance_name) are mutually exclusive. + - Parameter I(is_ssh_enabled) has to be passed along with I(appliance_name). type: str is_ssh_enabled: description: - Whether SSH access is enabled for the cluster. - - Either appliance_id or appliance_name is to be passed along with - is_ssh_enabled. + - Either I(appliance_id) or I(appliance_name) is to be passed along with + I(is_ssh_enabled). type: bool physical_mtu: description: @@ -75,7 +75,6 @@ description: - Whether to ignore the network warning about unreachable external network. type: bool - required: false appliances: description: - Appliance configuration setting during cluster creation. @@ -87,7 +86,7 @@ description: - The unique IPv4 address of the appliance and is set by zeroconf. type: str - required: True + required: true name: description: - Name of new appliance. @@ -121,18 +120,18 @@ description: - Name of the physical switch. type: str - required: True + required: true purpose: description: - Specifies the purpose of the physical switch. type: str - required: True + required: true choices: ['Data_and_Management', 'Management_Only'] connections: description: - specifies the supported connection for the physical switch. type: list - required: True + required: true elements: dict suboptions: address: @@ -140,7 +139,7 @@ - Specifies the physical switch address in IPv4 or DNS hostname format. type: str - required: True + required: true port: description: - Specifies the port used for connection to switch. @@ -149,7 +148,7 @@ description: - Specifies the connection method type for the physical Switch. type: str - required: True + required: true choices: ['SSH', 'SNMPv2c'] username: description: @@ -162,7 +161,7 @@ type: str snmp_community_string: description: - - Specifies SNMPv2 community string, if SNMPv2 connect method is + - Specifies C(SNMPv2) community string, if C(SNMPv2) connect method is selected. type: str networks: @@ -176,7 +175,7 @@ description: - Specifies the type of the network. type: str - required: True + required: true choices: ['Management', 'Intra_Cluster_Management', 'Intra_Cluster_Data', 'Storage', 'VMotion', 'File_Mobility'] vlan_id: @@ -187,7 +186,7 @@ description: - Network prefix length. type: int - required: True + required: true gateway: description: - Network gateway in IPv4 format. @@ -206,7 +205,7 @@ - IP addresses in IPv4 format. type: list elements: str - required: True + required: true purposes: description: - Purpose of the network. @@ -227,36 +226,36 @@ description: - IP address of vCenter in IPv4 or hostname format. type: str - required: True + required: true username: description: - User name to login to vCenter. type: str - required: True + required: true password: description: - Password to login to vCenter. type: str - required: True + required: true is_verify_server_cert: description: - Whether or not the connection will be secured with the vcenter SSL certificate. type: bool - required: True + required: true data_center_name: description: - Name of the data center. - This is used to join an existing datacenter in vcenter. - This should be specified when creating PowerStore X cluster. - - Mutually exclusive with data_center_id. + - Mutually exclusive with I(data_center_id). type: str data_center_id: description: - The VMWare ID of datacenter. - This is used to join an existing datacenter in vcenter. - This should be specified when creating PowerStore X cluster. - - Mutually exclusive with data_center_name. + - Mutually exclusive with I(data_center_name). type: str esx_cluster_name: description: @@ -268,20 +267,20 @@ - Storage system credentials for vCenter to use for communicating with the storage system using VASA. type: dict - required: True + required: true suboptions: username: description: - Username of the local user account which will be used by vSphere to register VASA provider. type: str - required: True + required: true password: description: - Password of the local user account which will be used by vSphere to register VASA provider. type: str - required: True + required: true is_http_redirect_enabled: description: - Whether to redirect the HTTP requests to HTTPS. @@ -289,37 +288,37 @@ validate_create: description: - Whether to perform create cluster validate call. - default: True + default: true type: bool wait_for_completion: description: - Flag to indicate if the operation should be run synchronously or asynchronously. - - True signifies synchronous execution. By default, create cluster + - C(true) signifies synchronous execution. By default, create cluster operation will run asynchronously. - default: False + default: false type: bool state: description: - Define whether the cluster should exist or not. - - Value present indicates that the cluster should exist on the system. - - Value absent indicates that the cluster should not exist on the system. + - Value C(present) indicates that the cluster should exist on the system. + - Value C(absent) indicates that the cluster should not exist on the system. type: str required: true choices: ['absent', 'present'] notes: - Deletion of a cluster is not supported by ansible module. -- The check_mode is not supported. +- The I(check_mode) is not supported. - Before performing create operation, the default password for admin user and service user should be changed. - For management type network during cluster creation, - storage_discovery_address and purposes should not be passed. -- The vcenters parameter is mandatory for PowerStore X cluster creation. + I(storage_discovery_address) and purposes should not be passed. +- The I(vcenters) parameter is mandatory for PowerStore X cluster creation. - Minimum 3 and 5 addresses are required for management network for PowerStore T and X model respectively. -- The File_Mobility purpose is supported only in FootHills Prime and above. -- Parameter is_http_redirect_enabled is supported only in PowerStore FootHills +- The C(File_Mobility) purpose is supported only in FootHills Prime and above. +- Parameter I(is_http_redirect_enabled) is supported only in PowerStore FootHills Prime and above. ''' @@ -327,7 +326,7 @@ - name: Get the details of cluster using id dellemc.powerstore.cluster: array_ip: "{{array_ip}}" - verifycert: "{{verifycert}}" + validate_certs: "{{validate_certs}}" user: "{{user}}" password: "{{password}}" cluster_id: "0" @@ -336,12 +335,12 @@ - name: Modify details of cluster using the name dellemc.powerstore.cluster: array_ip: "{{array_ip}}" - verifycert: "{{verifycert}}" + validate_certs: "{{validate_certs}}" user: "{{user}}" password: "{{password}}" cluster_name: "RT-D1320" appliance_id: "A1" - is_ssh_enabled: True + is_ssh_enabled: true service_password: "S@mple_password" chap_mode: "Disabled" new_name: "new_RT-D1320" @@ -350,11 +349,11 @@ - name: Validate create cluster dellemc.powerstore.cluster: array_ip: "{{array_ip}}" - verifycert: "{{verifycert}}" + validate_certs: "{{validate_certs}}" user: "{{user}}" password: "{{password}}" cluster_name: "RT-D1320" - ignore_network_warnings: True + ignore_network_warnings: true appliances: - link_local_address: "1.2.x.x" name: "Ansible_cluster" @@ -382,18 +381,18 @@ - "3.x.x.x" purpose: - "ISCSI" - is_http_redirect_enabled: True - validate_create: True + is_http_redirect_enabled: true + validate_create: true state: "present" - name: Create cluster dellemc.powerstore.cluster: array_ip: "{{array_ip}}" - verifycert: "{{verifycert}}" + validate_certs: "{{validate_certs}}" user: "{{user}}" password: "{{password}}" cluster_name: "RT-D1320" - ignore_network_warnings: True + ignore_network_warnings: true appliances: - link_local_address: "1.2.x.x" name: "Ansible_cluster" @@ -434,12 +433,12 @@ - address: "1.x.x.x" username: "user" password: "password" - is_verify_server_cert: True + is_verify_server_cert: true vasa_provider_credentials: username: "user" password: "password" - is_http_redirect_enabled: True - wait_for_completion: False + is_http_redirect_enabled: true + wait_for_completion: false state: "present" ''' @@ -581,7 +580,7 @@ description: Whether the service user is built in or not. type: bool appliance_details: - description: Name and Id of the appliance for which is_ssh_enabled + description: Name and Id of the appliance for which I(is_ssh_enabled) parameter is used. type: complex returned: When appliance name or id is passed in the playbook @@ -628,7 +627,7 @@ VERSION_ERROR = py4ps_version['unsupported_version_message'] # Application type -APPLICATION_TYPE = 'Ansible/1.9.0' +APPLICATION_TYPE = 'Ansible/2.0.0' class PowerStoreCluster(object): @@ -1142,7 +1141,7 @@ def perform_module_operation(self): if clusters is not None and clusters[0]['name'] is not None: cluster_details = self.get_cluster_details(cluster_name, cluster_id) - if cluster_details and cluster_name: + if cluster_details and 'id' in cluster_details and cluster_name: cluster_id = cluster_details['id'] # Validate create cluster operation diff --git a/plugins/modules/dns.py b/plugins/modules/dns.py index 0d523e0..95f4f8e 100644 --- a/plugins/modules/dns.py +++ b/plugins/modules/dns.py @@ -23,33 +23,31 @@ dns_id: description: - Unique identifier of the DNS instance. - required: True + required: true type: str dns_addresses: description: - DNS server addresses in IPv4 format. - required: False type: list elements: str dns_address_state: description: - - State of the addresses mentioned in dns_addresses. - required: False + - State of the addresses mentioned in I(dns_addresses). choices: ['present-in-dns', 'absent-in-dns'] type: str state: description: - The state of the DNS instance after the task is performed. - - For get and modify operations it should be set to "present". - required : True + - For get and modify operations it should be set to C(present). + required : true choices: [ 'present', 'absent'] type: str notes: - Minimum 1 and maximum 3 addresses can be associated to a DNS instance. -- Parameters dns_addresses and dns_address_state are required together. +- Parameters I(dns_addresses) and I(dns_address_state) are required together. - Creation and deletion of DNS is not supported. -- The check_mode is not supported. +- The I(check_mode) is not supported. ''' EXAMPLES = r''' @@ -58,7 +56,7 @@ array_ip: "{{array_ip}}" user: "{{user}}" password: "{{password}}" - verifycert: "{{verifycert}}" + validate_certs: "{{validate_certs}}" dns_id: "DNS1" state: "present" @@ -67,7 +65,7 @@ array_ip: "{{array_ip}}" user: "{{user}}" password: "{{password}}" - verifycert: "{{verifycert}}" + validate_certs: "{{validate_certs}}" dns_id: "DNS1" dns_addresses: - "XX.XX.XX.XX" @@ -80,7 +78,7 @@ array_ip: "{{array_ip}}" user: "{{user}}" password: "{{password}}" - verifycert: "{{verifycert}}" + validate_certs: "{{validate_certs}}" dns_id: "DNS1" dns_addresses: - "YY.YY.YY.YY" @@ -129,7 +127,7 @@ VERSION_ERROR = py4ps_version['unsupported_version_message'] # Application type -APPLICATION_TYPE = 'Ansible/1.9.0' +APPLICATION_TYPE = 'Ansible/2.0.0' class PowerstoreDns(object): diff --git a/plugins/modules/email.py b/plugins/modules/email.py index ecad2ee..4d5a7db 100644 --- a/plugins/modules/email.py +++ b/plugins/modules/email.py @@ -25,26 +25,22 @@ email_id: description: - Unique identifier of the destination email address. - - Mutually exclusive with email_address. - required: False + - Mutually exclusive with I(email_address). type: str email_address: description: - Email address to receive notifications. - - Mutually exclusive with email_id. - required: False + - Mutually exclusive with I(email_id). type: str new_address: description: - New email address to receive notifications. - required: False type: str send_test_email: description: - Whether to send the test email to the destination email address. - required: False type: bool - default: False + default: false notify: description: - Whether to send different types of notifications. It contains below @@ -55,35 +51,31 @@ description: - Whether to send notifications for critical alerts. type: bool - required: False major: description: - Whether to send notifications for major alerts. type: bool - required: False minor: description: - Whether to send notifications for minor alerts. type: bool - required: False info: description: - Whether to send notifications for informational alerts. type: bool - required: False state: description: - The state of the destination email address after the task is performed. - - For Delete operation only, it should be set to "absent". + - For Delete operation only, it should be set to C(absent). - For all Create, Modify, Test or Get details operations it should be set - to "present". - required : True + to C(present). + required : true choices: [ 'present', 'absent'] type: str notes: - Idempotency is not supported for Test operation of Email module. -- The check_mode is not supported. +- The I(check_mode) is not supported. ''' EXAMPLES = r''' @@ -92,7 +84,7 @@ array_ip: "{{array_ip}}" user: "{{user}}" password: "{{password}}" - verifycert: "{{verifycert}}" + validate_certs: "{{validate_certs}}" email_id: "780b6220-2d0b-4b9f-a485-4ae7f673bd98" state: "present" @@ -101,7 +93,7 @@ array_ip: "{{array_ip}}" user: "{{user}}" password: "{{password}}" - verifycert: "{{verifycert}}" + validate_certs: "{{validate_certs}}" email_address: "abc@dell.com" state: "present" @@ -110,12 +102,12 @@ array_ip: "{{array_ip}}" user: "{{user}}" password: "{{password}}" - verifycert: "{{verifycert}}" + validate_certs: "{{validate_certs}}" email_address: "abc_xyz@dell.com" notify: - info: True - critical: True - major: False + info: true + critical: true + major: false state: "present" - name: Modify destination email @@ -123,12 +115,12 @@ array_ip: "{{array_ip}}" user: "{{user}}" password: "{{password}}" - verifycert: "{{verifycert}}" + validate_certs: "{{validate_certs}}" email_address: "abc_xyz@dell.com" new_address: "def_pqr@dell.com" notify: - info: False - major: False + info: false + major: false state: "present" - name: Send a test mail to the destination email with email_id @@ -136,9 +128,9 @@ array_ip: "{{array_ip}}" user: "{{user}}" password: "{{password}}" - verifycert: "{{verifycert}}" + validate_certs: "{{validate_certs}}" email_id: "780b6220-2d0b-4b9f-a485-4ae7f673bd98" - send_test_email: True + send_test_email: true state: "present" - name: Delete destination email @@ -146,7 +138,7 @@ array_ip: "{{array_ip}}" user: "{{user}}" password: "{{password}}" - verifycert: "{{verifycert}}" + validate_certs: "{{validate_certs}}" email_address: "def_pqr@dell.com" state: "absent" ''' @@ -213,7 +205,7 @@ VERSION_ERROR = py4ps_version['unsupported_version_message'] # Application type -APPLICATION_TYPE = 'Ansible/1.9.0' +APPLICATION_TYPE = 'Ansible/2.0.0' class PowerstoreEmail(object): diff --git a/plugins/modules/filesystem.py b/plugins/modules/filesystem.py index d9f04ef..d1a6f77 100644 --- a/plugins/modules/filesystem.py +++ b/plugins/modules/filesystem.py @@ -245,7 +245,7 @@ register: result_fs dellemc.powerstore.filesystem: array_ip: "{{array_ip}}" - verifycert: "{{verifycert}}" + validate_certs: "{{validate_certs}}" user: "{{user}}" password: "{{password}}" filesystem_name: "{{filesystem_name}}" @@ -256,8 +256,8 @@ access_policy: "UNIX" locking_policy: "MANDATORY" smb_properties: - is_smb_no_notify_enabled: True - is_smb_notify_on_access_enabled: True + is_smb_no_notify_enabled: true + is_smb_notify_on_access_enabled: true quota_defaults: grace_period: 1 grace_period_unit: 'days' @@ -265,7 +265,7 @@ default_soft_limit: 2 protection_policy: "{{protection_policy_id}}" config_type: "VMWARE" - is_async_mtime_enabled: True + is_async_mtime_enabled: true file_events_publishing_mode: "NFS_ONLY" host_io_size: "VMWARE_16K" state: "present" @@ -273,20 +273,20 @@ - name: Modify File System by id dellemc.powerstore.filesystem: array_ip: "{{array_ip}}" - verifycert: "{{verifycert}}" + validate_certs: "{{validate_certs}}" user: "{{user}}" password: "{{password}}" filesystem_id: "{{fs_id}}" folder_rename_policy: "ALL_ALLOWED" smb_properties: - is_smb_op_locks_enabled: True + is_smb_op_locks_enabled: true smb_notify_on_change_dir_depth: 3 quota_defaults: grace_period: 2 grace_period_unit: 'weeks' default_hard_limit: 2 default_soft_limit: 1 - is_async_mtime_enabled: True + is_async_mtime_enabled: true file_events_publishing_mode: "ALL" flr_attributes: mode: "Enterprise" @@ -298,7 +298,7 @@ - name: Get File System details by id dellemc.powerstore.filesystem: array_ip: "{{array_ip}}" - verifycert: "{{verifycert}}" + validate_certs: "{{validate_certs}}" user: "{{user}}" password: "{{password}}" filesystem_id: "{{result_fs.filesystem_details.id}}" @@ -307,7 +307,7 @@ - name: Delete File System by id dellemc.powerstore.filesystem: array_ip: "{{array_ip}}" - verifycert: "{{verifycert}}" + validate_certs: "{{validate_certs}}" user: "{{user}}" password: "{{password}}" filesystem_id: "{{result_fs.filesystem_details.id}}" @@ -552,7 +552,7 @@ VERSION_ERROR = py4ps_version['unsupported_version_message'] # Application type -APPLICATION_TYPE = 'Ansible/1.9.0' +APPLICATION_TYPE = 'Ansible/2.0.0' class PowerStoreFileSystem(object): diff --git a/plugins/modules/filesystem_snapshot.py b/plugins/modules/filesystem_snapshot.py index ccfe050..387087d 100644 --- a/plugins/modules/filesystem_snapshot.py +++ b/plugins/modules/filesystem_snapshot.py @@ -36,7 +36,7 @@ filesystem: description: - The ID/Name of the filesystem for which snapshot will be taken. - - If filesystem name is specified, then nas_server is required to uniquely + - If filesystem name is specified, then I(nas_server) is required to uniquely identify the filesystem. - Mandatory for create operation. type: str @@ -51,7 +51,7 @@ desired_retention: description: - The retention value for the Snapshot. - - If the desired_retention/expiration_timestamp is not mentioned during + - If the I(desired_retention)/I(expiration_timestamp) is not mentioned during creation, snapshot will be created with unlimited retention. - Maximum supported desired retention is 31 days. type: int @@ -71,8 +71,8 @@ description: - Specifies whether the snapshot directory or protocol access is granted to the filesystem snapshot. - - For create operation, if access_type is not specified, snapshot will be - created with 'SNAPSHOT' access type. + - For create operation, if I(access_type) is not specified, snapshot will be + created with C(SNAPSHOT) access type. choices: ['SNAPSHOT', 'PROTOCOL'] type: str state: @@ -82,14 +82,14 @@ choices: ['absent', 'present'] type: str notes: -- The check_mode is not supported. +- The I(check_mode) is not supported. """ EXAMPLES = r""" - name: Create filesystem snapshot dellemc.powerstore.filesystem_snapshot: array_ip: "{{array_ip}}" - verifycert: "{{verifycert}}" + validate_certs: "{{validate_certs}}" user: "{{user}}" password: "{{password}}" snapshot_name: "sample_filesystem_snapshot" @@ -102,7 +102,7 @@ - name: Get the details of filesystem snapshot dellemc.powerstore.filesystem_snapshot: array_ip: "{{array_ip}}" - verifycert: "{{verifycert}}" + validate_certs: "{{validate_certs}}" user: "{{user}}" password: "{{password}}" snapshot_id: "{{fs_snapshot_id}}" @@ -111,7 +111,7 @@ - name: Modify the filesystem snapshot dellemc.powerstore.filesystem_snapshot: array_ip: "{{array_ip}}" - verifycert: "{{verifycert}}" + validate_certs: "{{validate_certs}}" user: "{{user}}" password: "{{password}}" snapshot_name: "sample_filesystem_snapshot" @@ -123,7 +123,7 @@ - name: Delete filesystem snapshot dellemc.powerstore.filesystem_snapshot: array_ip: "{{array_ip}}" - verifycert: "{{verifycert}}" + validate_certs: "{{validate_certs}}" user: "{{user}}" password: "{{password}}" snapshot_id: "{{fs_snapshot_id}}" @@ -253,7 +253,7 @@ VERSION_ERROR = py4ps_version['unsupported_version_message'] # Application type -APPLICATION_TYPE = 'Ansible/1.9.0' +APPLICATION_TYPE = 'Ansible/2.0.0' class PowerStoreFilesystemSnapshot(object): diff --git a/plugins/modules/host.py b/plugins/modules/host.py index 6819d17..3ea4042 100644 --- a/plugins/modules/host.py +++ b/plugins/modules/host.py @@ -26,16 +26,15 @@ characters. - Creation of an empty host is not allowed. - Required when creating a host. - - Use either host_id or host_name for modify and delete tasks. + - Use either I(host_id) or I(host_name) for modify and delete tasks. type: str host_id: description: - The 36 character long host id automatically generated when a host is created. - - Use either host_id or host_name for modify and delete tasks. - - The host_id cannot be used while creating host, as it is generated by + - Use either I(host_id) or I(host_name) for modify and delete tasks. + - The I(host_id) cannot be used while creating host, as it is generated by the array after creation of host. - required: False type: str os_type: description: @@ -51,20 +50,20 @@ - Subordinate initiators in a host can only be of one type, either FC or iSCSI. - Required when creating a host. - - It is mutually exclusive with detailed_initiators. + - It is mutually exclusive with I(detailed_initiators). type: list elements: str detailed_initiators: description: - Initiator properties. - - It is mutually exclusive with initiators. + - It is mutually exclusive with I(initiators). type: list elements: dict suboptions: port_name: description: - Name of port type. - - The port_name is mandatory key. + - The I(port_name) is mandatory key. type: str required: true port_type: @@ -103,17 +102,17 @@ state: description: - Define whether the host should exist or not. - - Value present - indicates that the host should exist in system. - - Value absent - indicates that the host should not exist in system. + - Value C(present) - indicates that the host should exist in system. + - Value C(absent) - indicates that the host should not exist in system. required: true choices: ['absent', 'present'] type: str initiator_state: description: - Define whether the initiators should be present or absent in host. - - Value present-in-host - indicates that the initiators should exist on + - Value C(present-in-host) - indicates that the initiators should exist on host. - - Value absent-in-host - indicates that the initiators should not exist on + - Value C(absent-in-host) - indicates that the initiators should not exist on host. - Required when creating a host with initiators or adding/removing initiators to/from existing host. @@ -134,22 +133,21 @@ choices: ['Local_Only', 'Metro_Optimize_Both', 'Metro_Optimize_Local', 'Metro_Optimize_Remote'] type: str - required: False notes: - Only completely and correctly configured iSCSI initiators can be associated with a host. -- The parameters initiators and detailed_initiators are mutually exclusive. +- The parameters I(initiators) and I(detailed_initiators) are mutually exclusive. - For mutual CHAP authentication, single CHAP credentials are mandatory. -- Support of NVMe type of initiators is for PowerStore 2.0 and beyond. -- The host_connectivity is supported only in PowerStore 3.0.0.0 and above. -- The check_mode is not supported. +- Support of C(NVMe) type of initiators is for PowerStore 2.0 and beyond. +- The I(host_connectivity) is supported only in PowerStore 3.0.0.0 and above. +- The I(check_mode) is not supported. ''' EXAMPLES = r''' - name: Create host with FC initiator dellemc.powerstore.host: array_ip: "{{array_ip}}" - verifycert: "{{verifycert}}" + validate_certs: "{{validate_certs}}" user: "{{user}}" password: "{{password}}" host_name: "ansible-test-host-1" @@ -163,7 +161,7 @@ - name: Create host with iSCSI initiator and its details dellemc.powerstore.host: array_ip: "{{array_ip}}" - verifycert: "{{verifycert}}" + validate_certs: "{{validate_certs}}" user: "{{user}}" password: "{{password}}" host_name: "ansible-test-host-2" @@ -183,7 +181,7 @@ - name: Get host details by id dellemc.powerstore.host: array_ip: "{{array_ip}}" - verifycert: "{{verifycert}}" + validate_certs: "{{validate_certs}}" user: "{{user}}" password: "{{password}}" host_id: "5c1e869b-ed8a-4845-abae-b102bc249d41" @@ -192,7 +190,7 @@ - name: Add initiators to host by name dellemc.powerstore.host: array_ip: "{{array_ip}}" - verifycert: "{{verifycert}}" + validate_certs: "{{validate_certs}}" user: "{{user}}" password: "{{password}}" host_name: "ansible-test-host-1" @@ -204,7 +202,7 @@ - name: Add initiators to host by id dellemc.powerstore.host: array_ip: "{{array_ip}}" - verifycert: "{{verifycert}}" + validate_certs: "{{validate_certs}}" user: "{{user}}" password: "{{password}}" host_id: "5c1e869b-ed8a-4845-abae-b102bc249d41" @@ -219,7 +217,7 @@ - name: Remove initiators from by id dellemc.powerstore.host: array_ip: "{{array_ip}}" - verifycert: "{{verifycert}}" + validate_certs: "{{validate_certs}}" user: "{{user}}" password: "{{password}}" host_id: "8c1e869b-fe8a-4845-hiae-h802bc249d41" @@ -231,7 +229,7 @@ - name: Modify host by name dellemc.powerstore.host: array_ip: "{{array_ip}}" - verifycert: "{{verifycert}}" + validate_certs: "{{validate_certs}}" user: "{{user}}" password: "{{password}}" host_name: "ansible-test-host-1" @@ -242,7 +240,7 @@ - name: Delete host dellemc.powerstore.host: array_ip: "{{array_ip}}" - verifycert: "{{verifycert}}" + validate_certs: "{{validate_certs}}" user: "{{user}}" password: "{{password}}" host_name: "ansible-test-host-1-new" @@ -302,7 +300,7 @@ type: str mapped_hosts: description: This is the inverse of the resource type - host_volume_mapping association. + I(host_volume_mapping) association. type: complex contains: id: @@ -375,7 +373,7 @@ VERSION_ERROR = py4ps_version['unsupported_version_message'] # Application type -APPLICATION_TYPE = 'Ansible/1.9.0' +APPLICATION_TYPE = 'Ansible/2.0.0' # DO NOT CHANGE BELOW PORT_TYPES SEQUENCE AS ITS USED IN SCRIPT USING INDEX PORT_TYPES = ["iSCSI", "FC", "NVMe"] diff --git a/plugins/modules/hostgroup.py b/plugins/modules/hostgroup.py index bc0f379..bf85f60 100644 --- a/plugins/modules/hostgroup.py +++ b/plugins/modules/hostgroup.py @@ -28,14 +28,14 @@ Unicode characters. - Creation of an empty host group is not allowed. - Required when creating a host group. - - Use either hostgroup_id or hostgroup_name for modify and delete tasks. + - Use either I(hostgroup_id) or I(hostgroup_name) for modify and delete tasks. type: str hostgroup_id: description: - The 36-character long host group id, automatically generated when a host group is created. - - Use either hostgroup_id or hostgroup_name for modify and delete tasks. - - The hostgroup_id cannot be used while creating host group, as it is + - Use either I(hostgroup_id) or I(hostgroup_name) for modify and delete tasks. + - The I(hostgroup_id) cannot be used while creating host group, as it is generated by the array after creation of host group. type: str hosts: @@ -50,21 +50,21 @@ state: description: - Define whether the host group should exist or not. - - Value present - indicates that the host group should exist on the + - Value C(present) - indicates that the host group should exist on the system. - - Value absent - indicates that the host group should not exist on the + - Value C(absent) - indicates that the host group should not exist on the system. - Deletion of a host group results in deletion of the containing hosts as well. Remove hosts from the host group first to retain them. - required: True + required: true choices: [absent, present] type: str host_state: description: - Define whether the hosts should be present or absent in host group. - - Value present-in-group - indicates that the hosts should exist on the + - Value C(present-in-group) - indicates that the hosts should exist on the host group. - - Value absent-in-group - indicates that the hosts should not exist on the + - Value C(absent-in-group) - indicates that the hosts should not exist on the host group. - Required when creating a host group with hosts or adding/removing hosts from existing host group. @@ -84,11 +84,10 @@ choices: ['Local_Only', 'Metro_Optimize_Both', 'Metro_Optimize_Local', 'Metro_Optimize_Remote'] type: str - required: False notes: -- The check_mode is not supported. -- The host_connectivity is supported only PowerStore 3.0.0.0 and above. +- The I(check_mode) is not supported. +- The I(host_connectivity) is supported only PowerStore 3.0.0.0 and above. ''' @@ -96,7 +95,7 @@ - name: Create host group with hosts dellemc.powerstore.hostgroup: array_ip: "{{array_ip}}" - verifycert: "{{verifycert}}" + validate_certs: "{{validate_certs}}" user: "{{user}}" password: "{{password}}" hostgroup_name: "{{hostgroup_name}}" @@ -109,7 +108,7 @@ - name: Get host group details using ID dellemc.powerstore.hostgroup: array_ip: "{{array_ip}}" - verifycert: "{{verifycert}}" + validate_certs: "{{validate_certs}}" user: "{{user}}" password: "{{password}}" hostgroup_id: "{{host group_id}}" @@ -118,7 +117,7 @@ - name: Add hosts to host group dellemc.powerstore.hostgroup: array_ip: "{{array_ip}}" - verifycert: "{{verifycert}}" + validate_certs: "{{validate_certs}}" user: "{{user}}" password: "{{password}}" hostgroup_name: "{{hostgroup_name}}" @@ -130,7 +129,7 @@ - name: Remove hosts from host group dellemc.powerstore.hostgroup: array_ip: "{{array_ip}}" - verifycert: "{{verifycert}}" + validate_certs: "{{validate_certs}}" user: "{{user}}" password: "{{password}}" hostgroup_name: "{{hostgroup_name}}" @@ -142,7 +141,7 @@ - name: Modify host group dellemc.powerstore.hostgroup: array_ip: "{{array_ip}}" - verifycert: "{{verifycert}}" + validate_certs: "{{validate_certs}}" user: "{{user}}" password: "{{password}}" hostgroup_name: "{{hostgroup_name}}" @@ -153,7 +152,7 @@ - name: Delete host group dellemc.powerstore.hostgroup: array_ip: "{{array_ip}}" - verifycert: "{{verifycert}}" + validate_certs: "{{validate_certs}}" user: "{{user}}" password: "{{password}}" hostgroup_name: "{{hostgroup_name}}" @@ -225,7 +224,7 @@ VERSION_ERROR = py4ps_version['unsupported_version_message'] # Application type -APPLICATION_TYPE = 'Ansible/1.9.0' +APPLICATION_TYPE = 'Ansible/2.0.0' class PowerStoreHostgroup(object): diff --git a/plugins/modules/info.py b/plugins/modules/info.py index c9408b8..827d156 100644 --- a/plugins/modules/info.py +++ b/plugins/modules/info.py @@ -19,8 +19,8 @@ host groups, snapshot rules, and protection policies. - File provisioning module includes NAS servers, NFS exports, SMB shares, tree quotas, user quotas, and file systems. -- Replication module includes replication rules, replication sessions, and - remote system. +- Replication module includes replication rules, replication sessions, + replication groups, and remote system. - Virtualization module includes vCenters and virtual volumes. - Configuration module includes cluster nodes, networks, roles, local users, appliances, security configs, certificates, AD/LDAP servers, LDAP accounts, @@ -40,41 +40,43 @@ description: - A list of string variables which specify the PowerStore system entities requiring information. - - Volumes - vol. - - All the nodes - node. - - Volume groups - vg. - - Protection policies - protection_policy. - - Hosts - host. - - Host groups - hg. - - Snapshot rules - snapshot_rule. - - NAS servers - nas_server. - - NFS exports - nfs_export. - - SMB shares - smb_share. - - Tree quotas - tree_quota. - - User quotas - user_quota. - - File systems - file_system. - - Replication rules - replication_rule. - - Replication sessions - replication_session. - - Remote systems - remote_system. - - Various networks - network. - - Roles - role. - - Local users - user. - - Appliances - appliance. - - Security configurations - security_config. - - Certificates - certificate. - - Active directories - ad. - - LDAPs - ldap. - - DNS servers - dns. - - NTP servers - ntp. - - Email notification destinations - email_notification. - - SMTP configurations - smtp_config. - - Remote Support - remote_support. - - Remote support contacts - remote_support_contact. - - LDAP accounts - ldap_account. - - LDAP domain - ldap_domain. - - All vCenters - vcenter. - - Virtual volumes - virtual_volume. - required: True + - Volumes - C(vol). + - All the nodes - C(node). + - Volume groups - C(vg). + - Protection policies - C(protection_policy). + - Hosts - C(host). + - Host groups - C(hg). + - Snapshot rules - C(snapshot_rule). + - NAS servers - C(nas_server). + - NFS exports - C(nfs_export). + - SMB shares - C(smb_share). + - Tree quotas - C(tree_quota). + - User quotas - C(user_quota). + - File systems - C(file_system). + - Replication rules - C(replication_rule). + - Replication sessions - C(replication_session). + - Remote systems - C(remote_system). + - Various networks - C(network). + - Roles - C(role). + - Local users - C(user). + - Appliances - C(appliance). + - Security configurations - C(security_config). + - Certificates - C(certificate). + - Active directories - C(ad). + - LDAPs - C(ldap). + - DNS servers - C(dns). + - NTP servers - C(ntp). + - Email notification destinations - C(email_notification). + - SMTP configurations - C(smtp_config). + - Remote Support - C(remote_support). + - Remote support contacts - C(remote_support_contact). + - LDAP accounts - C(ldap_account). + - LDAP domain - C(ldap_domain). + - All vCenters - C(vcenter). + - Virtual volumes - C(virtual_volume). + - Storage containers - C(storage_container). + - Replication groups - C(replication_group). + required: true elements: str choices: [vol, vg, host, hg, node, protection_policy, snapshot_rule, nas_server, nfs_export, smb_share, tree_quota, user_quota, @@ -82,14 +84,14 @@ remote_system, network, role, ldap_account, user, appliance, ad, ldap, security_config, certificate, dns, ntp, smtp_config, email_notification, remote_support, remote_support_contact, - ldap_domain, vcenter, virtual_volume] + ldap_domain, vcenter, virtual_volume, storage_container, + replication_group] type: list filters: description: - A list of filters to support filtered output for storage entities. - - Each filter is a list of filter_key, filter_operator, filter_value. + - Each filter is a list of I(filter_key), I(filter_operator), I(filter_value). - Supports passing of multiple filters. - required: False type: list elements: dict suboptions: @@ -97,31 +99,31 @@ description: - Name identifier of the filter. type: str - required: True + required: true filter_operator: description: - Operation to be performed on the filter key. type: str choices: [equal, greater, lesser, like, notequal] - required: True + required: true filter_value: description: - Value of the filter key. type: str - required: True + required: true all_pages: description: - Indicates whether to return all available entities on the storage system. - - If set to True, the Info module will implement pagination and + - If set to C(true), the Info module will implement pagination and return all entities. Otherwise, a maximum of the first 100 entities of any type will be returned. type: bool - default: False + default: false notes: - Pagination is not supported for role, local user, security configs, LDAP - accounts and LDAP domain. If all_pages is passed, it will be ignored. -- The check_mode is supported. + accounts and LDAP domain. If I(all_pages) is passed, it will be ignored. +- The I(check_mode) is supported. ''' EXAMPLES = r''' @@ -129,7 +131,7 @@ - name: Get list of volumes, volume groups, hosts, host groups and node dellemc.powerstore.info: array_ip: "{{array_ip}}" - verifycert: "{{verifycert}}" + validate_certs: "{{validate_certs}}" user: "{{user}}" password: "{{password}}" gather_subset: @@ -142,7 +144,7 @@ - name: Get list of replication related entities dellemc.powerstore.info: array_ip: "{{array_ip}}" - verifycert: "{{verifycert}}" + validate_certs: "{{validate_certs}}" user: "{{user}}" password: "{{password}}" gather_subset: @@ -153,7 +155,7 @@ - name: Get list of volumes whose state notequal to ready dellemc.powerstore.info: array_ip: "{{array_ip}}" - verifycert: "{{verifycert}}" + validate_certs: "{{validate_certs}}" user: "{{user}}" password: "{{password}}" gather_subset: @@ -166,7 +168,7 @@ - name: Get list of protection policies and snapshot rules dellemc.powerstore.info: array_ip: "{{array_ip}}" - verifycert: "{{verifycert}}" + validate_certs: "{{validate_certs}}" user: "{{user}}" password: "{{password}}" gather_subset: @@ -176,7 +178,7 @@ - name: Get list of snapshot rules whose desired_retention between 101-499 dellemc.powerstore.info: array_ip: "{{array_ip}}" - verifycert: "{{verifycert}}" + validate_certs: "{{validate_certs}}" user: "{{user}}" password: "{{password}}" gather_subset: @@ -192,7 +194,7 @@ - name: Get list of nas server, nfs_export and smb share dellemc.powerstore.info: array_ip: "{{array_ip}}" - verifycert: "{{verifycert}}" + validate_certs: "{{validate_certs}}" user: "{{user}}" password: "{{password}}" gather_subset: @@ -203,7 +205,7 @@ - name: Get list of tree quota, user quota and file system dellemc.powerstore.info: array_ip: "{{array_ip}}" - verifycert: "{{verifycert}}" + validate_certs: "{{validate_certs}}" user: "{{user}}" password: "{{password}}" gather_subset: @@ -214,7 +216,7 @@ - name: Get list of nas server whose name equal to 'nas_server' dellemc.powerstore.info: array_ip: "{{array_ip}}" - verifycert: "{{verifycert}}" + validate_certs: "{{validate_certs}}" user: "{{user}}" password: "{{password}}" gather_subset: @@ -227,7 +229,7 @@ - name: Get list of smb share whose name contains 'share' dellemc.powerstore.info: array_ip: "{{array_ip}}" - verifycert: "{{verifycert}}" + validate_certs: "{{validate_certs}}" user: "{{user}}" password: "{{password}}" gather_subset: @@ -240,7 +242,7 @@ - name: Get list of user, role, network and appliances dellemc.powerstore.info: array_ip: "{{array_ip}}" - verifycert: "{{verifycert}}" + validate_certs: "{{validate_certs}}" user: "{{user}}" password: "{{password}}" gather_subset: @@ -252,7 +254,7 @@ - name: Get list of ad, certificate, security config and ldaps dellemc.powerstore.info: array_ip: "{{array_ip}}" - verifycert: "{{verifycert}}" + validate_certs: "{{validate_certs}}" user: "{{user}}" password: "{{password}}" gather_subset: @@ -264,7 +266,7 @@ - name: Get list of networks whose name contains 'Management' dellemc.powerstore.info: array_ip: "{{array_ip}}" - verifycert: "{{verifycert}}" + validate_certs: "{{validate_certs}}" user: "{{user}}" password: "{{password}}" gather_subset: @@ -277,7 +279,7 @@ - name: Get list of dns, email notification, ntp, remote support, remote support contact and smtp config dellemc.powerstore.info: array_ip: "{{array_ip}}" - verifycert: "{{verifycert}}" + validate_certs: "{{validate_certs}}" user: "{{user}}" password: "{{password}}" gather_subset: @@ -291,7 +293,7 @@ - name: Get list of emails which receives minor notifications dellemc.powerstore.info: array_ip: "{{array_ip}}" - verifycert: "{{verifycert}}" + validate_certs: "{{validate_certs}}" user: "{{user}}" password: "{{password}}" gather_subset: @@ -299,12 +301,12 @@ filters: - filter_key: 'notify_minor' filter_operator: 'equal' - filter_value: 'False' + filter_value: 'false' - name: Get list of LDAP accounts dellemc.powerstore.info: array_ip: "{{array_ip}}" - verifycert: "{{verifycert}}" + validate_certs: "{{validate_certs}}" user: "{{user}}" password: "{{password}}" gather_subset: @@ -313,7 +315,7 @@ - name: Get list of LDAP accounts with type as "User" dellemc.powerstore.info: array_ip: "{{array_ip}}" - verifycert: "{{verifycert}}" + validate_certs: "{{validate_certs}}" user: "{{user}}" password: "{{password}}" gather_subset: @@ -326,7 +328,7 @@ - name: Get list of LDAP domain dellemc.powerstore.info: array_ip: "{{array_ip}}" - verifycert: "{{verifycert}}" + validate_certs: "{{validate_certs}}" user: "{{user}}" password: "{{password}}" gather_subset: @@ -335,7 +337,7 @@ - name: Get list of LDAP domain with protocol as "LDAPS" dellemc.powerstore.info: array_ip: "{{array_ip}}" - verifycert: "{{verifycert}}" + validate_certs: "{{validate_certs}}" user: "{{user}}" password: "{{password}}" gather_subset: @@ -348,7 +350,7 @@ - name: Get list of vCenters dellemc.powerstore.info: array_ip: "{{array_ip}}" - verifycert: "{{verifycert}}" + validate_certs: "{{validate_certs}}" user: "{{user}}" password: "{{password}}" gather_subset: @@ -357,11 +359,21 @@ - name: Get list of virtual volumes dellemc.powerstore.info: array_ip: "{{array_ip}}" - verifycert: "{{verifycert}}" + validate_certs: "{{validate_certs}}" user: "{{user}}" password: "{{password}}" gather_subset: - virtual_volume + - replication_group + +- name: Get list of storage containers + dellemc.powerstore.info: + array_ip: "{{array_ip}}" + validate_certs: "{{validate_certs}}" + user: "{{user}}" + password: "{{password}}" + gather_subset: + - storage_container ''' @@ -380,7 +392,7 @@ ActiveDirectory: description: Provides details of all active directories. type: list - returned: When ad is in a given gather_subset + returned: When C(ad) is in a given I(gather_subset) contains: id: description: ID of the active directory. @@ -393,7 +405,7 @@ Appliance: description: Provides details of all appliances. type: list - returned: When appliance is in a given gather_subset + returned: When C(appliance) is in a given I(gather_subset) contains: id: description: ID of the appliance. @@ -414,7 +426,7 @@ Certificate: description: Provides details of all certificates. type: list - returned: When certificates is in a given gather_subset + returned: When C(certificates) is in a given I(gather_subset) contains: id: description: ID of the certificate. @@ -446,7 +458,7 @@ DNS: description: Provides details of all DNS servers. type: list - returned: When dns is in a given gather_subset + returned: When C(dns) is in a given I(gather_subset) contains: id: description: ID of the DNS server. @@ -460,7 +472,7 @@ EmailNotification: description: Provides details of all emails to which notifications will be sent. type: list - returned: When email_notification is in a given gather_subset + returned: When C(email_notification) is in a given I(gather_subset) contains: id: description: ID of the email. @@ -479,7 +491,7 @@ FileSystems: description: Provides details of all filesystems. type: list - returned: When file_system is in a given gather_subset + returned: When C(file_system) is in a given I(gather_subset) contains: id: description: ID of the filesystem. @@ -496,7 +508,7 @@ HostGroups: description: Provides details of all host groups. type: list - returned: When hg is in a given gather_subset + returned: When C(hg) is in a given I(gather_subset) contains: id: description: ID of the host group. @@ -513,7 +525,7 @@ Hosts: description: Provides details of all hosts. type: list - returned: When host is in a given gather_subset + returned: When C(host) is in a given I(gather_subset) contains: id: description: ID of the host. @@ -530,7 +542,7 @@ LDAP: description: Provides details of all LDAPs. type: list - returned: When ldap is in a given gather_subset + returned: When C(ldap) is in a given I(gather_subset) contains: id: description: ID of the LDAP. @@ -543,7 +555,7 @@ LDAPAccounts: description: Provides details of all LDAP accounts. type: list - returned: When LDAP account is in a given gather_subset + returned: When C(ldap_account) is in a given I(gather_subset) contains: id: description: ID of the LDAP account. @@ -577,7 +589,7 @@ LDAPDomain: description: Provides details of the LDAP domain configurations. type: list - returned: When LDAP domain configuration is in a given gather_subset + returned: When C(ldap_domain) configuration is in a given I(gather_subset) contains: id: description: Unique identifier of the new LDAP server configuration. @@ -604,7 +616,7 @@ description: Timeout for establishing a connection to an LDAP server. Default value is 30000 (30 seconds). type: int is_global_catalog: - description: Whether or not the catalog is global. Default value is false. + description: Whether or not the catalog is global. Default value is C(false). type: bool user_id_attribute: description: Name of the LDAP attribute whose value indicates the unique identifier of the user. @@ -664,7 +676,7 @@ LocalUsers: description: Provides details of all local users. type: list - returned: When user is in a given gather_subset + returned: When C(user) is in a given I(gather_subset) contains: id: description: ID of the user. @@ -681,7 +693,7 @@ NASServers: description: Provides details of all nas servers. type: list - returned: When nas_server is in a given gather_subset + returned: When C(nas_server) is in a given I(gather_subset) contains: id: description: ID of the nas server. @@ -698,7 +710,7 @@ Networks: description: Provides details of all networks. type: list - returned: When network is in a given gather_subset + returned: When C(network) is in a given I(gather_subset) contains: id: description: ID of the network. @@ -715,7 +727,7 @@ NFSExports: description: Provides details of all nfs exports. type: list - returned: When nfs_export is in a given gather_subset + returned: When C(nfs_export) is in a given I(gather_subset) contains: id: description: ID of the nfs export. @@ -732,7 +744,7 @@ Nodes: description: Provides details of all nodes. type: list - returned: When a node is in a given gather_subset + returned: When a C(node) is in a given I(gather_subset) contains: id: description: ID of the node. @@ -749,7 +761,7 @@ NTP: description: Provides details of all NTP servers. type: list - returned: When ntp is in a given gather_subset + returned: When C(ntp) is in a given I(gather_subset) contains: id: description: ID of the NTP server. @@ -763,7 +775,7 @@ ProtectionPolicies: description: Provides details of all protection policies. type: list - returned: When protection_policy is in a given gather_subset + returned: When C(protection_policy) is in a given I(gather_subset) contains: id: description: ID of the protection policy. @@ -780,7 +792,7 @@ RemoteSupport: description: Provides details of all remote support config. type: list - returned: When remote_support is in a given gather_subset + returned: When C(remote_support) is in a given I(gather_subset) contains: id: description: ID of the remote support. @@ -793,7 +805,7 @@ RemoteSupportContact: description: Provides details of all remote support contacts. type: list - returned: When remote_support_contact is in a given gather_subset + returned: When C(remote_support_contact) is in a given I(gather_subset) contains: id: description: ID of the remote support contact. @@ -806,10 +818,53 @@ "id": "1" } ] +ReplicationGroups: + description: Provide details of all replication group. + type: list + returned: when C(replication_group) is in a given I(gather_subset). + contains: + id: + description: ID of the replication group. + type: str + name: + description: Name of the replication group. + type: str + storage_container_id: + description: ID of the storage container. + type: str + description: + description: Description of the replication group. + type: str + creator_type: + description: Creator type of the storage resource. + type: str + creation_timestamp: + description: Timestamp when given replication group was created. + type: str + is_replication_destination: + description: Indicates whether replication group is replication + destination or not. + type: bool + creator_type_l10n: + description: Localized message string corresponding to + creator_type. + type: str + sample: [ + { + "id": "c4ba4ad3-2200-47d4-8f61-ddf51d83aac2", + "storage_container_id": "0b460d65-b8b6-40bf-8578-aa2e2fd3d02a", + "name": "Ansible_RTD8337_VM", + "description": "Ansible_RTD8337_VM", + "creator_type": "User", + "creation_timestamp": "2023-05-16T13:58:09.348368+00:00", + "is_replication_destination": false, + "creator_type_l10n": "User" + } + ] ReplicationRules: description: Provides details of all replication rules. type: list - returned: When replication_rule is in a given gather_subset + returned: When C(replication_rule) is in a given I(gather_subset) contains: id: description: ID of the replication rule. @@ -826,7 +881,7 @@ ReplicationSession: description: Details of all replication sessions. type: list - returned: when replication_session given in gather_subset + returned: when C(replication_session) given in I(gather_subset) contains: id: description: ID of the replication session. @@ -839,7 +894,7 @@ RemoteSystems: description: Provides details of all remote systems. type: list - returned: When remote_system is in a given gather_subset + returned: When C(remote_system) is in a given I(gather_subset) contains: id: description: ID of the remote system. @@ -856,7 +911,7 @@ Roles: description: Provides details of all roles. type: list - returned: When role is in a given gather_subset + returned: When C(role is in a given I(gather_subset contains: id: description: ID of the role. @@ -893,7 +948,7 @@ SecurityConfig: description: Provides details of all security configs. type: list - returned: When security_config is in a given gather_subset + returned: When C(security_config) is in a given I(gather_subset) contains: id: description: ID of the security config. @@ -906,7 +961,7 @@ SMBShares: description: Provides details of all smb shares. type: list - returned: When smb_share is in a given gather_subset + returned: When C(smb_share) is in a given I(gather_subset) contains: id: description: ID of the smb share. @@ -923,7 +978,7 @@ SMTPConfig: description: Provides details of all smtp config. type: list - returned: When smtp_config is in a given gather_subset + returned: When C(smtp_config) is in a given I(gather_subset) contains: id: description: ID of the smtp config. @@ -936,7 +991,7 @@ SnapshotRules: description: Provides details of all snapshot rules. type: list - returned: When snapshot_rule is in a given gather_subset + returned: When C(snapshot_rule) is in a given I(gather_subset) contains: id: description: ID of the snapshot rule. @@ -950,10 +1005,92 @@ "name": "Snapshot Rule Test" } ] +StorageContainers: + description: Provide details of all storage containers. + type: list + returned: When C(storage_container) is in a given I(gather_subset) + contains: + id: + description: ID of the storage container. + type: str + name: + description: Name of the storage container. + type: str + storage_protocol: + description: The type of storage container. + type: str + quota: + description: The total number of bytes that can be + provisioned/reserved against this storage container. + type: int + replication_groups: + description: Properties of a Replication Group. + type: list + contains: + id: + description: Unique identifier of the Replication Group + instance. + type: str + name: + description: Name of the Replication Group. + type: str + virtual_volumes: + description: The virtual volumes associated to the storage container. + type: list + contains: + id: + description: The unique identifier of the virtual volume. + type: str + name: + description: The name of the virtual volume. + type: str + destinations: + description: A storage container destination defines replication + destination for a local storage container on a remote + system. + type: list + contains: + id: + description: The unique id of the storage container + destination. + type: str + remote_system_id: + description: The unique id of the remote system. + type: str + remote_system_name: + description: The name of the remote system. + type: str + remote_storage_container_id: + description: The unique id of the destination storage + container on the remote system. + type: str + datastores: + description: List of associated datastores. + type: list + contains: + id: + description: Unique identifier of the datastore instance. + type: str + name: + description: User-assigned name of the datastore in vCenter. + type: str + sample: [ + { + "datastores": [], + "destinations": [], + "id": "e0ccd953-5650-41d8-9bce-f36d876d6a2a", + "name": "Ansible_storage_container_1", + "quota": 21474836480, + "replication_groups": [], + "storage_protocol": "NVMe", + "storage_protocol_l10n": "NVMe", + "virtual_volumes": [] + } + ] VolumeGroups: description: Provides details of all volume groups. type: list - returned: When vg is in a given gather_subset + returned: When C(vg) is in a given I(gather_subset) contains: id: description: ID of the volume group. @@ -970,7 +1107,7 @@ Volumes: description: Provides details of all volumes. type: list - returned: When vol is in a given gather_subset + returned: When C(vol) is in a given I(gather_subset) contains: id: description: ID of the volume. @@ -987,7 +1124,7 @@ TreeQuotas: description: Provides details of all tree quotas. type: list - returned: When tree_quota is in a given gather_subset + returned: When C(tree_quota) is in a given I(gather_subset) contains: id: description: ID of the tree quota. @@ -1003,7 +1140,7 @@ UserQuotas: description: Provides details of all user quotas. type: list - returned: When user_quota is in a given gather_subset + returned: When C(user_quota) is in a given I(gather_subset) contains: id: description: ID of the user quota. @@ -1016,7 +1153,7 @@ vCenter: description: Provide details of all vCenters. type: list - returned: When vCenter is in a given gather_subset + returned: When C(vCenter) is in a given I(gather_subset) contains: id: description: Unique identifier of vCenter. @@ -1070,7 +1207,7 @@ VirtualVolume: description: Provides details of all virtual volumes. type: list - returned: When virtual_volume is in a given gather_subset + returned: When C(virtual_volume) is in a given I(gather_subset) contains: id: description: The unique identifier of the virtual volume. @@ -1239,7 +1376,6 @@ from ansible.module_utils.basic import AnsibleModule from ansible_collections.dellemc.powerstore.plugins.module_utils.storage.dell\ import utils -import logging LOG = utils.get_logger('info') @@ -1252,7 +1388,7 @@ VERSION_ERROR = py4ps_version['unsupported_version_message'] # Application type -APPLICATION_TYPE = 'Ansible/1.9.0' +APPLICATION_TYPE = 'Ansible/2.0.0' class PowerstoreInfo(object): @@ -1323,6 +1459,10 @@ def __init__(self): 'func': self.protection.get_snapshot_rules, 'display_as': 'SnapshotRules' }, + 'replication_group': { + 'func': self.protection.get_replication_groups, + 'display_as': 'ReplicationGroups' + }, 'replication_rule': { 'func': self.protection.get_replication_rules, 'display_as': 'ReplicationRules' @@ -1431,6 +1571,10 @@ def __init__(self): 'func': self.configuration.get_virtual_volume_list, 'display_as': 'VirtualVolume' }, + 'storage_container': { + 'func': self.configuration.get_storage_container_list, + 'display_as': 'StorageContainers' + } } LOG.info('Got Py4ps connection object %s', self.conn) @@ -1576,18 +1720,19 @@ def get_powerstore_info_parameters(): PowerStore""" return dict( all_pages=dict(type='bool', required=False, default=False), - gather_subset=dict(type='list', required=True, elements='str', - choices=['vol', 'vg', 'host', 'hg', 'node', - 'protection_policy', 'snapshot_rule', - 'nas_server', 'nfs_export', 'smb_share', - 'tree_quota', 'user_quota', 'file_system', - 'replication_rule', 'replication_session', - 'remote_system', 'network', 'role', - 'user', 'appliance', 'ad', 'ldap', - 'security_config', 'certificate', 'dns', 'ntp', - 'smtp_config', 'email_notification', - 'remote_support', 'remote_support_contact', - 'ldap_account', 'ldap_domain', 'vcenter', 'virtual_volume']), + gather_subset=dict( + type='list', required=True, elements='str', + choices=['vol', 'vg', 'host', 'hg', 'node', 'protection_policy', + 'snapshot_rule', 'nas_server', 'nfs_export', 'smb_share', + 'tree_quota', 'user_quota', 'file_system', + 'replication_rule', 'replication_session', + 'remote_system', 'network', 'role', 'user', 'appliance', + 'ad', 'ldap', 'security_config', 'certificate', 'dns', + 'ntp', 'smtp_config', 'email_notification', + 'remote_support', 'remote_support_contact', + 'ldap_account', 'ldap_domain', 'vcenter', + 'virtual_volume', 'storage_container', + 'replication_group']), filters=dict(type='list', required=False, elements='dict', options=dict(filter_key=dict(type='str', required=True, no_log=False), diff --git a/plugins/modules/job.py b/plugins/modules/job.py index 8d93315..abd61c5 100644 --- a/plugins/modules/job.py +++ b/plugins/modules/job.py @@ -27,14 +27,14 @@ required: true notes: -- The check_mode is not supported. +- The I(check_mode) is not supported. ''' EXAMPLES = r''' - name: Get Job Details dellemc.powerstore.job: array_ip: "{{mgmt_ip}}" - verifycert: "{{verifycert}}" + validate_certs: "{{validate_certs}}" user: "{{user}}" password: "{{password}}" job_id: "a544981c-e94a-40ab-9eae-e578e182d2bb" @@ -174,7 +174,7 @@ VERSION_ERROR = py4ps_version['unsupported_version_message'] # Application type -APPLICATION_TYPE = 'Ansible/1.9.0' +APPLICATION_TYPE = 'Ansible/2.0.0' class PowerStoreJob(object): diff --git a/plugins/modules/ldap_account.py b/plugins/modules/ldap_account.py index e1fdb23..881f006 100644 --- a/plugins/modules/ldap_account.py +++ b/plugins/modules/ldap_account.py @@ -56,21 +56,21 @@ state: description: - Define whether the LDAP account should exist or not. - - For Delete operation only, it should be set to "absent". - - For all other operations except delete, it should be set to "present". + - For Delete operation only, it should be set to C(absent). + - For all other operations except delete, it should be set to C(present). required: true choices: ['absent', 'present'] type: str notes: -- The check_mode is supported. +- The I(check_mode) is supported. ''' EXAMPLES = r''' - name: Create an LDAP account dellemc.powerstore.ldap_account: array_ip: "{{array_ip}}" - verifycert: "{{verifycert}}" + validate_certs: "{{validate_certs}}" user: "{{user}}" password: "{{password}}" ldap_account_name: "ldap_user_account_1" @@ -82,7 +82,7 @@ - name: Get the details of the LDAP account by name dellemc.powerstore.ldap_account: array_ip: "{{array_ip}}" - verifycert: "{{verifycert}}" + validate_certs: "{{validate_certs}}" user: "{{user}}" password: "{{password}}" ldap_account_name: "ldap_user_account_1" @@ -91,7 +91,7 @@ - name: Get the details of the LDAP account by id dellemc.powerstore.ldap_account: array_ip: "{{array_ip}}" - verifycert: "{{verifycert}}" + validate_certs: "{{validate_certs}}" user: "{{user}}" password: "{{password}}" ldap_account_id: "3" @@ -100,7 +100,7 @@ - name: Modify an LDAP account dellemc.powerstore.ldap_account: array_ip: "{{array_ip}}" - verifycert: "{{verifycert}}" + validate_certs: "{{validate_certs}}" user: "{{user}}" password: "{{password}}" ldap_account_name: "ldap_user_account_1" @@ -110,7 +110,7 @@ - name: Delete an LDAP account dellemc.powerstore.ldap_account: array_ip: "{{array_ip}}" - verifycert: "{{verifycert}}" + validate_certs: "{{validate_certs}}" user: "{{user}}" password: "{{password}}" ldap_account_id: "3" @@ -173,7 +173,7 @@ VERSION_ERROR = py4ps_version['unsupported_version_message'] # Application type -APPLICATION_TYPE = 'Ansible/1.9.0' +APPLICATION_TYPE = 'Ansible/2.0.0' class PowerStoreLDAPAccount(object): diff --git a/plugins/modules/ldap_domain.py b/plugins/modules/ldap_domain.py index 342a1d9..28a9ccd 100644 --- a/plugins/modules/ldap_domain.py +++ b/plugins/modules/ldap_domain.py @@ -39,7 +39,7 @@ ldap_server_state: description: - State of the LDAP server. - - The ldap_servers and ldap_server_state are required together. + - The I(ldap_servers) and I(ldap_server_state) are required together. choices: ['present-in-domain', 'absent-in-domain'] type: str ldap_server_port: @@ -83,12 +83,12 @@ user_id_attribute: description: - Name of the LDAP attribute whose value indicates the unique identifier of the user. - - Default value is sAMAccountName. + - Default value is C(sAMAccountName). type: str user_object_class: description: - LDAP object class for users. - - Default value is user. + - Default value is C(user). type: str user_search_path: description: @@ -103,17 +103,17 @@ group_name_attribute: description: - Name of the LDAP attribute whose value indicates the group name. - - Default value is cn. + - Default value is C(cn). type: str group_member_attribute: description: - Name of the LDAP attribute whose value contains the names of group members within a group. - - Default value is member. + - Default value is C(member). type: str group_object_class: description: - LDAP object class for groups. - - Default value is group. + - Default value is C(group). type: str group_search_path: description: @@ -129,29 +129,29 @@ description: - Indicates whether to perform the verify LDAP domain configuration or not. type: bool - default: False + default: false state: description: - Define whether the LDAP domain configuration should exist or not. - - For Delete operation only, it should be set to "absent". - - For all other operations except delete, it should be set to "present". + - For Delete operation only, it should be set to C(absent). + - For all other operations except delete, it should be set to C(present). required: true choices: ['absent', 'present'] type: str notes: -- The 'is_global_catalog' option can be enabled only for AD server type. +- The I(is_global_catalog) option can be enabled only for AD server type. - To use LDAPS protocol, the pre-requisite is to upload the certificate of LDAP server on PowerStore array. - Verify operation does not support idempotency. -- The check_mode is supported. +- The I(check_mode) is supported. ''' EXAMPLES = r''' - name: Create LDAP domain dellemc.powerstore.ldap_domain: array_ip: "{{array_ip}}" - verifycert: "{{verifycert}}" + validate_certs: "{{validate_certs}}" user: "{{user}}" password: "{{password}}" domain_name: "{{domain_name}}" @@ -170,7 +170,7 @@ - name: Get LDAP domain details using ID dellemc.powerstore.ldap_domain: array_ip: "{{array_ip}}" - verifycert: "{{verifycert}}" + validate_certs: "{{validate_certs}}" user: "{{user}}" password: "{{password}}" ldap_domain_id: 4 @@ -179,7 +179,7 @@ - name: Get LDAP domain details using name dellemc.powerstore.ldap_domain: array_ip: "{{array_ip}}" - verifycert: "{{verifycert}}" + validate_certs: "{{validate_certs}}" user: "{{user}}" password: "{{password}}" ldap_domain_name: "{{ldap_domain_name}}" @@ -188,17 +188,17 @@ - name: Verify LDAP domain configuration dellemc.powerstore.ldap_domain: array_ip: "{{array_ip}}" - verifycert: "{{verifycert}}" + validate_certs: "{{validate_certs}}" user: "{{user}}" password: "{{password}}" ldap_domain_id: 4 - verify_configuration: True + verify_configuration: true state: "present" - name: Delete LDAP domain configuration dellemc.powerstore.ldap_domain: array_ip: "{{array_ip}}" - verifycert: "{{verifycert}}" + validate_certs: "{{validate_certs}}" user: "{{user}}" password: "{{password}}" ldap_domain_id: 4 @@ -207,7 +207,7 @@ - name: Create LDAP domain with AD server type dellemc.powerstore.ldap_domain: array_ip: "{{array_ip}}" - verifycert: "{{verifycert}}" + validate_certs: "{{validate_certs}}" user: "{{user}}" password: "{{password}}" ldap_domain_name: "{{domain_name}}" @@ -217,7 +217,7 @@ ldap_server_type: "AD" bind_user: "{{bind_user}}" bind_password: "{{bind_password}}" - is_global_catalog: True + is_global_catalog: true ldap_server_port: 3268 protocol: "LDAP" ldap_domain_user_settings: @@ -229,7 +229,7 @@ - name: Get LDAP domain details using domain name dellemc.powerstore.ldap_domain: array_ip: "{{array_ip}}" - verifycert: "{{verifycert}}" + validate_certs: "{{validate_certs}}" user: "{{user}}" password: "{{password}}" ldap_domain_name: "{{domain_name}}" @@ -238,7 +238,7 @@ - name: Delete LDAP domain using domain name dellemc.powerstore.ldap_domain: array_ip: "{{array_ip}}" - verifycert: "{{verifycert}}" + validate_certs: "{{validate_certs}}" user: "{{user}}" password: "{{password}}" ldap_domain_name: "{{domain_name}}" @@ -354,7 +354,7 @@ VERSION_ERROR = py4ps_version['unsupported_version_message'] # Application type -APPLICATION_TYPE = 'Ansible/1.9.0' +APPLICATION_TYPE = 'Ansible/2.0.0' class PowerStoreLDAPDomain(object): diff --git a/plugins/modules/local_user.py b/plugins/modules/local_user.py index c9e9e46..5dd7242 100644 --- a/plugins/modules/local_user.py +++ b/plugins/modules/local_user.py @@ -25,13 +25,13 @@ options: user_name: description: - - Name of the local user account. Mutually exclusive with user_id. + - Name of the local user account. Mutually exclusive with I(user_id). - Mandatory only for create operation. type: str user_id: description: - Unique identifier of the local user account. - - Mutually exclusive with user_name. + - Mutually exclusive with I(user_name). type: str user_password: description: @@ -45,47 +45,47 @@ role_name: description: - The name of the role to which the local user account will be mapped. - - It is mutually exclusive with role_id. + - It is mutually exclusive with I(role_id). type: str role_id: description: - The unique identifier of the role to which the local user account will be mapped. - - It is mutually exclusive with role_name. + - It is mutually exclusive with I(role_name). type: int is_locked: description: - Whether the user account is locked or not. - - Defaults to false at creation time. + - Defaults to C(false) at creation time. type: bool state: description: - Define whether the local user should exist or not. choices: ['absent', 'present'] - required: True + required: true type: str notes: -- The check_mode is not supported. +- The I(check_mode) is not supported. ''' EXAMPLES = r''' - name: Create local user dellemc.powerstore.local_user: array_ip: "{{array_ip}}" - verifycert: "{{verifycert}}" + validate_certs: "{{validate_certs}}" user: "{{user}}" password: "{{password}}" user_name: "ansible_user_1" user_password: "Password123#" role_name: "role_1" - is_locked: False + is_locked: false state: "present" - name: Get the details local user with user id dellemc.powerstore.local_user: array_ip: "{{array_ip}}" - verifycert: "{{verifycert}}" + validate_certs: "{{validate_certs}}" user: "{{user}}" password: "{{password}}" user_id: "{{user_id}}" @@ -94,7 +94,7 @@ - name: Get the details local user with user name dellemc.powerstore.local_user: array_ip: "{{array_ip}}" - verifycert: "{{verifycert}}" + validate_certs: "{{validate_certs}}" user: "{{user}}" password: "{{password}}" user_name: "ansible_user_1" @@ -103,20 +103,20 @@ - name: Modify attributes of local user dellemc.powerstore.local_user: array_ip: "{{array_ip}}" - verifycert: "{{verifycert}}" + validate_certs: "{{validate_certs}}" user: "{{user}}" password: "{{password}}" user_name: "ansible_user_1" user_password: "Password123#" new_password: "Ansible123#" role_id: 4 - is_locked: True + is_locked: true state: "present" - name: Delete local user dellemc.powerstore.local_user: array_ip: "{{array_ip}}" - verifycert: "{{verifycert}}" + validate_certs: "{{validate_certs}}" user: "{{user}}" password: "{{password}}" user_name: "ansible_user_1" @@ -185,7 +185,7 @@ VERSION_ERROR = py4ps_version['unsupported_version_message'] # Application type -APPLICATION_TYPE = 'Ansible/1.9.0' +APPLICATION_TYPE = 'Ansible/2.0.0' class PowerStoreLocalUser(object): diff --git a/plugins/modules/nasserver.py b/plugins/modules/nasserver.py index 86ad9b8..681073b 100644 --- a/plugins/modules/nasserver.py +++ b/plugins/modules/nasserver.py @@ -21,11 +21,11 @@ options: nas_server_name: description: - - Name of the NAS server. Mutually exclusive with nas_server_id. + - Name of the NAS server. Mutually exclusive with I(nas_server_id). type: str nas_server_id: description: - - Unique id of the NAS server. Mutually exclusive with nas_server_name. + - Unique id of the NAS server. Mutually exclusive with I(nas_server_name). type: str description: description: @@ -65,17 +65,17 @@ protection_policy: description: - Name/ID of the protection policy applied to the nas server. - - Policy can be removed by passing an empty string in the protection_policy parameter. + - Policy can be removed by passing an empty string in the I(protection_policy) parameter. type: str state: description: - Define whether the nas server should exist or not. choices: ['absent', 'present'] - required: True + required: true type: str notes: -- The check_mode is not supported. +- The I(check_mode) is not supported. - Adding/Removing protection policy to/from a NAS server is supported for PowerStore version 3.0.0 and above. ''' @@ -85,7 +85,7 @@ - name: Get details of NAS Server by name dellemc.powerstore.nasserver: array_ip: "{{array_ip}}" - verifycert: "{{verifycert}}" + validate_certs: "{{validate_certs}}" user: "{{user}}" password: "{{password}}" nas_server_name: "{{nas_server_name}}" @@ -94,7 +94,7 @@ - name: Get Details of NAS Server by ID dellemc.powerstore.nasserver: array_ip: "{{array_ip}}" - verifycert: "{{verifycert}}" + validate_certs: "{{validate_certs}}" user: "{{user}}" password: "{{password}}" nas_server_id: "{{nas_id}}" @@ -103,7 +103,7 @@ - name: Rename NAS Server by Name dellemc.powerstore.nasserver: array_ip: "{{array_ip}}" - verifycert: "{{verifycert}}" + validate_certs: "{{validate_certs}}" user: "{{user}}" password: "{{password}}" nas_server_name: "{{nas_server_name}}" @@ -113,7 +113,7 @@ - name: Modify NAS Server attributes by ID dellemc.powerstore.nasserver: array_ip: "{{array_ip}}" - verifycert: "{{verifycert}}" + validate_certs: "{{validate_certs}}" user: "{{user}}" password: "{{password}}" nas_server_id: "{{nas_id}}" @@ -126,7 +126,7 @@ - name: Remove protection policy dellemc.powerstore.nasserver: array_ip: "{{array_ip}}" - verifycert: "{{verifycert}}" + validate_certs: "{{validate_certs}}" user: "{{user}}" password: "{{password}}" nas_server_id: "{{nas_id}}" @@ -299,7 +299,7 @@ VERSION_ERROR = py4ps_version['unsupported_version_message'] # Application type -APPLICATION_TYPE = 'Ansible/1.9.0' +APPLICATION_TYPE = 'Ansible/2.0.0' class PowerStoreNasServer(object): diff --git a/plugins/modules/network.py b/plugins/modules/network.py index 7ef88c5..b4292d4 100644 --- a/plugins/modules/network.py +++ b/plugins/modules/network.py @@ -26,7 +26,7 @@ description: - The name of the network. - This parameter is added in 2.0.0.0. - - Specify either network_name or network_id for any operation. + - Specify either I(network_name) or I(network_id) for any operation. type: str network_id: description: @@ -98,12 +98,12 @@ description: - VASA vendor provider user name. type: str - required: True + required: true password: description: - VASA vendor provider password. type: str - required: True + required: true esxi_credentials: description: - Credentials required for re-registering the ESXi hosts in the vCenter. @@ -119,18 +119,18 @@ description: - Node identifier corresponding to the ESXi host. type: str - required: True + required: true password: description: - ESXi host root password. type: str - required: True + required: true wait_for_completion: description: - Flag to indicate if the operation should be run synchronously or - asynchronously. True signifies synchronous execution. By default, - modify operation will run asynchronously. - default: False + asynchronously. C(true) signifies synchronous execution. By default, + modify operation will run C(asynchronously). + default: false type: bool state: description: @@ -142,18 +142,18 @@ notes: - It is recommended to perform task asynchronously while changing cluster management address. -- Idempotency is not supported for vasa_provider_credentials and - esxi_credentials. -- For PowerStore X model, vasa_provider_credentials has to be specified - along with new_cluster_mgmt_address. -- The check_mode is not supported. +- Idempotency is not supported for I(vasa_provider_credentials) and + I(esxi_credentials). +- For PowerStore X model, I(vasa_provider_credentials) has to be specified + along with I(new_cluster_mgmt_address). +- The I(check_mode) is not supported. ''' EXAMPLES = r''' - name: Get network details using ID dellemc.powerstore.network: array_ip: "{{array_ip}}" - verifycert: "{{verifycert}}" + validate_certs: "{{validate_certs}}" user: "{{user}}" password: "{{password}}" network_id: "NW1" @@ -162,7 +162,7 @@ - name: Get network details using name dellemc.powerstore.network: array_ip: "{{array_ip}}" - verifycert: "{{verifycert}}" + validate_certs: "{{validate_certs}}" user: "{{user}}" password: "{{password}}" network_name: "Default Management Network" @@ -171,18 +171,18 @@ - name: Rename the storage network dellemc.powerstore.network: array_ip: "{{array_ip}}" - verifycert: "{{verifycert}}" + validate_certs: "{{validate_certs}}" user: "{{user}}" password: "{{password}}" network_name: "Default Storage Network" new_name: "iSCSI Network" - wait_for_completion: True + wait_for_completion: true state: "present" - name: Replace the IP's in the management network and re-register VASA vendor provider dellemc.powerstore.network: array_ip: "{{array_ip}}" - verifycert: "{{verifycert}}" + validate_certs: "{{validate_certs}}" user: "{{user}}" password: "{{password}}" network_id: "NW1" @@ -202,7 +202,7 @@ - name: Map port to the storage network dellemc.powerstore.network: array_ip: "{{array_ip}}" - verifycert: "{{verifycert}}" + validate_certs: "{{validate_certs}}" user: "{{user}}" password: "{{password}}" network_id: "NW6" @@ -214,7 +214,7 @@ - name: Unmap port from the storage network dellemc.powerstore.network: array_ip: "{{array_ip}}" - verifycert: "{{verifycert}}" + validate_certs: "{{validate_certs}}" user: "{{user}}" password: "{{password}}" network_id: "NW6" @@ -227,7 +227,7 @@ provider for X model dellemc.powerstore.network: array_ip: "{{array_ip1}}" - verifycert: "{{verifycert}}" + validate_certs: "{{validate_certs}}" user: "{{user}}" password: "{{password}}" network_id: "NW1" @@ -498,7 +498,7 @@ VERSION_ERROR = py4ps_version['unsupported_version_message'] # Application type -APPLICATION_TYPE = 'Ansible/1.9.0' +APPLICATION_TYPE = 'Ansible/2.0.0' class PowerStoreNetwork(object): diff --git a/plugins/modules/nfs.py b/plugins/modules/nfs.py index f6ac8df..1fd9801 100644 --- a/plugins/modules/nfs.py +++ b/plugins/modules/nfs.py @@ -28,7 +28,7 @@ description: - The name of the NFS export. - Mandatory for create operation. - - Specify either nfs_export_name or nfs_export_id(but not both) for any + - Specify either I(nfs_export_name) or I(nfs_export_id) but not both for any operation. type: str nfs_export_id: @@ -40,18 +40,18 @@ - The ID/Name of the filesystem for which the NFS export will be created. - Either filesystem or snapshot is required for creation of the NFS Export. - - If filesystem name is specified, then nas_server is required to uniquely + - If filesystem name is specified, then I(nas_server) is required to uniquely identify the filesystem. - - If filesystem parameter is provided, then snapshot cannot be specified. + - If I(filesystem) parameter is provided, then I(snapshot) cannot be specified. type: str snapshot: description: - The ID/Name of the Snapshot for which NFS export will be created. - - Either filesystem or snapshot is required for creation of the NFS + - Either I(filesystem) or I(snapshot) is required for creation of the NFS Export. - - If snapshot name is specified, then nas_server is required to + - If snapshot name is specified, then I(nas_server) is required to uniquely identify the snapshot. - - If snapshot parameter is provided, then filesystem cannot be specified. + - If I(snapshot) parameter is provided, then I(filesystem) cannot be specified. - NFS export can be created only if access type of snapshot is "protocol". type: str nas_server: @@ -74,8 +74,8 @@ - Default access level for all hosts that can access the Export. - For hosts that need different access than the default, they can be configured by adding to the list. - - If default_access is not mentioned during creation, then NFS export will - be created with No_Access. + - If I(default_access) is not mentioned during creation, then NFS export will + be created with C(No_Access). choices: ['NO_ACCESS', 'READ_ONLY', 'READ_WRITE', 'ROOT', 'READ_ONLY_ROOT'] type: str @@ -107,7 +107,7 @@ min_security: description: - NFS enforced security type for users accessing an NFS export. - - If not specified at the time of creation, it will be set to SYS. + - If not specified at the time of creation, it will be set to C(SYS). choices: ['SYS', 'KERBEROS', 'KERBEROS_WITH_INTEGRITY', 'KERBEROS_WITH_ENCRYPTION'] type: str @@ -124,7 +124,7 @@ is_no_suid: description: - If set, do not allow access to set SUID. Otherwise, allow access. - - If not specified at the time of creation, it will be set to False. + - If not specified at the time of creation, it will be set to C(false). type: bool host_state: description: @@ -140,14 +140,14 @@ type: str notes: -- The check_mode is not supported. +- The I(check_mode) is not supported. """ EXAMPLES = r""" - name: Create NFS export (filesystem) dellemc.powerstore.nfs: array_ip: "{{array_ip}}" - verifycert: "{{verifycert}}" + validate_certs: "{{validate_certs}}" user: "{{user}}" password: "{{password}}" nfs_export_name: "{{export_name1}}" @@ -169,14 +169,14 @@ min_security: "SYS" anonymous_uid: 1000 anonymous_gid: 1000 - is_no_suid: True + is_no_suid: true host_state: "present-in-export" state: "present" - name: Create NFS export Create NFS export for filesystem snapshot with mandatory parameters dellemc.powerstore.nfs: array_ip: "{{array_ip}}" - verifycert: "{{verifycert}}" + validate_certs: "{{validate_certs}}" user: "{{user}}" password: "{{password}}" nfs_export_name: "{{export_name2}}" @@ -188,7 +188,7 @@ - name: Get NFS export details using ID dellemc.powerstore.nfs: array_ip: "{{array_ip}}" - verifycert: "{{verifycert}}" + validate_certs: "{{validate_certs}}" user: "{{user}}" password: "{{password}}" nfs_export_id: "{{export_id}}" @@ -197,7 +197,7 @@ - name: Add Read-Only and Read-Write hosts to NFS export dellemc.powerstore.nfs: array_ip: "{{array_ip}}" - verifycert: "{{verifycert}}" + validate_certs: "{{validate_certs}}" user: "{{user}}" password: "{{password}}" nfs_export_id: "{{export_id}}" @@ -211,7 +211,7 @@ - name: Remove Read-Only and Read-Write hosts from NFS export dellemc.powerstore.nfs: array_ip: "{{array_ip}}" - verifycert: "{{verifycert}}" + validate_certs: "{{validate_certs}}" user: "{{user}}" password: "{{password}}" nfs_export_id: "{{export_id}}" @@ -225,7 +225,7 @@ - name: Modify the attributes of NFS export dellemc.powerstore.nfs: array_ip: "{{array_ip}}" - verifycert: "{{verifycert}}" + validate_certs: "{{validate_certs}}" user: "{{user}}" password: "{{password}}" nfs_export_id: "{{export_id}}" @@ -236,7 +236,7 @@ - name: Delete NFS export using name dellemc.powerstore.nfs: array_ip: "{{array_ip}}" - verifycert: "{{verifycert}}" + validate_certs: "{{validate_certs}}" user: "{{user}}" password: "{{password}}" nfs_export_name: "{{export_name}}" @@ -361,7 +361,6 @@ import re import logging try: - import ipaddress from ipaddress import ip_network, IPv4Network, IPv6Network HAS_IPADDRESS = True except ImportError: @@ -381,7 +380,7 @@ VERSION_ERROR = py4ps_version['unsupported_version_message'] # Application type -APPLICATION_TYPE = 'Ansible/1.9.0' +APPLICATION_TYPE = 'Ansible/2.0.0' class PowerStoreNfsExport(object): diff --git a/plugins/modules/ntp.py b/plugins/modules/ntp.py index 9d77680..0341933 100644 --- a/plugins/modules/ntp.py +++ b/plugins/modules/ntp.py @@ -23,33 +23,31 @@ ntp_id: description: - Unique identifier of the NTP instance. - required: True + required: true type: str ntp_addresses: description: - NTP server addresses, may contain host names or IPv4 addresses. - required: False type: list elements: str ntp_address_state: description: - - State of the addresses mentioned in ntp_addresses. - required: False + - State of the addresses mentioned in I(ntp_addresses). choices: ['present-in-ntp', 'absent-in-ntp'] type: str state: description: - The state of the NTP instance after the task is performed. - - For get and modify operations it should be set to "present". - required : True + - For get and modify operations it should be set to C(present). + required : true choices: [ 'present', 'absent'] type: str notes: - Minimum 1 and maximum 3 addresses can be associated to a NTP instance. -- Parameters ntp_addresses and ntp_address_state are required together. +- Parameters I(ntp_addresses) and I(ntp_address_state) are required together. - Creation and deletion of NTP is not supported. -- The check_mode is not supported. +- The I(check_mode) is not supported. ''' EXAMPLES = r''' @@ -58,7 +56,7 @@ array_ip: "{{array_ip}}" user: "{{user}}" password: "{{password}}" - verifycert: "{{verifycert}}" + validate_certs: "{{validate_certs}}" ntp_id: "NTP1" state: "present" @@ -67,7 +65,7 @@ array_ip: "{{array_ip}}" user: "{{user}}" password: "{{password}}" - verifycert: "{{verifycert}}" + validate_certs: "{{validate_certs}}" ntp_id: "NTP1" ntp_addresses: - "XX.XX.XX.XX" @@ -80,7 +78,7 @@ array_ip: "{{array_ip}}" user: "{{user}}" password: "{{password}}" - verifycert: "{{verifycert}}" + validate_certs: "{{validate_certs}}" ntp_id: "NTP1" ntp_addresses: - "YY.YY.YY.YY" @@ -130,7 +128,7 @@ VERSION_ERROR = py4ps_version['unsupported_version_message'] # Application type -APPLICATION_TYPE = 'Ansible/1.9.0' +APPLICATION_TYPE = 'Ansible/2.0.0' class PowerstoreNtp(object): diff --git a/plugins/modules/protectionpolicy.py b/plugins/modules/protectionpolicy.py index eb5204c..aef511b 100644 --- a/plugins/modules/protectionpolicy.py +++ b/plugins/modules/protectionpolicy.py @@ -25,12 +25,10 @@ name: description: - String variable. Indicates the name of the protection policy. - required: False type: str protectionpolicy_id: description: - String variable. Indicates the id of the protection policy. - required: False type: str new_name: description: @@ -41,7 +39,6 @@ description: - List of strings to specify the name or ids of snapshot rules which are to be added or removed, to or from, the protection policy. - required: False type: list elements: str replicationrule: @@ -49,20 +46,18 @@ - The name or ids of the replcation rule which is to be added to the protection policy. - To remove the replication rule, an empty string has to be passed. - required: False type: str description: description: - String variable. Indicates the description of the protection policy. - required : False type: str state: description: - String variable. Indicates the state of protection policy. - - For Delete operation only, it should be set to "absent". + - For Delete operation only, it should be set to C(absent). - For all other operations like Create, Modify or Get details, - it should be set to "present". - required : True + it should be set to C(present). + required: true choices: [ present, absent] type: str snapshotrule_state: @@ -70,9 +65,9 @@ - String variable. Indicates the state of a snapshotrule in a protection policy. - When snapshot rules are specified, this variable is required. - - Value present-in-policy indicates to add to protection policy. - - Value absent-in-policy indicates to remove from protection policy. - required : False + - Value C(present-in-policy) indicates to add to protection policy. + - Value C(absent-in-policy) indicates to remove from protection policy. + required : false choices: [ present-in-policy, absent-in-policy] type: str notes: @@ -80,7 +75,7 @@ from the protection policy. - In PowerStore version 3.0.0.0, protection policy without snapshot rule/replication rule is not allowed. -- The check_mode is not supported. +- The I(check_mode) is not supported. ''' EXAMPLES = r''' @@ -88,7 +83,7 @@ - name: Create a protection policy with snapshot rule and replication rule dellemc.powerstore.protectionpolicy: array_ip: "{{array_ip}}" - verifycert: "{{verifycert}}" + validate_certs: "{{validate_certs}}" user: "{{user}}" password: "{{password}}" name: "{{name}}" @@ -103,7 +98,7 @@ - name : Modify protection policy, change name dellemc.powerstore.protectionpolicy: array_ip: "{{array_ip}}" - verifycert: "{{verifycert}}" + validate_certs: "{{validate_certs}}" user: "{{user}}" password: "{{password}}" name: "{{name}}" @@ -114,7 +109,7 @@ - name : Modify protection policy, add snapshot rule dellemc.powerstore.protectionpolicy: array_ip: "{{array_ip}}" - verifycert: "{{verifycert}}" + validate_certs: "{{validate_certs}}" user: "{{user}}" password: "{{password}}" name: "{{name}}" @@ -126,7 +121,7 @@ - name : Modify protection policy, remove snapshot rule, replication rule dellemc.powerstore.protectionpolicy: array_ip: "{{array_ip}}" - verifycert: "{{verifycert}}" + validate_certs: "{{validate_certs}}" user: "{{user}}" password: "{{password}}" name: "{{name}}" @@ -139,7 +134,7 @@ - name : Get details of protection policy by name dellemc.powerstore.protectionpolicy: array_ip: "{{array_ip}}" - verifycert: "{{verifycert}}" + validate_certs: "{{validate_certs}}" user: "{{user}}" password: "{{password}}" name: "{{name}}" @@ -148,7 +143,7 @@ - name : Get details of protection policy by ID dellemc.powerstore.protectionpolicy: array_ip: "{{array_ip}}" - verifycert: "{{verifycert}}" + validate_certs: "{{validate_certs}}" user: "{{user}}" password: "{{password}}" protectionpolicy_id: "{{protectionpolicy_id}}" @@ -157,7 +152,7 @@ - name : Delete protection policy dellemc.powerstore.protectionpolicy: array_ip: "{{array_ip}}" - verifycert: "{{verifycert}}" + validate_certs: "{{validate_certs}}" user: "{{user}}" password: "{{password}}" name: "{{name}}" @@ -246,7 +241,7 @@ VERSION_ERROR = py4ps_version['unsupported_version_message'] # Application type -APPLICATION_TYPE = 'Ansible/1.9.0' +APPLICATION_TYPE = 'Ansible/2.0.0' class PowerstoreProtectionpolicy(object): diff --git a/plugins/modules/quota.py b/plugins/modules/quota.py index f7c50f6..e2be1b6 100644 --- a/plugins/modules/quota.py +++ b/plugins/modules/quota.py @@ -30,7 +30,7 @@ description: - The path on which the quota will be imposed. - Path is relative to the root of the filesystem. - - For user quota, if path is not specified, quota will be created at the + - For user quota, if I(path) is not specified, quota will be created at the root of the filesystem. type: str quota_type: @@ -41,14 +41,14 @@ quota_id: description: - Id of the user/tree quota. - - If quota_id is mentioned, then path/nas_server/file_system/quota_type is + - If I(quota_id) is mentioned, then I(path)/I(nas_server)/I(file_system)/I(quota_type) is not required. type: str filesystem: description: - The ID/Name of the filesystem for which the Tree/User Quota will be created. - - If filesystem name is specified, then nas_server is required to uniquely + - If filesystem name is specified, then I(nas_server) is required to uniquely identify the filesystem. type: str nas_server: @@ -58,14 +58,14 @@ description: description: - Additional information that can be mentioned for a Tree Quota. - - Description parameter can only be used when quota_type is 'tree'. + - Description parameter can only be used when I(quota_type) is C(tree). type: str unix_name: description: - The name of the unix user account for which quota operations will be performed. - - Any one among uid/unix_name/windows_name/windows_sid is required when - quota_type is 'user'. + - Any one among C(uid)/C(unix_name)/C(windows_name)/C(windows_sid) is required when + I(quota_type) is C(user). type: str windows_name: description: @@ -73,22 +73,22 @@ performed. - The name should be mentioned along with Domain Name as 'DOMAIN_NAME\user_name' or as "DOMAIN_NAME\\user_name". - - Any one among uid/unix_name/windows_name/windows_sid is required when - quota_type is 'user'. + - Any one among C(uid)/C(unix_name)/C(windows_name)/C(windows_sid) is required when + I(quota_type) is C(user). type: str uid: description: - The ID of the unix user account for which quota operations will be performed. - - Any one among uid/unix_name/windows_name/windows_sid is required when - quota_type is 'user'. + - Any one among C(uid)/C(unix_name)/C(windows_name)/C(windows_sid) is required when + I(quota_type) is C(user). type: int windows_sid: description: - The SID of the Windows User account for which quota operations will be performed. - - Any one among uid/unix_name/windows_name/windows_sid is required when - quota_type is 'user'. + - Any one among C(uid)/C(unix_name)/C(windows_name)/C(windows_sid) is required when + I(quota_type) is C(user). type: str quota: description: @@ -98,12 +98,12 @@ soft_limit: description: - Soft limit of the User/Tree quota. - - No Soft limit when set to 0. + - No Soft limit when set to C(0). type: int hard_limit: description: - Hard limit of the user quota. - - No hard limit when set to 0. + - No hard limit when set to C(0). type: int cap_unit: description: @@ -115,16 +115,16 @@ state: description: - Define whether the Quota should exist or not. - - Value present indicates that the Quota should exist on the system. - - Value absent indicates that the Quota should not exist on the system. + - Value C(present) indicates that the Quota should exist on the system. + - Value C(absent) indicates that the Quota should not exist on the system. type: str required: true choices: ['absent', 'present'] notes: - Tree quota cannot be created at the root of the filesystem. -- When the ID of the filesystem is passed then nas_server is not required. - If passed, then filesystem should exist for the nas_server, else the task +- When the ID of the filesystem is passed then I(nas_server) is not required. + If passed, then filesystem should exist for the I(nas_server), else the task will fail. - If a primary directory of the current directory or a subordinate directory of the path is having a Tree Quota configured, then the quota for that path @@ -134,15 +134,15 @@ the quotas will be enabled for that filesystem automatically. - If a user quota is to be created on a tree quota, then the user quotas will be enabled automatically in a tree quota. -- Delete User Quota operation is not supported. -- The check_mode is not supported. +- C(Delete) User Quota operation is not supported. +- The I(check_mode) is not supported. ''' EXAMPLES = r''' - name: Create a Quota for a User using unix name dellemc.powerstore.quota: array_ip: "{{array_ip}}" - verifycert: "{{verify_cert}}" + validate_certs: "{{validate_certs}}" user: "{{user}}" password: "{{password}}" quota_type: "user" @@ -158,7 +158,7 @@ - name: Create a Tree Quota dellemc.powerstore.quota: array_ip: "{{array_ip}}" - verifycert: "{{verify_cert}}" + validate_certs: "{{validate_certs}}" user: "{{user}}" password: "{{password}}" quota_type: "tree" @@ -174,7 +174,7 @@ - name: Modify attributes for Tree Quota dellemc.powerstore.quota: array_ip: "{{array_ip}}" - verifycert: "{{verify_cert}}" + validate_certs: "{{validate_certs}}" user: "{{user}}" password: "{{password}}" quota_id: "{{quota_id}}" @@ -187,7 +187,7 @@ - name: Get details of User Quota dellemc.powerstore.quota: array_ip: "{{array_ip}}" - verifycert: "{{verify_cert}}" + validate_certs: "{{validate_certs}}" user: "{{user}}" password: "{{password}}" quota_type: "user" @@ -199,7 +199,7 @@ - name: Get details of Tree Quota dellemc.powerstore.quota: array_ip: "{{array_ip}}" - verifycert: "{{verify_cert}}" + validate_certs: "{{validate_certs}}" user: "{{user}}" password: "{{password}}" quota_id: "{{quota_id}}" @@ -208,7 +208,7 @@ - name: Delete a Tree Quota dellemc.powerstore.quota: array_ip: "{{array_ip}}" - verifycert: "{{verify_cert}}" + validate_certs: "{{validate_certs}}" user: "{{user}}" password: "{{password}}" quota_type: "tree" @@ -223,7 +223,7 @@ description: Whether or not the resource has changed. returned: always type: bool - sample: "True" + sample: "true" quota_details: description: The quota details. @@ -364,7 +364,7 @@ VERSION_ERROR = py4ps_version['unsupported_version_message'] # Application type -APPLICATION_TYPE = 'Ansible/1.9.0' +APPLICATION_TYPE = 'Ansible/2.0.0' class PowerStoreQuota(object): @@ -883,7 +883,8 @@ def show_quota_details(self, quota_id, quota_type, path, filesystem_id, windows_name, windows_sid) if state == "present" and quota_type == "user" and \ - quota_details and quota_details['tree_quota']: + quota_details and 'tree_quota' in quota_details and \ + quota_details['tree_quota']: tree_quota = add_limits_with_unit(quota_details['tree_quota']) quota_details['tree_quota_for_user_quota'] = tree_quota quota_details.pop('tree_quota') diff --git a/plugins/modules/remote_support.py b/plugins/modules/remote_support.py index 1984890..4bdf0ac 100644 --- a/plugins/modules/remote_support.py +++ b/plugins/modules/remote_support.py @@ -26,20 +26,18 @@ remote_support_id: description: - Unique identifier of the remote support configuration. - required: True + required: true type: int support_type: description: - The type of remote support that is configured. - Mandatory for modify and verify operation. - - SRS_Gateway support_type is only supported for verify operation. - required: False + - C(SRS_Gateway), I(support_type) is only supported for verify operation. type: str choices: ['SRS_Gateway', 'SRS_Gateway_Tier2', 'SRS_Gateway_Tier3', 'SRS_Integrated_Tier2', 'SRS_Integrated_Tier3', 'Disabled'] remote_support_servers: description: - One or two remote support servers. - required: False type: list elements: dict suboptions: @@ -56,93 +54,81 @@ is_primary: description: - Indicates whether the server is acting as the primary. - - One server must be set to false when two servers are configured. + - One server must be set to C(false) when two servers are configured. type: bool server_state: description: - - Indicates the state of the remote-support_servers. - - Required with remote_support_servers. - required: False + - Indicates the state of the remote_support_servers. + - Required with I(remote_support_servers). type: str choices: ['present-in-server', 'absent-in-server'] is_support_assist_license_accepted: description: - Indicates whether user has accepted remote support license agreement before enabling the Support Assist on the system for the first time. - required: False type: bool is_cloudiq_enabled: description: - Indicates whether support for CloudIQ is enabled. - required: False type: bool is_rsc_enabled: description: - Indicates whether support for Remote Service Credentials is enabled. - required: False type: bool proxy_address: description: - Proxy server IP address (IPv4). - required: False type: str proxy_port: description: - Proxy server port number. - required: False type: int proxy_username: description: - User name for proxy server access. - required: False type: str proxy_password: description: - Password for proxy server access. - required: False type: str is_icw_configured: description: - Client already configured ICW. - required: False type: bool verify_connection: description: - Indicates whether to perform the verify call or not. - required: False type: bool - default: False + default: false send_test_alert: description: - Indicates whether to send a test alert or not. - required: False type: bool - default: False + default: false wait_for_completion: description: - Flag to indicate if the operation should be run synchronously or - asynchronously. True signifies synchronous execution. By default, + asynchronously. C(true) signifies synchronous execution. By default, modify operation will run asynchronously. - default: False + default: false type: bool return_support_license_text: description: - Indicates whether to return support license agreement text or not. - required: False type: bool - default: False + default: false state: description: - The state of the remote support configuration after the task is performed. - - For Delete operation only, it should be set to "absent". - - For get/modify operation it should be set to "present". - required : True + - For Delete operation only, it should be set to C(absent). + - For get/modify operation it should be set to C(present). + required : true choices: [ 'present', 'absent'] type: str notes: - Creation and deletion of remote support configuration is not supported. -- Support for check_mode is not available for this module. +- Support for I(check_mode) is not available for this module. - Verify and send test alert operations do not support idempotency. ''' @@ -153,7 +139,7 @@ array_ip: "{{array_ip}}" user: "{{user}}" password: "{{password}}" - verifycert: "{{verifycert}}" + validate_certs: "{{validate_certs}}" remote_support_id: 0 state: "present" @@ -162,19 +148,19 @@ array_ip: "{{array_ip}}" user: "{{user}}" password: "{{password}}" - verifycert: "{{verifycert}}" + validate_certs: "{{validate_certs}}" remote_support_id: 0 support_type: "SRS_Gateway_Tier2" remote_support_servers: - address: "10.XX.XX.XX" port: 9443 - is_primary: True + is_primary: true - address: "10.XX.XX.YY" port: 9443 - is_primary: False + is_primary: false server_state: "present-in-server" - is_rsc_enabled: True - is_cloudiq_enabled: False + is_rsc_enabled: true + is_cloudiq_enabled: false timeout: 300 state: "present" @@ -183,7 +169,7 @@ array_ip: "{{array_ip}}" user: "{{user}}" password: "{{password}}" - verifycert: "{{verifycert}}" + validate_certs: "{{validate_certs}}" remote_support_id: 0 support_type: "SRS_Integrated_Tier2" proxy_address: "10.XX.XX.ZZ" @@ -198,11 +184,11 @@ array_ip: "{{array_ip}}" user: "{{user}}" password: "{{password}}" - verifycert: "{{verifycert}}" + validate_certs: "{{validate_certs}}" remote_support_id: 0 support_type: "SRS_Integrated_Tier3" timeout: 300 - verify_connection: True + verify_connection: true state: "present" - name: Send a test alert @@ -210,9 +196,9 @@ array_ip: "{{array_ip}}" user: "{{user}}" password: "{{password}}" - verifycert: "{{verifycert}}" + validate_certs: "{{validate_certs}}" remote_support_id: 0 - send_test_alert: True + send_test_alert: true state: "present" ''' @@ -371,7 +357,7 @@ VERSION_ERROR = py4ps_version['unsupported_version_message'] # Application type -APPLICATION_TYPE = 'Ansible/1.9.0' +APPLICATION_TYPE = 'Ansible/2.0.0' class PowerstoreRemoteSupport(object): diff --git a/plugins/modules/remote_support_contact.py b/plugins/modules/remote_support_contact.py index d2ac2f2..33d34b6 100644 --- a/plugins/modules/remote_support_contact.py +++ b/plugins/modules/remote_support_contact.py @@ -24,42 +24,38 @@ contact_id: description: - Unique identifier of the remote support contact. - required: True + required: true type: int first_name: description: - The first name of the support contact for this system. - required: False type: str last_name: description: - The last name of the support contact for this system. - required: False type: str phone: description: - The phone number of this support contact for this system. - required: False type: str email: description: - The email address of the support contact for this system. - required: False type: str state: description: - The state of the remote support contact after the task is performed. - - For Delete operation only, it should be set to "absent". - - For get/modify operation it should be set to "present". - required : True + - For Delete operation only, it should be set to C(absent). + - For get/modify operation it should be set to C(present). + required : true choices: [ 'present', 'absent'] type: str notes: - Creation and deletion of remote support contact is not supported. -- Parameters first_name, last_name, email and phone can be removed by passing +- Parameters I(first_name), I(last_name), I(email) and I(phone) can be removed by passing empty string. -- The check_mode is not supported. +- The I(check_mode) is not supported. ''' EXAMPLES = r''' @@ -68,7 +64,7 @@ array_ip: "{{array_ip}}" user: "{{user}}" password: "{{password}}" - verifycert: "{{verifycert}}" + validate_certs: "{{validate_certs}}" contact_id: 0 state: "present" @@ -77,7 +73,7 @@ array_ip: "{{array_ip}}" user: "{{user}}" password: "{{password}}" - verifycert: "{{verifycert}}" + validate_certs: "{{validate_certs}}" contact_id: 0 first_name: "abc" last_name: "xyz" @@ -141,7 +137,7 @@ VERSION_ERROR = py4ps_version['unsupported_version_message'] # Application type -APPLICATION_TYPE = 'Ansible/1.9.0' +APPLICATION_TYPE = 'Ansible/2.0.0' class PowerstoreRemoteSupportContact(object): diff --git a/plugins/modules/remotesystem.py b/plugins/modules/remotesystem.py index d234a9f..6fe8fa2 100644 --- a/plugins/modules/remotesystem.py +++ b/plugins/modules/remotesystem.py @@ -24,53 +24,45 @@ remote_name: description: - Name of the remote system. - - Parameter remote_name cannot be mentioned during addition of a new + - Parameter I(remote_name) cannot be mentioned during addition of a new remote system. - required: False type: str remote_id: description: - ID of the remote system. - ID for the remote system is autogenerated, cannot be passed during creation of a remote system. - - Parameter remote_id and remote_address are mutually exclusive. - required: False + - Parameter I(remote_id) and I(remote_address) are mutually exclusive. type: str remote_user: description: - Username used in basic authentication to remote PowerStore cluster. - It can be mentioned only during creation of the remote system. - required: False type: str remote_password: description: - Password used in basic authentication to remote PowerStore cluster. - It can be mentioned only during creation of the remote system. - required: False type: str remote_address: description: - Management IP of the remote system. - - Parameter remote_id and remote_address are mutually exclusive. - required: False + - Parameter I(remote_id) and I(remote_address) are mutually exclusive. type: str new_remote_address: description: - New management IP of the remote system. - required: False type: str remote_port: description: - Remote system's port number. - It can be mentioned only during creation of the remote system. - required: False type: int default: 443 description: description: - Additional information about the remote system. - To remove the description empty string is to be passed. - required: False type: str network_latency: description: @@ -78,40 +70,38 @@ the expected network latency. - Setting to low will have latency of less than five milliseconds. - Setting to high will have latency of more than five milliseconds. - required: False type: str choices: [Low, High] wait_for_completion: description: - Flag to indicate if the operation should be run synchronously or asynchronously. - - True signifies synchronous execution. + - C(true) signifies synchronous execution. - By default, modify and delete operation will run asynchronously. type: bool - required: False - choices: [True, False] - default: False + choices: [true, false] + default: false state: description: - The state of the remote system after the task is performed. - - For Delete operation only, it should be set to "absent". + - For Delete operation only, it should be set to C(absent). - For all Create, Modify or Get details operations it should be set to - "present". - required : True + C(present). + required : true choices: [ present, absent] type: str notes: - The module support allows create/delete/update only for remote PowerStore arrays. - Get details can be done for all type of remote arrays. -- Parameters remote_user, remote_port and remote_password are not required +- Parameters I(remote_user), I(remote_port) and I(remote_password) are not required during modification, getting and deleting. If passed then these parameters will be ignored and the operation will be performed. -- If wait_for_completion is set to True then the connection will be terminated +- If I(wait_for_completion) is set to C(true) then the connection will be terminated after the timeout is exceeded. User can tweak timeout and pass it in the playbook task. - By default, the timeout is set to 120 seconds. -- The check_mode is not supported. +- The I(check_mode) is not supported. ''' EXAMPLES = r''' @@ -119,7 +109,7 @@ - name: Add a new remote system dellemc.powerstore.remotesystem: array_ip: "{{array_ip}}" - verifycert: "{{verifycert}}" + validate_certs: "{{validate_certs}}" user: "{{user}}" password: "{{password}}" remote_address: "xxx.xxx.xxx.xxx" @@ -133,13 +123,13 @@ - name: Modify attributes of remote system using remote_id dellemc.powerstore.remotesystem: array_ip: "{{array_ip}}" - verifycert: "{{verifycert}}" + validate_certs: "{{validate_certs}}" user: "{{user}}" password: "{{password}}" remote_id: "7d7e7917-735b-3eef-8cc3-1302001c08e7" remote_address: "xxx.xxx.xxx.xxx" network_latency: "Low" - wait_for_completion: True + wait_for_completion: true timeout: 300 decription: "Updating the description" state: "present" @@ -147,7 +137,7 @@ - name: Get details of remote system using remote_id dellemc.powerstore.remotesystem: array_ip: "{{array_ip}}" - verifycert: "{{verifycert}}" + validate_certs: "{{validate_certs}}" user: "{{user}}" password: "{{password}}" remote_id: "D7d7e7917-735b-3eef-8cc3-1302001c08e7" @@ -156,7 +146,7 @@ - name: Delete remote system using remote_id dellemc.powerstore.remotesystem: array_ip: "{{array_ip}}" - verifycert: "{{verifycert}}" + validate_certs: "{{validate_certs}}" user: "{{user}}" password: "{{password}}" remote_id: "D7d7e7917-735b-3eef-8cc3-1302001c08e7" @@ -318,7 +308,7 @@ VERSION_ERROR = py4ps_version['unsupported_version_message'] # Application type -APPLICATION_TYPE = 'Ansible/1.9.0' +APPLICATION_TYPE = 'Ansible/2.0.0' class PowerstoreRemoteSystem(object): diff --git a/plugins/modules/replicationrule.py b/plugins/modules/replicationrule.py index 6de4a1e..fbcaede 100644 --- a/plugins/modules/replicationrule.py +++ b/plugins/modules/replicationrule.py @@ -25,30 +25,27 @@ description: - Name of the replication rule. - Required during creation of a replication rule. - - Parameter replication_rule_name and replication_rule_id are mutually + - Parameter I(replication_rule_name) and I(replication_rule_id) are mutually exclusive. - required: False type: str replication_rule_id: description: - ID of the replication rule. - ID for the rule is autogenerated, cannot be passed during creation of a replication rule. - - Parameter replication_rule_name and replication_rule_id are mutually + - Parameter I(replication_rule_name) and I(replication_rule_id) are mutually exclusive. - required: False type: str new_name: description: - New name of the replication rule. - Used for renaming a replication rule. - required: False type: str rpo: description : - Recovery point objective (RPO), which is the acceptable amount of data, measured in units of time, that may be lost in case of a failure. - required : False + required : false choices: [ Five_Minutes, Fifteen_Minutes, Thirty_Minutes, One_Hour, Six_Hours, Twelve_Hours, One_Day ] type: str @@ -61,34 +58,34 @@ will be passed. - The range of integers supported are in between 0 and 1440 (inclusive of both). - required : False + required : false type: int remote_system: description: - ID or name of the remote system to which this rule will replicate the associated resources. - required : False + required : false type: str remote_system_address: description: - The management IPv4 address of the remote system. - - It is required in case the remote system name passed in remote_system + - It is required in case the remote system name passed in I(remote_system) parameter is not unique on the PowerStore Array. - If ID of the remote system is passed then no need to pass - remote_system_address. - required : False + I(remote_system_address). + required : false type: str state: description: - The state of the replication rule after the task is performed. - - For Delete operation only, it should be set to "absent". + - For Delete operation only, it should be set to C(absent). - For all Create, Modify or Get details operations it should be set to - "present". - required : True + C(present). + required : true choices: [ present, absent] type: str notes: -- The check_mode is not supported. +- The I(check_mode) is not supported. ''' EXAMPLES = r''' @@ -96,7 +93,7 @@ - name: Create new replication rule dellemc.powerstore.replicationrule: array_ip: "{{array_ip}}" - verifycert: "{{verifycert}}" + validate_certs: "{{validate_certs}}" user: "{{user}}" password: "{{password}}" replication_rule_name: "sample_replication_rule" @@ -108,7 +105,7 @@ - name: Modify existing replication rule dellemc.powerstore.replicationrule: array_ip: "{{array_ip}}" - verifycert: "{{verifycert}}" + validate_certs: "{{validate_certs}}" user: "{{user}}" password: "{{password}}" replication_rule_name: "sample_replication_rule" @@ -121,7 +118,7 @@ - name: Get details of replication rule dellemc.powerstore.replicationrule: array_ip: "{{array_ip}}" - verifycert: "{{verifycert}}" + validate_certs: "{{validate_certs}}" user: "{{user}}" password: "{{password}}" replication_rule_id: "{{id}}" @@ -130,7 +127,7 @@ - name: Delete an existing replication rule dellemc.powerstore.replicationrule: array_ip: "{{array_ip}}" - verifycert: "{{verifycert}}" + validate_certs: "{{validate_certs}}" user: "{{user}}" password: "{{password}}" replication_rule_name: "new_sample_replication_rule" @@ -188,7 +185,6 @@ from ansible.module_utils.basic import AnsibleModule from ansible_collections.dellemc.powerstore.plugins.module_utils.storage.dell\ import utils -import logging LOG = utils.get_logger('replicationrule') @@ -201,7 +197,7 @@ VERSION_ERROR = py4ps_version['unsupported_version_message'] # Application type -APPLICATION_TYPE = 'Ansible/1.9.0' +APPLICATION_TYPE = 'Ansible/2.0.0' class PowerstoreReplicationRule(object): diff --git a/plugins/modules/replicationsession.py b/plugins/modules/replicationsession.py index 3a6fed4..1829589 100644 --- a/plugins/modules/replicationsession.py +++ b/plugins/modules/replicationsession.py @@ -25,57 +25,61 @@ filesystem: description: - Name/ID of the filesystem for which replication session exists. - - Parameter filesystem, nas_server, volume_group, volume, and session_id are mutually exclusive. - required: False + - Parameter I(filesystem), I(nas_server), I(volume_group), I(volume), + I(replication_group), and I(session_id) are mutually exclusive. type: str nas_server: description: - Name/ID of the NAS server for which replication session exists. - - Parameter filesystem, nas_server, volume_group, volume, and session_id are mutually exclusive. - required: False + - Parameter I(filesystem), I(nas_server), I(volume_group), I(volume), + I(replication_group), and I(session_id) are mutually exclusive. type: str volume_group: description: - Name/ID of the volume group for which a replication session exists. - - Parameter filesystem, nas_server, volume_group, volume, and session_id are mutually exclusive. - required: False + - Parameter I(filesystem), I(nas_server), I(volume_group), I(volume), + I(replication_group), and I(session_id) are mutually exclusive. type: str volume: description: - Name/ID of the volume for which replication session exists. - - Parameter filesystem, nas_server, volume_group, volume, and session_id are mutually exclusive. - required: False + - Parameter I(filesystem), I(nas_server), I(volume_group), I(volume), + I(replication_group), and I(session_id) are mutually exclusive. + type: str + replication_group: + description: + - Name or ID of the replication group for which replication session exists. + - Parameter I(filesystem), I(nas_server), I(volume_group), I(volume), + I(replication_group), and I(session_id) are mutually exclusive. type: str session_id: description: - ID of the replication session. - - Parameter filesystem, nas_server, volume_group, volume, and session_id are mutually exclusive. - required: False + - Parameter I(filesystem), I(nas_server), I(volume_group), I(volume), + I(replication_group), and I(session_id) are mutually exclusive. type: str session_state: description: - State in which the replication session is present after performing the task. - required: False choices: [ 'failed_over', 'paused', 'synchronizing'] type: str role: description: - Role of the metro replication session. - required: False choices: ['Metro_Preferred', 'Metro_Non_Preferred'] type: str notes: - Manual synchronization for a replication session is not supported through the Ansible module. - When the current state of the replication session is 'OK' and in the - playbook task 'synchronizing', then it will return "changed" as False. -- The changed as False in above scenario is because of there is a scheduled + playbook task C(synchronizing), then it will return "changed" as false. +- The changed as false in above scenario is because there is a scheduled synchronization in place with the associated replication rule's RPO in the protection policy. -- The check_mode is not supported. -- Parameter nas_server, filesystem, and role parameters are supported only for - PowerStore version 3.0.0. and above. +- The I(check_mode) is not supported. +- Parameter I(nas_server), I(filesystem), I(replication_group), and I(role) + parameters are supported only for PowerStore version 3.0.0. and above. ''' EXAMPLES = r''' @@ -226,7 +230,7 @@ VERSION_ERROR = py4ps_version['unsupported_version_message'] # Application type -APPLICATION_TYPE = 'Ansible/1.9.0' +APPLICATION_TYPE = 'Ansible/2.0.0' """ =============================================================================== Idempotency table for the replication session ansible module on the basis of @@ -283,8 +287,11 @@ def __init__(self): self.module_params.update(get_powerstore_rep_session_parameters()) # initialize the Ansible module - mut_ex_args = [['volume', 'volume_group', 'session_id', 'nas_server'], ['volume', 'volume_group', 'session_id', 'filesystem']] - required_one_of = [['volume', 'volume_group', 'session_id', 'filesystem', 'nas_server']] + mut_ex_args = [['volume', 'volume_group', 'session_id', 'nas_server'], + ['volume', 'volume_group', 'session_id', 'filesystem', + 'replication_group']] + required_one_of = [['volume', 'volume_group', 'session_id', + 'filesystem', 'nas_server', 'replication_group']] self.module = AnsibleModule( argument_spec=self.module_params, supports_check_mode=False, @@ -311,12 +318,14 @@ def __init__(self): def get_replication_session_details(self, session_id=None, vol=None, vol_grp=None, - filesystem=None, nas_server=None): + filesystem=None, nas_server=None, + replication_group=None): """Get replication session details""" msg = 'Getting the details of replication session, with ' \ - 'session_id:{0} or vol: ' \ - '{1}, vol_grp: {2}, filesystem: {3}' \ - ' or nas_server: {4}'.format(session_id, vol, vol_grp, filesystem, nas_server) + 'session_id:{0} or vol: {1}, vol_grp: {2}, filesystem: {3} or' \ + ' nas_server: {4} or replication group {5}'.\ + format(session_id, vol, vol_grp, filesystem, nas_server, + replication_group) LOG.info(msg) try: if session_id: @@ -333,7 +342,8 @@ def get_replication_session_details(self, session_id=None, LOG.info(msg) else: - local_resource_id = self.get_resource_id(vol, vol_grp, filesystem, nas_server) + local_resource_id = self.get_resource_id( + vol, vol_grp, filesystem, nas_server, replication_group) filter_dict = {'local_resource_id': "eq." + local_resource_id} # Get replication session returns the list of replication # session ids @@ -357,8 +367,10 @@ def get_replication_session_details(self, session_id=None, except Exception as e: msg = 'Get details of replication session with ID: {0} or ' \ - 'vol: {1}, vol_grp {2}, filesystem{3} or nas_server {4} on failed with error : ' \ - '{5} '.format(session_id, vol, vol_grp, filesystem, nas_server, str(e)) + 'vol: {1}, vol_grp {2}, filesystem{3} or nas_server {4} or' \ + ' replication group {5} failed with error : {6} '.\ + format(session_id, vol, vol_grp, filesystem, nas_server, + replication_group, str(e)) LOG.error(msg) self.module.fail_json(msg=msg, **utils.failure_codes(e)) @@ -403,104 +415,198 @@ def get_nas_server(self, nas_server): LOG.error(msg) self.module.fail_json(msg=msg, **utils.failure_codes(e)) - def get_resource_id(self, vol=None, vol_grp=None, filesystem=None, nas_server=None): + def get_resource_id(self, vol=None, vol_grp=None, filesystem=None, + nas_server=None, replication_group=None): """ Get the local resource id from the input playbook task parameters. This ID is of either the volume or the volume group which has the replication session associated with it. """ + if vol: + # when name of the volume is entered in vol parameter, then, + # fetching the id of the volume by name. + vol_id = self.get_volume_id(vol) + if vol_id: + return vol_id + + elif vol_grp: + # when name of the volume group is entered in vol_grp parameter + # ,then fetching the id of the volume group by name. + vg_id = self.get_volume_group_id(vol_grp) + if vg_id: + return vg_id + + elif filesystem: + # when name of the filesystem is entered in filesystem + # parameter,then fetching the id of the filesystem by name. + fs_id = self.get_filesystem_id(filesystem, nas_server) + if fs_id: + return fs_id + + elif replication_group: + # when name of the replication group is entered in + # replication_group parameter, then fetching the id of the + # replication group by name. + rep_grp_id = self.get_replication_group_id(replication_group) + if rep_grp_id: + return rep_grp_id + + else: + # when name of the NAS server is entered in nas_server + # parameter, then fetching the id of the NAS server by name. + nas_id = self.get_nas_server_id(nas_server) + if nas_id: + return nas_id + + def get_volume_id(self, vol): + """Get volume ID.""" try: - if vol: - # when name of the volume is entered in vol parameter, then, - # fetching the id of the volume by name. - if utils.name_or_id(vol) == "NAME": - vol_details = self.provisioning.get_volume_by_name(vol) - msg = "Volume details {0} fetched by volume name" \ - " {1}".format(str(vol_details), vol) - LOG.info(msg) + if utils.name_or_id(vol) == "NAME": + vol_details = self.provisioning.get_volume_by_name(vol) + msg = f"Volume details {vol_details} fetched by volume" \ + f" name {vol}" + LOG.info(msg) - if not vol_details: - err_msg = "Volume with name: {0} not found. Please " \ - "enter a valid name of the " \ - "volume.".format(vol) - self.module.fail_json(msg=err_msg) - return vol_details[0]['id'] - - # if ID is passed in vol parameter - return vol - - if vol_grp: - # when name of the volume group is entered in vol_grp parameter - # ,then fetching the id of the volume group by name. - if utils.name_or_id(vol_grp) == "NAME": - vol_grp_details = \ - self.provisioning.get_volume_group_by_name(vol_grp) - msg = "Volume group details {0} fetched by volume group" \ - " name {1}".format(str(vol_grp_details), vol_grp) - LOG.info(msg) + if not vol_details: + err_msg = f"Volume with name: {vol} not found. Please " \ + f"enter a valid name of the volume." + self.module.fail_json(msg=err_msg) + return vol_details[0]['id'] - if not vol_grp_details: - err_msg = "Volume group with name: {0} not found. " \ - "Please enter a valid name of the volume" \ - " group.".format(vol_grp) - self.module.fail_json(msg=err_msg) - return vol_grp_details[0]['id'] - - # if ID is passed in vol parameter - return vol_grp - - elif filesystem: - # when name of the filesystem is entered in filesystem parameter - # ,then fetching the id of the filesystem by name. - if utils.name_or_id(filesystem) == "NAME": - nas_server = self.get_nas_server(nas_server) - filesystem_details = \ - self.provisioning.get_filesystem_by_name(filesystem, nas_server) - msg = "Filesystem details {0} fetched by Filesystem" \ - " name {1}".format(str(filesystem_details), filesystem) - LOG.info(msg) + # if ID is passed in vol parameter + return vol + except Exception as e: + msg = f'Get local resource id for volume: {vol} failed with' \ + f' error {str(e)} : ' - if not filesystem_details: - err_msg = "Filesystem with name: {0} not found. " \ - "Please enter a valid name of the " \ - "filesystem.".format(filesystem) - self.module.fail_json(msg=err_msg) - return filesystem_details[0]['id'] + if isinstance(e, utils.PowerStoreException) and \ + e.err_code == utils.PowerStoreException.HTTP_ERR and \ + e.status_code == "404": + LOG.info(msg) + return None + LOG.error(msg) + self.module.fail_json(msg=msg, **utils.failure_codes(e)) - # if ID is passed in filesystem parameter - return filesystem + def get_volume_group_id(self, vol_grp): + """Get Volume group ID""" + try: + if utils.name_or_id(vol_grp) == "NAME": + vol_grp_details = \ + self.provisioning.get_volume_group_by_name(vol_grp) + msg = f"Volume group details {vol_grp_details} fetched by" \ + f" volume group name {vol_grp}" + LOG.info(msg) - else: - # when name of the NAS server is entered in nas_server parameter - # ,then fetching the id of the NAS server by name. - if utils.name_or_id(nas_server) == "NAME": - nas_server_details = \ - self.provisioning.get_nas_server_by_name(nas_server) - msg = "NAS server details {0} fetched by NAS server" \ - " name {1}".format(str(nas_server_details), nas_server) - LOG.info(msg) + if not vol_grp_details: + err_msg = f"Volume group with name: {vol_grp} not found." \ + f" Please enter a valid name of the volume" \ + f" group." + self.module.fail_json(msg=err_msg) + return vol_grp_details[0]['id'] + # if ID is passed in vol parameter + return vol_grp + + except Exception as e: + msg = f'Get local resource id for volume group: {vol_grp} ' \ + f'failed with error {str(e)} : ' - if not nas_server_details: - err_msg = "NAS server with name: {0} not found. " \ - "Please enter a valid name of the NAS" \ - " server.".format(nas_server) - self.module.fail_json(msg=err_msg) - return nas_server_details[0]['id'] + if isinstance(e, utils.PowerStoreException) and \ + e.err_code == utils.PowerStoreException.HTTP_ERR and \ + e.status_code == "404": + LOG.info(msg) + return None + LOG.error(msg) + self.module.fail_json(msg=msg, **utils.failure_codes(e)) - # if ID is passed in nas_server parameter - return nas_server + def get_filesystem_id(self, filesystem, nas_server): + """Get file system ID""" + try: + if utils.name_or_id(filesystem) == "NAME": + nas_server = self.get_nas_server(nas_server) + filesystem_details = \ + self.provisioning.get_filesystem_by_name(filesystem, + nas_server) + msg = f"Filesystem details {filesystem_details} fetched by" \ + f" Filesystem name {filesystem}." + LOG.info(msg) + + if not filesystem_details: + err_msg = f"Filesystem with name: {filesystem} not found" \ + f". Please enter a valid name of the filesystem." + self.module.fail_json(msg=err_msg) + return filesystem_details[0]['id'] + # if ID is passed in filesystem parameter + return filesystem + + except Exception as e: + msg = f'Get local resource id for filesystem: {filesystem}' \ + f' failed with error {str(e)} : ' + + if isinstance(e, utils.PowerStoreException) and \ + e.err_code == utils.PowerStoreException.HTTP_ERR and \ + e.status_code == "404": + LOG.info(msg) + return None + LOG.error(msg) + self.module.fail_json(msg=msg, **utils.failure_codes(e)) + + def get_nas_server_id(self, nas_server): + """Get the NAS Server ID""" + try: + if utils.name_or_id(nas_server) == "NAME": + nas_server_details = \ + self.provisioning.get_nas_server_by_name(nas_server) + msg = f"NAS server details {nas_server_details} fetched by" \ + f" NAS server name {nas_server}" + LOG.info(msg) + + if not nas_server_details: + err_msg = f"NAS server with name: {nas_server} not found" \ + f". Please enter a valid name of the NAS server." + self.module.fail_json(msg=err_msg) + return nas_server_details[0]['id'] + # if ID is passed in nas_server parameter + return nas_server except Exception as e: - msg = 'Get local resource id for volume: {0}, volume group {1}, ' \ - ' filesystem{2} or nas_server: {3} on failed with error : ' \ - '{4} '.format(vol, vol_grp, filesystem, nas_server, str(e)) + msg = f'Get local resource id for nas server: {nas_server}' \ + f' failed with error {str(e)} : ' if isinstance(e, utils.PowerStoreException) and \ e.err_code == utils.PowerStoreException.HTTP_ERR and \ e.status_code == "404": LOG.info(msg) return None + LOG.error(msg) + self.module.fail_json(msg=msg, **utils.failure_codes(e)) + + def get_replication_group_id(self, replication_group): + """Get the ID of the replication group.""" + try: + if utils.name_or_id(replication_group) == "NAME": + rpl_grp_details = self.protection.\ + get_replication_group_details_by_name(replication_group) + msg = f"Replication group details {rpl_grp_details} fetched" \ + f" by replication group name {replication_group}" + LOG.info(msg) + + if not rpl_grp_details: + err_msg = f"Replication group with name:" \ + f" {replication_group} not found. Please enter" \ + f" a valid name of the Replication group." + self.module.fail_json(msg=err_msg) + return rpl_grp_details[0]['id'] + # if ID is passed in replication group parameter + return replication_group + except Exception as e: + msg = f'Get local resource id for replication group:' \ + f' {replication_group} failed with error {str(e)} : ' + if isinstance(e, utils.PowerStoreException) and \ + e.err_code == utils.PowerStoreException.HTTP_ERR and \ + e.status_code == "404": + LOG.info(msg) + return None LOG.error(msg) self.module.fail_json(msg=msg, **utils.failure_codes(e)) @@ -786,6 +892,7 @@ def perform_module_operation(self): vol_grp = self.module.params['volume_group'] filesystem = self.module.params['filesystem'] nas_server = self.module.params['nas_server'] + replication_group = self.module.params['replication_group'] session_id = self.module.params['session_id'] session_state = self.module.params['session_state'] role = self.module.params['role'] @@ -804,11 +911,15 @@ def perform_module_operation(self): # Get the replication session details. rep_session_details = self.get_replication_session_details( - session_id, vol, vol_grp, filesystem, nas_server) + session_id, vol, vol_grp, filesystem, nas_server, + replication_group) if not rep_session_details: err_msg = "No replication session found with id {0}/ volume {1}/" \ - " volume group{2}/ filesystem{3}/ NAS server{4}.".format(session_id, vol, vol_grp, filesystem, nas_server) + " volume group{2}/ filesystem{3}/ NAS server{4} / " \ + "Replication Group {5}.".format(session_id, vol, vol_grp, + filesystem, nas_server, + replication_group) self.module.fail_json(msg=err_msg) if not session_id: session_id = rep_session_details['id'] @@ -890,21 +1001,29 @@ def show_output(self, session_id): rep_session_details['local_resource_name'] = \ vg_details['name'] - if rep_session_details["resource_type"] == "volume": + elif rep_session_details["resource_type"] == "volume": vol_details = self.provisioning.get_volume_details(res_id) rep_session_details['local_resource_name'] = \ vol_details['name'] - if rep_session_details["resource_type"] == "filesystem": - filesystem_details = self.provisioning.get_filesystem_details(res_id) + elif rep_session_details["resource_type"] == "filesystem": + filesystem_details = self.provisioning.\ + get_filesystem_details(res_id) rep_session_details['local_resource_name'] = \ filesystem_details['name'] - if rep_session_details["resource_type"] == "nas_server": - nas_server_details = self.provisioning.get_nas_server_details(res_id) + elif rep_session_details["resource_type"] == "nas_server": + nas_server_details = self.provisioning.\ + get_nas_server_details(res_id) rep_session_details['local_resource_name'] = \ nas_server_details['name'] + elif rep_session_details["resource_type"] == "replication_group": + rep_group_details = self.protection.\ + get_replication_group_details(res_id) + rep_session_details['local_resource_name'] = \ + rep_group_details['name'] + return rep_session_details except Exception as e: @@ -925,7 +1044,7 @@ def get_powerstore_rep_session_parameters(): operations for PowerStore""" return dict( - volume_group=dict(), volume=dict(), + volume_group=dict(), volume=dict(), replication_group=dict(), filesystem=dict(), nas_server=dict(), session_id=dict(), session_state=dict(type='str', choices=['synchronizing', 'paused', 'failed_over']), diff --git a/plugins/modules/role.py b/plugins/modules/role.py index c9d42cc..c2d8279 100644 --- a/plugins/modules/role.py +++ b/plugins/modules/role.py @@ -34,8 +34,8 @@ state: description: - Define whether the role should exist or not. - - Value present, indicates that the role should exist on the system. - - Value absent, indicates that the role should not exist on the system. + - Value C(present), indicates that the role should exist on the system. + - Value C(absent), indicates that the role should not exist on the system. type: str required: true choices: ['absent', 'present'] @@ -44,14 +44,14 @@ - Only getting the details of the role is supported by the ansible module. - Creation, modification and deletion of roles is not supported by the ansible modules. -- The check_mode is not supported. +- The I(check_mode) is not supported. ''' EXAMPLES = r''' - name: Get the details of role by name dellemc.powerstore.role: array_ip: "{{array_ip}}" - verifycert: "{{verify_cert}}" + validate_certs: "{{verify_cert}}" user: "{{user}}" password: "{{password}}" role_name: "Administrator" @@ -60,7 +60,7 @@ - name: Get the details of role by id dellemc.powerstore.role: array_ip: "{{array_ip}}" - verifycert: "{{verify_cert}}" + validate_certs: "{{verify_cert}}" user: "{{user}}" password: "{{password}}" role_id: "1" @@ -71,7 +71,7 @@ description: Whether or not the resource has changed. returned: always type: bool - sample: True + sample: true role_details: description: The role details. @@ -113,7 +113,7 @@ VERSION_ERROR = py4ps_version['unsupported_version_message'] # Application type -APPLICATION_TYPE = 'Ansible/1.9.0' +APPLICATION_TYPE = 'Ansible/2.0.0' class PowerStoreRole(object): diff --git a/plugins/modules/security_config.py b/plugins/modules/security_config.py index 2eb0b6b..013ddaa 100644 --- a/plugins/modules/security_config.py +++ b/plugins/modules/security_config.py @@ -29,7 +29,7 @@ - ID of the security configuration. - Mandatory for all operations. type: int - required: True + required: true protocol_mode: description: - Protocol mode of the security configuration. @@ -40,21 +40,21 @@ description: - Define whether the security config should exist or not. choices: ['absent', 'present'] - required: True + required: true type: str notes: - Creation and deletion of security configs is not supported by Ansible modules. - Modification of protocol mode is only supported for PowerStore v2.0.0.0 and above. -- The check_mode is not supported. +- The I(check_mode) is not supported. ''' EXAMPLES = r''' - name: Get security config dellemc.powerstore.security_config: array_ip: "{{array_ip}}" - verifycert: "{{verifycert}}" + validate_certs: "{{validate_certs}}" user: "{{user}}" password: "{{password}}" security_config_id: 1 @@ -63,7 +63,7 @@ - name: Modify attribute of security config dellemc.powerstore.security_config: array_ip: "{{array_ip}}" - verifycert: "{{verifycert}}" + validate_certs: "{{validate_certs}}" user: "{{user}}" password: "{{password}}" security_config_id: 1 @@ -116,7 +116,7 @@ VERSION_ERROR = py4ps_version['unsupported_version_message'] # Application type -APPLICATION_TYPE = 'Ansible/1.9.0' +APPLICATION_TYPE = 'Ansible/2.0.0' class PowerStoreSecurityConfig(object): diff --git a/plugins/modules/smbshare.py b/plugins/modules/smbshare.py index 2db674e..be62d41 100644 --- a/plugins/modules/smbshare.py +++ b/plugins/modules/smbshare.py @@ -21,15 +21,15 @@ description: - Name of the SMB share. - Required during creation of the SMB share. - - For all other operations either share_name or share_id is required. + - For all other operations either I(share_name) or I(share_id) is required. type: str share_id: description: - ID of the SMB share. - Should not be specified during creation. ID is auto generated. - - For all other operations either share_name or share_id is required. - - If share_id is used then no need to pass nas_server/filesystem/snapshot/ - path. + - For all other operations either I(share_name) or I(share_id) is required. + - If I(share_id) is used then no need to pass I(nas_server)/I(filesystem)/I(snapshot)/ + I(path). type: str path: description: @@ -43,7 +43,7 @@ description: - The ID/Name of the File System. - Either filesystem or snapshot is required for creation of the SMB share. - - If filesystem name is specified, then nas_server is required to + - If filesystem name is specified, then I(nas_server) is required to uniquely identify the filesystem. - If filesystem parameter is provided, then snapshot cannot be specified. type: str @@ -51,7 +51,7 @@ description: - The ID/Name of the Snapshot. - Either filesystem or snapshot is required for creation of the SMB share. - - If snapshot name is specified, then nas_server is required to + - If snapshot name is specified, then I(nas_server) is required to uniquely identify the snapshot. - If snapshot parameter is provided, then filesystem cannot be specified. - SMB share can be created only if access type of snapshot is "protocol". @@ -59,7 +59,7 @@ nas_server: description: - The ID/Name of the NAS Server. - - It is not required if share_id is used. + - It is not required if I(share_id) is used. type: str description: description: @@ -71,57 +71,57 @@ description: - Indicates whether Access-based Enumeration (ABE) for SMB share is enabled. - - During creation, if not mentioned, then the default is False. + - During creation, if not mentioned, then the default is C(false). type: bool is_branch_cache_enabled: description: - Indicates whether Branch Cache optimization for SMB share is enabled. - - During creation, if not mentioned then default is False. + - During creation, if not mentioned then default is C(false). type: bool is_continuous_availability_enabled: description: - Indicates whether continuous availability for SMB 3.0 is enabled. - - During creation, if not mentioned, then the default is False. + - During creation, if not mentioned, then the default is C(false). type: bool is_encryption_enabled: description: - Indicates whether encryption for SMB 3.0 is enabled at the shared folder level. - - During creation, if not mentioned then default is False. + - During creation, if not mentioned then default is C(false). type: bool offline_availability: description: - Defines valid states of Offline Availability. - - MANUAL- Only specified files will be available offline. - - DOCUMENTS- All files that users open will be available offline. - - PROGRAMS- Program will preferably run from the offline cache even when + - C(MANUAL)- Only specified files will be available offline. + - C(DOCUMENTS)- All files that users open will be available offline. + - C(PROGRAMS)- Program will preferably run from the offline cache even when connected to the network. All files that users open will be available offline. - - NONE- Prevents clients from storing documents and programs in offline + - C(NONE)- Prevents clients from storing documents and programs in offline cache. type: str choices: ["MANUAL","DOCUMENTS","PROGRAMS","NONE"] umask: description: - The default UNIX umask for new files created on the SMB Share. - - During creation, if not mentioned, then the default is "022". + - During creation, if not mentioned, then the default is 022. - For all other operations, the default is None. type: str state: description: - Define whether the SMB share should exist or not. - - Value present indicates that the share should exist on the system. - - Value absent indicates that the share should not exist on the system. + - Value C(present) indicates that the share should exist on the system. + - Value C(absent) indicates that the share should not exist on the system. type: str required: true choices: ['absent', 'present'] notes: -- When the ID of the filesystem/snapshot is passed then nas_server is not +- When the ID of the filesystem/snapshot is passed then I(nas_server) is not required. If passed, then the filesystem/snapshot should exist for the - nas_server, else the task will fail. + I(nas_server), else the task will fail. - Multiple SMB shares can be created for the same local path. -- The check_mode is not supported. +- The I(check_mode) is not supported. ''' EXAMPLES = r''' @@ -129,7 +129,7 @@ - name: Create SMB share for a filesystem dellemc.powerstore.smbshare: array_ip: "{{array_ip}}" - verifycert: "{{verifycert}}" + validate_certs: "{{validate_certs}}" user: "{{user}}" password: "{{password}}" share_name: "sample_smb_share" @@ -137,34 +137,34 @@ nas_server: "{{nas_server_id}}" path: "{{path}}" description: "Sample SMB share created" - is_abe_enabled: True - is_branch_cache_enabled: True + is_abe_enabled: true + is_branch_cache_enabled: true offline_availability: "DOCUMENTS" - is_continuous_availability_enabled: True - is_encryption_enabled: True + is_continuous_availability_enabled: true + is_encryption_enabled: true state: "present" - name: Modify Attributes of SMB share for a filesystem dellemc.powerstore.smbshare: array_ip: "{{array_ip}}" - verifycert: "{{verifycert}}" + validate_certs: "{{validate_certs}}" user: "{{user}}" password: "{{password}}" share_name: "sample_smb_share" nas_server: "sample_nas_server" description: "Sample SMB share attributes updated" - is_abe_enabled: False - is_branch_cache_enabled: False + is_abe_enabled: false + is_branch_cache_enabled: false offline_availability: "MANUAL" - is_continuous_availability_enabled: False - is_encryption_enabled: False + is_continuous_availability_enabled: false + is_encryption_enabled: false umask: "022" state: "present" - name: Create SMB share for a snapshot dellemc.powerstore.smbshare: array_ip: "{{array_ip}}" - verifycert: "{{verifycert}}" + validate_certs: "{{validate_certs}}" user: "{{user}}" password: "{{password}}" share_name: "sample_snap_smb_share" @@ -172,31 +172,31 @@ nas_server: "{{nas_server_id}}" path: "{{path}}" description: "Sample SMB share created for snapshot" - is_abe_enabled: True - is_branch_cache_enabled: True - is_continuous_availability_enabled: True + is_abe_enabled: true + is_branch_cache_enabled: true + is_continuous_availability_enabled: true state: "present" - name: Modify Attributes of SMB share for a snapshot dellemc.powerstore.smbshare: array_ip: "{{array_ip}}" - verifycert: "{{verifycert}}" + validate_certs: "{{validate_certs}}" user: "{{user}}" password: "{{password}}" share_name: "sample_snap_smb_share" nas_server: "sample_nas_server" description: "Sample SMB share attributes updated for snapshot" - is_abe_enabled: False - is_branch_cache_enabled: False + is_abe_enabled: false + is_branch_cache_enabled: false offline_availability: "MANUAL" - is_continuous_availability_enabled: False + is_continuous_availability_enabled: false umask: "022" state: "present" - name: Get details of SMB share dellemc.powerstore.smbshare: array_ip: "{{array_ip}}" - verifycert: "{{verifycert}}" + validate_certs: "{{validate_certs}}" user: "{{user}}" password: "{{password}}" share_id: "{{smb_share_id}}" @@ -205,7 +205,7 @@ - name: Delete SMB share dellemc.powerstore.smbshare: array_ip: "{{array_ip}}" - verifycert: "{{verifycert}}" + validate_certs: "{{validate_certs}}" user: "{{user}}" password: "{{password}}" share_id: "{{smb_share_id}}" @@ -217,7 +217,7 @@ description: Whether or not the resource has changed. returned: always type: bool - sample: True + sample: true smb_share_details: description: The SMB share details. @@ -311,7 +311,7 @@ VERSION_ERROR = py4ps_version['unsupported_version_message'] # Application type -APPLICATION_TYPE = 'Ansible/1.9.0' +APPLICATION_TYPE = 'Ansible/2.0.0' class PowerStoreSMBShare(object): diff --git a/plugins/modules/smtp_config.py b/plugins/modules/smtp_config.py index 36d7186..f1ffb7a 100644 --- a/plugins/modules/smtp_config.py +++ b/plugins/modules/smtp_config.py @@ -25,41 +25,37 @@ smtp_id: description: - Unique identifier of the SMTP configuration. - required: True + required: true type: int smtp_address: description: - IP address of the SMTP server. - required: False type: str smtp_port: description: - Port used for sending SMTP messages. - required: False type: int source_email: description: - Source email address used for sending SMTP messages. - required: False type: str destination_email: description: - Destination email address for the test. - required: False type: str state: description: - The state of the SMTP configuration after the task is performed. - - For Delete operation only, it should be set to "absent". - - For all operations it should be set to "present". - required : True + - For Delete operation only, it should be set to C(absent) + - For all operations it should be set to C(present). + required : true choices: [ 'present', 'absent'] type: str notes: - Idempotency is not supported for test operation for smtp_config module. - Creation and deletion of SMTP configuration is not supported. -- The check_mode is not supported. +- The I(check_mode) is not supported. ''' EXAMPLES = r''' @@ -68,7 +64,7 @@ array_ip: "{{array_ip}}" user: "{{user}}" password: "{{password}}" - verifycert: "{{verifycert}}" + validate_certs: "{{validate_certs}}" smtp_id: "0" state: "present" @@ -77,7 +73,7 @@ array_ip: "{{array_ip}}" user: "{{user}}" password: "{{password}}" - verifycert: "{{verifycert}}" + validate_certs: "{{validate_certs}}" smtp_id: "0" smtp_address: "sample.smtp.com" source_email: "def@dell.com" @@ -88,7 +84,7 @@ array_ip: "{{array_ip}}" user: "{{user}}" password: "{{password}}" - verifycert: "{{verifycert}}" + validate_certs: "{{validate_certs}}" smtp_id: "0" destination_email: "abc@dell.com" state: "present" @@ -143,7 +139,7 @@ VERSION_ERROR = py4ps_version['unsupported_version_message'] # Application type -APPLICATION_TYPE = 'Ansible/1.9.0' +APPLICATION_TYPE = 'Ansible/2.0.0' class PowerstoreSmtpConfig(object): diff --git a/plugins/modules/snapshot.py b/plugins/modules/snapshot.py index 2e8e5f1..c9538ba 100644 --- a/plugins/modules/snapshot.py +++ b/plugins/modules/snapshot.py @@ -55,9 +55,9 @@ retention_unit: description: - The unit for retention. - - If this unit is not specified, 'hours' is taken as default - retention_unit. - - If desired_retention is specified, expiration_timestamp cannot be + - If this unit is not specified, C(hours) is taken as default + I(retention_unit). + - If I(desired_retention) is specified, I(expiration_timestamp) cannot be specified. choices: [hours, days] type: str @@ -78,14 +78,14 @@ type: str notes: -- The check_mode is not supported. +- The I(check_mode) is not supported. ''' EXAMPLES = r''' - name: Create a volume snapshot on PowerStore dellemc.powerstore.snapshot: array_ip: "{{mgmt_ip}}" - verifycert: "{{verifycert}}" + validate_certs: "{{validate_certs}}" user: "{{user}}" password: "{{password}}" snapshot_name: "{{snapshot_name}}" @@ -98,7 +98,7 @@ - name: Get details of a volume snapshot dellemc.powerstore.snapshot: array_ip: "{{mgmt_ip}}" - verifycert: "{{verifycert}}" + validate_certs: "{{validate_certs}}" user: "{{user}}" password: "{{password}}" snapshot_name: "{{snapshot_name}}" @@ -108,7 +108,7 @@ - name: Rename volume snapshot dellemc.powerstore.snapshot: array_ip: "{{mgmt_ip}}" - verifycert: "{{verifycert}}" + validate_certs: "{{validate_certs}}" user: "{{user}}" password: "{{password}}" snapshot_name: "{{snapshot_name}}" @@ -119,7 +119,7 @@ - name: Delete volume snapshot dellemc.powerstore.snapshot: array_ip: "{{mgmt_ip}}" - verifycert: "{{verifycert}}" + validate_certs: "{{validate_certs}}" user: "{{user}}" password: "{{password}}" snapshot_name: "{{new_snapshot_name}}" @@ -129,7 +129,7 @@ - name: Create a volume group snapshot on PowerStore dellemc.powerstore.snapshot: array_ip: "{{mgmt_ip}}" - verifycert: "{{verifycert}}" + validate_certs: "{{validate_certs}}" user: "{{user}}" password: "{{password}}" snapshot_name: "{{snapshot_name}}" @@ -141,7 +141,7 @@ - name: Get details of a volume group snapshot dellemc.powerstore.snapshot: array_ip: "{{mgmt_ip}}" - verifycert: "{{verifycert}}" + validate_certs: "{{validate_certs}}" user: "{{user}}" password: "{{password}}" snapshot_name: "{{snapshot_name}}" @@ -151,7 +151,7 @@ - name: Modify volume group snapshot expiration timestamp dellemc.powerstore.snapshot: array_ip: "{{mgmt_ip}}" - verifycert: "{{verifycert}}" + validate_certs: "{{validate_certs}}" user: "{{user}}" password: "{{password}}" snapshot_name: "{{snapshot_name}}" @@ -163,7 +163,7 @@ - name: Rename volume group snapshot dellemc.powerstore.snapshot: array_ip: "{{mgmt_ip}}" - verifycert: "{{verifycert}}" + validate_certs: "{{validate_certs}}" user: "{{user}}" password: "{{password}}" snapshot_name: "{{snapshot_name}}" @@ -174,7 +174,7 @@ - name: Delete volume group snapshot dellemc.powerstore.snapshot: array_ip: "{{mgmt_ip}}" - verifycert: "{{verifycert}}" + validate_certs: "{{validate_certs}}" user: "{{user}}" password: "{{password}}" snapshot_name: "{{new_snapshot_name}}" @@ -344,7 +344,7 @@ VERSION_ERROR = py4ps_version['unsupported_version_message'] # Application type -APPLICATION_TYPE = 'Ansible/1.9.0' +APPLICATION_TYPE = 'Ansible/2.0.0' class PowerStoreSnapshot(object): diff --git a/plugins/modules/snapshotrule.py b/plugins/modules/snapshotrule.py index 7737669..427856f 100644 --- a/plugins/modules/snapshotrule.py +++ b/plugins/modules/snapshotrule.py @@ -24,28 +24,24 @@ name: description: - String variable. Indicates the name of the Snapshot rule. - required: False type: str snapshotrule_id: description: - String variable. Indicates the ID of the Snapshot rule. - required: False type: str new_name: description: - String variable. Indicates the new name of the Snapshot rule. - Used for renaming operation. - required: False type: str days_of_week: description: - List of strings to specify days of the week on which the Snapshot rule should be applied. Must be applied for Snapshot rules where the - 'time_of_day' parameter is set. + I(time_of_day) parameter is set. - Optional for the Snapshot rule created with an interval. When - 'days_of_week' is not specified for a new Snapshot rule, the rule is + I(days_of_week) is not specified for a new Snapshot rule, the rule is applied on every day of the week. - required: False choices: [ Monday, Tuesday, Wednesday, Thursday, Friday, Saturday, Sunday ] type: list @@ -53,9 +49,9 @@ interval: description : - String variable. Indicates the interval between Snapshots. - - When creating a Snapshot rule, specify either "interval" or - "time_of_day", but not both. - required : False + - When creating a Snapshot rule, specify either I(interval) or + I(time_of_day), but not both. + required : false choices: [ Five_Minutes, Fifteen_Minutes, Thirty_Minutes, One_Hour, Two_Hours, Three_Hours, Four_Hours, Six_Hours, Eight_Hours, Twelve_Hours, One_Day ] @@ -64,38 +60,38 @@ description: - Integer variable. Indicates the desired Snapshot retention period. - It is required when creating a new Snapshot rule. - required : False + required : false type: int time_of_day: description: - String variable. Indicates the time of the day to take a daily Snapshot, with the format "hh:mm" in 24 hour time format. - - When creating a Snapshot rule, specify either "interval"or - "time_of_day" but not both. - required : False + - When creating a Snapshot rule, specify either I(interval) or + I(time_of_day) but not both. + required : false type: str delete_snaps: description: - Boolean variable to specify whether all Snapshots previously created by this rule should also be deleted when this rule is removed. - - True specifies to delete all previously created Snapshots by this rule + - C(true) specifies to delete all previously created Snapshots by this rule while deleting this rule. - - False specifies to retain all previously created Snapshots while + - C(false) specifies to retain all previously created Snapshots while deleting this rule. type: bool - default: False + default: false state: description: - String variable indicates the state of Snapshot rule. - - For "Delete" operation only, it should be set to "absent". + - For "Delete" operation only, it should be set to C(absent). - For all Create, Modify or Get details operation it should be set to - "present". - required : True + C(present). + required : true choices: [ present, absent] type: str notes: -- The check_mode is not supported. +- The I(check_mode) is not supported. ''' EXAMPLES = r''' @@ -103,7 +99,7 @@ - name: Get details of an existing snapshot rule by name dellemc.powerstore.snapshotrule: array_ip: "{{array_ip}}" - verifycert: "{{verifycert}}" + validate_certs: "{{validate_certs}}" user: "{{user}}" password: "{{password}}" name: "{{name}}" @@ -112,7 +108,7 @@ - name: Get details of an existing snapshot rule by id dellemc.powerstore.snapshotrule: array_ip: "{{array_ip}}" - verifycert: "{{verifycert}}" + validate_certs: "{{validate_certs}}" user: "{{user}}" password: "{{password}}" snapshotrule_id: "{{snapshotrule_id}}" @@ -121,7 +117,7 @@ - name: Create new snapshot rule by interval dellemc.powerstore.snapshotrule: array_ip: "{{array_ip}}" - verifycert: "{{verifycert}}" + validate_certs: "{{validate_certs}}" user: "{{user}}" password: "{{password}}" name: "{{name}}" @@ -135,7 +131,7 @@ - name: Create new snapshot rule by time_of_day and days_of_week dellemc.powerstore.snapshotrule: array_ip: "{{array_ip}}" - verifycert: "{{verifycert}}" + validate_certs: "{{validate_certs}}" user: "{{user}}" password: "{{password}}" name: "{{name}}" @@ -150,7 +146,7 @@ - name: Modify existing snapshot rule to time_of_day and days_of_week dellemc.powerstore.snapshotrule: array_ip: "{{array_ip}}" - verifycert: "{{verifycert}}" + validate_certs: "{{validate_certs}}" user: "{{user}}" password: "{{password}}" name: "{{name}}" @@ -165,7 +161,7 @@ - name: Modify existing snapshot rule to interval dellemc.powerstore.snapshotrule: array_ip: "{{array_ip}}" - verifycert: "{{verifycert}}" + validate_certs: "{{validate_certs}}" user: "{{user}}" password: "{{password}}" name: "{{name}}" @@ -175,7 +171,7 @@ - name: Delete an existing snapshot rule by name dellemc.powerstore.snapshotrule: array_ip: "{{array_ip}}" - verifycert: "{{verifycert}}" + validate_certs: "{{validate_certs}}" user: "{{user}}" password: "{{password}}" name: "{{name}}" @@ -258,7 +254,7 @@ VERSION_ERROR = py4ps_version['unsupported_version_message'] # Application type -APPLICATION_TYPE = 'Ansible/1.9.0' +APPLICATION_TYPE = 'Ansible/2.0.0' class PowerstoreSnapshotrule(object): diff --git a/plugins/modules/storage_container.py b/plugins/modules/storage_container.py new file mode 100644 index 0000000..52df8e1 --- /dev/null +++ b/plugins/modules/storage_container.py @@ -0,0 +1,865 @@ +#!/usr/bin/python +# Copyright: (c) 2023, Dell Technologies +# Apache License version 2.0 (see MODULE-LICENSE or http://www.apache.org/licenses/LICENSE-2.0.txt) + +from __future__ import absolute_import, division, print_function + +__metaclass__ = type + +DOCUMENTATION = r''' +module: storage_container +version_added: '2.0.0' +short_description: Manage storage container for PowerStore +description: +- Managing storage containers on PowerStore Storage System includes creating + a storage container, getting details of a storage container, modifying a + storage container and deleting a storage container. +- This module also supports creating and deleting storage container + destinations. + +author: +- Trisha Datta (@trisha-dell) +- Bhavneet Sharma (@Bhavneet-Sharma) + +extends_documentation_fragment: + - dellemc.powerstore.powerstore + +options: + storage_container_id: + description: + - The unique identifier of the storage container. + type: str + storage_container_name: + description: + - Name for the storage container. + - This should be unique across all storage containers in the cluster. + type: str + quota: + description: + - The total number of bytes that can be provisioned/reserved against this + storage container. + - A value of C(0) means there is no limit. + - It is possible to set the quota to a value that overprovisions the amount + of space available in the system. + type: int + quota_unit: + description: + - Unit of the quota. + choices: ['GB', 'TB', 'PB'] + type: str + default: 'GB' + storage_protocol: + description: + - The type of storage container. + - C(SCSI) is set when a storage container is dedicated to C(SCSI) usage. + - C(NVMe) is set when a storage container is dedicated to C(NVMe) usage. + type: str + choices: ['SCSI', 'NVMe'] + high_water_mark: + description: + - This is the percentage of the quota that can be consumed before an alert + is raised. + - This is used only for creating a storage container. + type: int + new_name: + description: + - The new name of the storage container. + type: str + force_delete: + description: + - This option overrides the error and allows the deletion to continue in + case there are any vVols associated with the storage container. + - Use with great caution. + type: bool + default: false + state: + description: + - Define whether the storage container should exist or not. + - For Delete operation only, it should be set to C(absent). + required: false + choices: ['absent', 'present'] + type: str + default: 'present' + storage_container_destination_state: + description: + - Define whether the storage container destination should exist in the + storage container. + - To delete storage container destination, it should be C(absent). + choices: ['present', 'absent'] + type: str + default: 'present' + storage_container_destination: + description: + - It contains details of remote system and remote storage container. + - It is required while creating and deleting storage container + destinations. + type: dict + suboptions: + remote_system: + description: + - Name or ID of the remote system. + required: true + type: str + remote_address: + description: + - The IP address of the remote storage system. + type: str + required: true + user: + description: + - Username of the remote PowerStore storage system. + required: true + type: str + password: + description: + - Password of the remote PowerStore storage system. + required: true + type: str + port: + description: + - Port number of the remote PowerStore storage system. + type: int + default: 443 + timeout: + description: + - Time after which connection will be terminated. + - It is mentioned in seconds. + type: int + default: 120 + validate_certs: + description: + - Boolean variable to specify whether to validate SSL certificate or + not. + - C(true) - indicates that the SSL certificate should be verified. Set + the environment variable REQUESTS_CA_BUNDLE to the path of the SSL + certificate. + - C(false) - indicates that the SSL certificate should not be verified. + type: bool + default: true + aliases: + - verifycert + remote_storage_container: + description: + - Name or ID of the remote storage container on the remote storage + system. + required: true + type: str + +notes: +- The I(check_mode) is supported. +- Either storage container name or ID required while deleting the storage + container destination. +- The details of the storage container destination are embedded in the response + of the storage container. +''' + +EXAMPLES = r''' + +- name: Create a storage_container + dellemc.powerstore.storage_container: + array_ip: "{{array_ip}}" + validate_certs: "{{validate_certs}}" + user: "{{user}}" + password: "{{password}}" + storage_container_name: "Ansible_storage_container_1" + quota: 0 + storage_protocol: "SCSI" + high_water_mark: 60 + +- name: Get the details of the storage container using id + dellemc.powerstore.storage_container: + array_ip: "{{array_ip}}" + validate_certs: "{{validate_certs}}" + user: "{{user}}" + password: "{{password}}" + storage_container_id: "storage_container_id" + state: "present" + +- name: Get the details of the storage container by name + dellemc.powerstore.storage_container: + array_ip: "{{array_ip}}" + validate_certs: "{{validate_certs}}" + user: "{{user}}" + password: "{{password}}" + storage_container_name: "Ansible_storage_container_1" + +- name: Modify a storage container + dellemc.powerstore.storage_container: + array_ip: "{{array_ip}}" + validate_certs: "{{validate_certs}}" + user: "{{user}}" + password: "{{password}}" + storage_container_name: "Ansible_storage_container_1" + quota: 20 + quota_unit: "GB" + storage_protocol: "NVMe" + state: "present" + +- name: Rename a storage container + dellemc.powerstore.storage_container: + array_ip: "{{array_ip}}" + validate_certs: "{{validate_certs}}" + user: "{{user}}" + password: "{{password}}" + storage_container_name: "Ansible_storage_container_1" + new_name: "Ansible_storage_container_1_new" + +- name: Delete a storage container containing vVols + dellemc.powerstore.storage_container: + array_ip: "{{array_ip}}" + validate_certs: "{{validate_certs}}" + user: "{{user}}" + password: "{{password}}" + storage_container_name: "Ansible_storage_container_1" + force_delete: True + state: "absent" + +- name: Delete a storage container using id + dellemc.powerstore.storage_container: + array_ip: "{{array_ip}}" + validate_certs: "{{validate_certs}}" + user: "{{user}}" + password: "{{password}}" + storage_container_id: "storage_container_id_1" + state: "absent" + +- name: Create a storage container destination + dellemc.powerstore.storage_container: + array_ip: "{{array_ip}}" + user: "{{user}}" + password: "{{password}}" + validate_certs: "{{validate_certs}}" + storage_container_name: "local_storage_container" + storage_container_destination: + remote_address: "x.x.x.x" + user: "{{user}}" + password: "{{password}}" + validate_certs: "{{validate_certs}}" + remote_system: "remote_system_name" + remote_storage_container: "remote_storage_container_name" + +- name: Delete a storage container destination + dellemc.powerstore.storage_container: + array_ip: "{{array_ip}}" + user: "{{user}}" + password: "{{password}}" + validate_certs: "{{validate_certs}}" + storage_container_id: "storage_container_id" + storage_container_destination_state: "absent" + storage_container_destination: + remote_address: "x.x.x.x" + user: "{{user}}" + password: "{{password}}" + validate_certs: "{{validate_certs}}" + remote_system: "remote_system_name" + remote_storage_container: "remote_storage_container_name" +''' + +RETURN = r''' +changed: + description: Whether or not the resource has changed. + returned: always + type: bool + sample: "false" + +storage_container_details: + description: Details of the storage container. + returned: When storage container exists. + type: complex + contains: + id: + description: The unique identifier of the storage container. + type: str + name: + description: The name for the storage container. + type: str + storage_protocol: + description: The type of storage container. + type: str + quota: + description: The total number of bytes that can be + provisioned/reserved against this storage container. + type: int + replication_groups: + description: Properties of a Replication Group. + type: list + contains: + id: + description: Unique identifier of the Replication Group + instance. + type: str + name: + description: Name of the Replication Group. + type: str + virtual_volumes: + description: The virtual volumes associated to the storage + container. + type: list + contains: + id: + description: The unique identifier of the virtual volume. + type: str + name: + description: The name of the virtual volume. + type: str + destinations: + description: A storage container destination defines replication + destination for a local storage container on a + remote system. + type: list + contains: + id: + description: The unique id of the storage container + destination. + type: str + remote_system_id: + description: The unique id of the remote system. + type: str + remote_system_name: + description: The name of the remote system. + type: str + remote_storage_container_id: + description: The unique id of the destination storage + container on the remote system. + type: str + datastores: + description: List of associated datstores. + type: list + contains: + id: + description: Unique identifier of the datastore instance. + type: str + name: + description: User-assigned name of the datastore in vCenter. + type: str + + sample: { + "datastores": [], + "destinations": [], + "id": "e0ccd953-5650-41d8-9bce-f36d876d6a2a", + "name": "Ansible_storage_container_1", + "quota": 21474836480, + "replication_groups": [], + "storage_protocol": "NVMe", + "storage_protocol_l10n": "NVMe", + "virtual_volumes": [] + } +''' + +from ansible.module_utils.basic import AnsibleModule +from ansible_collections.dellemc.powerstore.plugins.module_utils.storage.dell \ + import utils + +LOG = utils.get_logger('storage_container') + +py4ps_sdk = utils.has_pyu4ps_sdk() +HAS_PY4PS = py4ps_sdk['HAS_Py4PS'] +IMPORT_ERROR = py4ps_sdk['Error_message'] + +py4ps_version = utils.py4ps_version_check() +IS_SUPPORTED_PY4PS_VERSION = py4ps_version['supported_version'] +VERSION_ERROR = py4ps_version['unsupported_version_message'] + +# Application type +APPLICATION_TYPE = 'Ansible/2.0.0' + + +class PowerStoreStorageContainer(object): + """Class with storage container Operations""" + cluster_name = None + cluster_global_id = None + + def __init__(self): + """Define all the parameters required by this module""" + self.module_params = utils.get_powerstore_management_host_parameters() + self.module_params.update( + get_powerstore_storage_container_parameters()) + + # initialize the Ansible module + mut_ex_args = [['storage_container_id', 'storage_container_name']] + required_one_of = [['storage_container_id', 'storage_container_name']] + + self.module = AnsibleModule( + argument_spec=self.module_params, + supports_check_mode=True, + mutually_exclusive=mut_ex_args, + required_one_of=required_one_of + ) + self.result = dict( + changed=False, + storage_container_details={} + ) + + msg = f'HAS_PY4PS = {HAS_PY4PS}, IMPORT_ERROR = {IMPORT_ERROR}' + LOG.info(msg) + if HAS_PY4PS is False: + self.module.fail_json(msg=IMPORT_ERROR) + msg = (f'IS_SUPPORTED_PY4PS_VERSION = {IS_SUPPORTED_PY4PS_VERSION} , ' + f'VERSION_ERROR = {VERSION_ERROR}') + LOG.info(msg) + if IS_SUPPORTED_PY4PS_VERSION is False: + self.module.fail_json(msg=VERSION_ERROR) + + self.conn = utils.get_powerstore_connection( + self.module.params, + application_type=APPLICATION_TYPE) + self.configuration = self.conn.config_mgmt + self.protection = self.conn.protection + msg = 'Got Py4ps instance for configuration {0} and protection {1}' \ + ' on PowerStore'.format(self.configuration, self.protection) + LOG.info(msg) + check_mode_msg = f'Check mode flag is {self.module.check_mode}' + LOG.info(check_mode_msg) + + def create_storage_container(self, storage_container_name, quota, + storage_protocol, high_water_mark): + """Create a storage container""" + try: + msg = f'Attempting to create a storage container with name' \ + f' {storage_container_name}' + LOG.info(msg) + con_details = {} + if not self.module.check_mode: + create_params = dict() + create_params['name'] = storage_container_name + create_params['quota'] = quota + create_params['storage_protocol'] = storage_protocol + create_params['high_water_mark'] = high_water_mark + + resp = self.configuration.create_storage_container( + create_parameters=create_params) + + if resp: + con_details = self.get_storage_container_details( + storage_container_id=resp['id']) + + msg = f'Successfully created storage container with details' \ + f' {con_details}' + LOG.info(msg) + + return con_details + + except Exception as e: + msg = (f'Creation of storage container with name' + f' {storage_container_name} on PowerStore array name : ' + f'{self.cluster_name} , global id : ' + f'{self.cluster_global_id} failed with error {str(e)} ') + LOG.error(msg) + self.module.fail_json(msg=msg, **utils.failure_codes(e)) + + def delete_storage_container(self, storage_container_id, force_delete): + """ Delete a storage container """ + + try: + msg = f'Deleting storage container with identifier:' \ + f' {storage_container_id}' + LOG.info(msg) + if not self.module.check_mode: + delete_params = {'force': force_delete} + self.configuration.delete_storage_container( + storage_container_id=storage_container_id, + delete_parameters=delete_params) + return self.get_storage_container_details( + storage_container_id=storage_container_id) + + except Exception as e: + msg = (f'Deletion of storage container {storage_container_id}' + f' failed with error { str(e) }') + LOG.error(msg) + self.module.fail_json(msg=msg, **utils.failure_codes(e)) + + def update_storage_container_details(self, con_details): + """Update the storage container destination detail""" + index = 0 + for dest in con_details['destinations']: + resp = self.get_remote_system(dest['remote_system_id'])['name'] + if resp is not None: + con_details['destinations'][index]['remote_system_name'] = resp + index += 1 + return con_details + + def get_remote_storage_container(self, remote_container): + """Get the remote storage container details with remote connection""" + try: + remote_container_name = remote_container_id = None + if utils.name_or_id(remote_container) == 'NAME': + remote_container_name = remote_container + else: + remote_container_id = remote_container + + remote_params = dict() + LOG.info("Getting remote storage container details") + remote_params['array_ip'] = self.module.params[ + 'storage_container_destination']['remote_address'] + con_params = ['user', 'password', 'validate_certs', 'port', + 'timeout'] + for parm in con_params: + if parm in self.module.params['storage_container_destination']: + remote_params[parm] = self.module.params[ + 'storage_container_destination'][parm] + + conn = utils.get_powerstore_connection( + remote_params, application_type=APPLICATION_TYPE) + remote_config = conn.config_mgmt + if remote_container_id: + con_details = remote_config.get_storage_container_details( + remote_container_id) + else: + con_details = remote_config.\ + get_storage_container_details_by_name(remote_container_name) + msg = f'Successfully got storage container details {con_details}' + LOG.debug(msg) + return con_details + except Exception as e: + msg = (f'Get remote storage container details for PowerStore array' + f' failed with error {str(e)} ') + LOG.error(msg) + self.module.fail_json(msg=msg, **utils.failure_codes(e)) + + def get_storage_container_details(self, storage_container_id=None, + storage_container_name=None): + """ Get storage container details by name or id """ + + try: + msg = (f'Getting storage container details with ' + f'storage_container_id {storage_container_id}, ' + f'storage_container_name {storage_container_name}') + LOG.info(msg) + con_details = None + if storage_container_id: + con_details = self.configuration.get_storage_container_details( + storage_container_id) + elif storage_container_name: + con_details = \ + self.configuration.get_storage_container_details_by_name( + storage_container_name) + + # update the storage container details with destination details + if con_details is not None and \ + con_details['destinations'] is not None: + con_details = self.update_storage_container_details( + con_details) + + msg = f'Successfully got storage container details {con_details}' + LOG.info(msg) + return con_details + + except Exception as e: + msg = (f'Get storage container details for PowerStore array name ' + f': {self.cluster_name} , global id : ' + f'{self.cluster_global_id} failed with error {str(e)} ') + if isinstance(e, utils.PowerStoreException) and \ + e.err_code == utils.PowerStoreException.HTTP_ERR \ + and e.status_code == "404": + LOG.info(msg) + return None + LOG.error(msg) + self.module.fail_json(msg=msg, **utils.failure_codes(e)) + + def is_modify_required(self, storage_container_details, quota, + storage_protocol, new_name): + """To get the details of the fields to be modified.""" + + msg = f'Storage container details: {storage_container_details}' + LOG.info(msg) + modify_dict = dict() + + if self.module.params['quota'] is not None and \ + quota != storage_container_details['quota']: + modify_dict['quota'] = quota + if storage_protocol is not None and \ + storage_protocol != storage_container_details['storage_protocol']: + modify_dict['storage_protocol'] = storage_protocol + if new_name is not None and \ + new_name != storage_container_details['name']: + modify_dict['name'] = new_name + + if modify_dict: + return modify_dict + else: + return None + + def modify_storage_container_details(self, storage_container_id, + modify_params): + """Perform modify operations on a storage container""" + + try: + if not self.module.check_mode: + self.configuration.modify_storage_container_details( + storage_container_id=storage_container_id, + modify_parameters=modify_params) + return True + except Exception as e: + msg = (f'Failed to modify the storage container instance ' + f'with error {str(e)}') + LOG.error(msg) + self.module.fail_json(msg=msg, **utils.failure_codes(e)) + + def get_remote_system(self, remote_system, remote_address=None): + """Get the remote system ID""" + try: + LOG.info("Getting remote system details") + remote_system_name = remote_system_id = None + if utils.name_or_id(remote_system) == 'ID': + remote_system_id = remote_system + else: + remote_system_name = remote_system + + if remote_system_name is not None: + resp = self.protection.get_remote_system_by_name( + remote_system_name) + if resp and len(resp) == 1: + if resp[0]['management_address'] == remote_address: + return resp[0] + else: + err_msg = f"Enter the valid remote_address for " \ + f"remote_system {remote_system}." + LOG.error(err_msg) + self.module.fail_json(msg=err_msg) + elif resp and len(resp) > 1: + resp = self.protection.get_remote_system_by_name( + remote_system_name, remote_address) + return resp[0] + + if remote_system_id: + resp = self.protection.get_remote_system_details( + remote_system_id) + return resp + except Exception as e: + msg = f'Failed to get the remote system {remote_system} with ' \ + f'error: {str(e)}' + LOG.error(msg) + self.module.fail_json(msg=msg, **utils.failure_codes(e)) + + def create_storage_container_destination(self, params, con_details): + """create the storage container destination""" + remote_sys_id = remote_con_id = None + remote_sys = self.get_remote_system( + params['storage_container_destination']['remote_system'], + params['storage_container_destination']['remote_address']) + if remote_sys is not None: + remote_sys_id = remote_sys['id'] + else: + msg = f"Unable to find the remote system " \ + f"{params['storage_container_destination']['remote_system']}" + self.module.fail_json(msg=msg) + + remote_con = self.get_remote_storage_container( + params['storage_container_destination']['remote_storage_container']) + if remote_con is not None: + remote_con_id = remote_con['id'] + else: + msg = f"Unable to find the remote storage container " \ + f"{params['storage_container_destination']['remote_storage_container']}" + self.module.fail_json(msg=msg) + + if con_details['destinations'] is not None: + all_dest = con_details['destinations'] + if is_destination_exists(all_dest, remote_sys_id, remote_con_id) \ + is not None: + # Destination container already exists, Idempotency + return False + try: + LOG.info("Creating the storage container destination for " + "the storage container.}") + create_params = dict() + create_params['storage_container_id'] = con_details.get('id') + create_params['remote_storage_container_id'] = remote_con_id + create_params['remote_system_id'] = remote_sys_id + + if not self.module.check_mode: + self.configuration.create_storage_container_destination( + create_destination_params=create_params) + return True + except Exception as e: + msg = f"Failed to create a storage container destination with " \ + f"error: {str(e)}" + LOG.error(msg) + self.module.fail_json(msg=msg, **utils.failure_codes(e)) + + def delete_storage_container_destination(self, params, con_details): + """Delete the storage container destination""" + if 'storage_container_destination' not in params or not \ + params['storage_container_destination']: + msg = "The storage_container_destination dict is required to " \ + "delete the storage container destination." + self.module.fail_json(msg=msg) + + remote_sys_id = remote_con_id = None + remote_sys = self.get_remote_system( + params['storage_container_destination']['remote_system'], + params['storage_container_destination']['remote_address']) + if remote_sys is not None: + remote_sys_id = remote_sys['id'] + else: + msg = f"Unable to find the remote system " \ + f"{params['storage_container_destination']['remote_system']}" + self.module.fail_json(msg=msg) + + remote_con = self.get_remote_storage_container( + params['storage_container_destination']['remote_storage_container']) + if remote_con is not None: + remote_con_id = remote_con['id'] + else: + msg = f"Unable to find the remote storage container " \ + f"{params['storage_container_destination']['remote_storage_container']}" + self.module.fail_json(msg=msg) + + try: + if con_details['destinations'] is not None: + all_dest = con_details['destinations'] + dest_id = is_destination_exists(all_dest, remote_sys_id, + remote_con_id) + if dest_id: + # Destination container exists + if not self.module.check_mode: + self.configuration.delete_storage_container_destination( + storage_container_destination_id=dest_id) + return True + except Exception as e: + msg = f"Failed to delete a storage container destination with " \ + f"error: {str(e)}" + LOG.error(msg) + self.module.fail_json(msg=msg, **utils.failure_codes(e)) + + +def is_destination_exists(destinations, remote_sys_id, remote_con_id): + """Check whether storage container exists or not""" + for dest in destinations: + if dest['remote_storage_container_id'] == remote_con_id and \ + dest['remote_system_id'] == remote_sys_id: + return dest['id'] + return None + + +def get_powerstore_storage_container_parameters(): + """This method provide the parameters required for the storage container + operations for PowerStore""" + return dict( + storage_container_id=dict(), storage_container_name=dict(), + new_name=dict(), quota=dict(type='int'), + quota_unit=dict(choices=['GB', 'TB', 'PB'], default='GB'), + high_water_mark=dict(type='int'), + storage_protocol=dict(choices=['SCSI', 'NVMe']), + force_delete=dict(type='bool', default=False), + state=dict(type='str', choices=['present', 'absent'], + default='present'), + storage_container_destination_state=dict( + choices=['present', 'absent'], default='present', type='str'), + storage_container_destination=dict(type='dict', options=dict( + remote_address=dict(required=True, type='str'), + user=dict(required=True, type='str'), + password=dict(required=True, no_log=True), + validate_certs=dict(type='bool', aliases=['verifycert'], + default=True), + port=dict(type='int', default=443), + timeout=dict(type='int', default=120), + remote_storage_container=dict(type='str', required=True), + remote_system=dict(type='str', required=True))) + ) + + +class StorageContainerCreateHandler(): + def handle(self, con_object, con_params, storage_container_details, quota): + if con_params['state'] == 'present' and not storage_container_details: + storage_container_details = con_object.create_storage_container( + storage_container_name=con_params['storage_container_name'], + quota=quota, storage_protocol=con_params['storage_protocol'], + high_water_mark=con_params['high_water_mark']) + con_object.result['changed'] = True + + StorageContainerModifyHandler().handle( + con_object, con_params, storage_container_details, quota) + + +class StorageContainerModifyHandler(): + def handle(self, con_object, con_params, storage_container_details, quota): + if con_params['state'] == 'present' and storage_container_details: + modify_params = con_object.is_modify_required( + storage_container_details=storage_container_details, + quota=quota, storage_protocol=con_params['storage_protocol'], + new_name=con_params['new_name']) + if modify_params: + msg = (f'Attempting to modify the storage container with id ' + f'{storage_container_details.get("id")}') + LOG.info(msg) + changed = con_object.modify_storage_container_details( + storage_container_id=storage_container_details.get("id"), + modify_params=modify_params) + storage_container_details = con_object.\ + get_storage_container_details(storage_container_details.get("id")) + con_object.result['changed'] = changed + + StorageContainerDestinationCreateHandler().handle( + con_object, con_params, storage_container_details) + + +class StorageContainerDestinationCreateHandler(): + def handle(self, con_object, con_params, storage_container_details): + if con_params['state'] == 'present' and storage_container_details and \ + con_params['storage_container_destination'] and \ + con_params['storage_container_destination_state'] == 'present': + changed = con_object.create_storage_container_destination( + params=con_params, con_details=storage_container_details) + + storage_container_details = \ + con_object.get_storage_container_details( + storage_container_details.get("id")) + con_object.result['changed'] = changed + + StorageContainerDestinationDeleteHandler().handle( + con_object, con_params, storage_container_details) + + +class StorageContainerDestinationDeleteHandler: + def handle(self, con_object, con_params, storage_container_details): + if con_params['state'] == 'present' and storage_container_details and \ + con_params['storage_container_destination_state'] == 'absent': + changed = con_object.delete_storage_container_destination( + params=con_params, con_details=storage_container_details) + + storage_container_details = con_object.\ + get_storage_container_details(storage_container_details.get("id")) + con_object.result['changed'] = changed + + StorageContainerDeleteHandler().handle( + con_object, con_params, storage_container_details) + + +class StorageContainerDeleteHandler(): + def handle(self, con_object, con_params, storage_container_details): + if con_params['state'] == 'absent' and storage_container_details: + storage_container_details = con_object.delete_storage_container( + storage_container_id=storage_container_details.get("id"), + force_delete=con_params['force_delete']) + con_object.result['changed'] = True + StorageContainerExitHandler().handle(con_object, + storage_container_details) + + +class StorageContainerExitHandler(): + def handle(self, con_object, storage_container_details): + con_object.result['storage_container_details'] = storage_container_details + con_object.module.exit_json(**con_object.result) + + +class StorageContainerHandler(): + def handle(self, con_object, con_params): + quota = utils.get_size_bytes(con_params['quota'], + con_params['quota_unit']) + storage_container_details = con_object.get_storage_container_details( + storage_container_id=con_params['storage_container_id'], + storage_container_name=con_params['storage_container_name']) + StorageContainerCreateHandler().handle( + con_object, con_params, storage_container_details, quota) + + +def main(): + """ Create PowerStore storage container object and perform action on it + based on user input from playbook""" + obj = PowerStoreStorageContainer() + StorageContainerHandler().handle(obj, obj.module.params) + + +if __name__ == '__main__': + main() diff --git a/plugins/modules/vcenter.py b/plugins/modules/vcenter.py index 8a6d0d0..b8d6f5a 100644 --- a/plugins/modules/vcenter.py +++ b/plugins/modules/vcenter.py @@ -69,7 +69,7 @@ state: description: - The state of the vCenter instance after the task is performed. - - For get, create, and modify operations it should be set to "present". + - For get, create, and modify operations it should be set to C(present). choices: [ 'present', 'absent'] default: present type: str @@ -100,7 +100,7 @@ array_ip: "{{array_ip}}" user: "{{user}}" password: "{{password}}" - verifycert: "{{verifycert}}" + validate_certs: "{{validate_certs}}" vcenter_id: "24d333-59f-423c-205-c6181ea81b" - name: Add a vcenter @@ -108,7 +108,7 @@ array_ip: "{{array_ip}}" user: "{{user}}" password: "{{password}}" - verifycert: "{{verifycert}}" + validate_certs: "{{validate_certs}}" address: "XX.XX.XX.XX" vcenter_username: "user-name" vcenter_password: "password" @@ -122,7 +122,7 @@ array_ip: "{{array_ip}}" user: "{{user}}" password: "{{password}}" - verifycert: "{{verifycert}}" + validate_certs: "{{validate_certs}}" vcenter_id: "24d333-59f-423c-205-c6181ea81b" address: "XX.XX.XX.YY" vcenter_username: "user-name" @@ -134,7 +134,7 @@ array_ip: "{{array_ip}}" user: "{{user}}" password: "{{password}}" - verifycert: "{{verifycert}}" + validate_certs: "{{validate_certs}}" vcenter_id: "24d333-59f-423c-205-c6181ea81b" delete_vasa_provider: true state: "absent" @@ -215,7 +215,7 @@ VERSION_ERROR = py4ps_version['unsupported_version_message'] # Application type -APPLICATION_TYPE = 'Ansible/1.9.0' +APPLICATION_TYPE = 'Ansible/2.0.0' class PowerstoreVCenter(object): diff --git a/plugins/modules/volume.py b/plugins/modules/volume.py index 84a9e1f..0b51edd 100644 --- a/plugins/modules/volume.py +++ b/plugins/modules/volume.py @@ -22,6 +22,7 @@ - Manisha Agrawal (@agrawm3) - Ananthu S Kuttattu (@kuttattz) - Bhavneet Sharma (@Bhavneet-Sharma) +- Pavan Mudunuri(@Pavan-Mudunuri) extends_documentation_fragment: - dellemc.powerstore.powerstore options: @@ -56,7 +57,7 @@ - Volume size unit. - Used to signify unit of the size provided for creation and expansion of volume. - - It defaults to 'GB', if not specified. + - It defaults to C(GB), if not specified. choices: [MB, GB, TB] type: str new_name: @@ -91,9 +92,19 @@ description: - Application type for volume when I(app_type) is set to C(*Other) types. type: str + appliance_id: + description: + - ID of the appliance on which the volume is provisioned. + - I(appliance_id) and I(appliance_name) are mutually exclusive. + type: str + appliance_name: + description: + - Name of the appliance on which the volume is provisioned. + - I(appliance_id) and I(appliance_name) are mutually exclusive. + type: str protection_policy: description: - - The protection_policy of the volume. + - The I(protection_policy) of the volume. - To represent policy, both name or ID can be used interchangably. The module will detect both. - A volume can be assigned a protection policy at the time of creation of the @@ -105,13 +116,13 @@ type: str performance_policy: description: - - The performance_policy for the volume. + - The I(performance_policy) for the volume. - A volume can be assigned a performance policy at the time of creation of the volume, or later. - The policy can also be changed for a given volume, by simply passing the new value. - Check examples for more clarity. - - If not given, performance policy will be 'medium'. + - If not given, performance policy will be C(medium). choices: [high, medium, low] type: str host: @@ -133,9 +144,9 @@ mapping_state: description: - Define whether the volume should be mapped to a host or hostgroup. - - Value mapped - indicates that the volume should be mapped to the host + - Value C(mapped) - indicates that the volume should be mapped to the host or host group. - - Value unmapped - indicates that the volume should not be mapped to the + - Value C(unmapped) - indicates that the volume should not be mapped to the host or host group. - Only one of a host or host group can be supplied in one call. choices: [mapped, unmapped] @@ -145,7 +156,6 @@ - Logical unit number for the host/host group volume access. - Optional parameter when mapping a volume to host/host group. - HLU modification is not supported. - required: False type: int clone_volume: description: @@ -170,8 +180,8 @@ type: str logical_unit_number: description: - - logical unit number when creating a mapped volume. - - If no host_id or host_group_id is specified, logical_unit_number is ignored. + - logical unit number when creating a C(mapped) volume. + - If no C(host_id) or C(host_group_id) is specified, C(logical_unit_number) is ignored. type: int protection_policy: description: @@ -220,8 +230,8 @@ state: description: - Define whether the volume should exist or not. - - Value present - indicates that the volume should exist on the system. - - Value absent - indicates that the volume should not exist on the system. + - Value C(present) - indicates that the volume should exist on the system. + - Value C(absent) - indicates that the volume should not exist on the system. required: true choices: [absent, present] type: str @@ -232,48 +242,44 @@ - This is mandatory while configuring a metro volume. - To represent remote system, both name and ID are interchangeable. - This parameter is added in PowerStore version 3.0.0.0. - required: False type: str remote_appliance_id: description: - A remote system appliance ID to which volume will be assigned. - This parameter is added in PowerStore version 3.0.0.0. - required: False type: str end_metro_config: description: - Whether to end the metro session from a volume. - This is mandatory for end metro configuration operation. - required: False type: bool - default: False + default: false delete_remote_volume: description: - Whether to delete the remote volume during removal of metro session. - This is parameter is added in the PowerStore version 3.0.0.0. - required: False type: bool notes: -- To create a new volume, vol_name and size is required. cap_unit, - description, vg_name, performance_policy, and protection_policy are +- To create a new volume, I(vol_name) and I(size) is required. I(cap_unit), + I(description), I(vg_name), I(performance_policy), and I(protection_policy) are optional. -- Parameter new_name should not be provided when creating a new volume. -- The size is a required parameter for expand volume. +- Parameter I(new_name) should not be provided when creating a new volume. +- The I(size)is a required parameter for expand volume. - Clones or Snapshots of a deleted production volume or a clone are not deleted. - A volume that is attached to a host/host group, or that is part of a volume group cannot be deleted. - If volume in metro session, volume can only be modified, refreshed and restored when session is in the pause state. -- The Check_mode is not supported. +- The I(Check_mode) is not supported. ''' EXAMPLES = r''' - name: Create volume dellemc.powerstore.volume: array_ip: "{{array_ip}}" - verifycert: "{{verifycert}}" + validate_certs: "{{validate_certs}}" user: "{{user}}" password: "{{password}}" vol_name: "{{vol_name}}" @@ -288,11 +294,12 @@ host: "{{host_name}}" app_type: "Relational_Databases_Other" app_type_other: "MaxDB" + appliance_name: "Appliance_Name" - name: Get volume details using ID dellemc.powerstore.volume: array_ip: "{{array_ip}}" - verifycert: "{{verifycert}}" + validate_certs: "{{validate_certs}}" user: "{{user}}" password: "{{password}}" vol_id: "{{result.volume_details.id}}" @@ -301,7 +308,7 @@ - name: Modify volume size, name, description, protection, performance policy and app_type dellemc.powerstore.volume: array_ip: "{{array_ip}}" - verifycert: "{{verifycert}}" + validate_certs: "{{validate_certs}}" user: "{{user}}" password: "{{password}}" new_name: "{{new_name}}" @@ -316,7 +323,7 @@ - name: Map volume to a host with HLU dellemc.powerstore.volume: array_ip: "{{array_ip}}" - verifycert: "{{verifycert}}" + validate_certs: "{{validate_certs}}" user: "{{user}}" password: "{{password}}" vol_name: "{{vol_name}}" @@ -328,7 +335,7 @@ - name: Clone a volume dellemc.powerstore.volume: array_ip: "{{array_ip}}" - verifycert: "{{verifycert}}" + validate_certs: "{{validate_certs}}" user: "{{user}}" password: "{{password}}" vol_name: "{{vol_name}}" @@ -345,7 +352,7 @@ - name: Refresh a volume dellemc.powerstore.volume: array_ip: "{{array_ip}}" - verifycert: "{{verifycert}}" + validate_certs: "{{validate_certs}}" user: "{{user}}" password: "{{password}}" vol_name: "{{vol_name}}" @@ -361,7 +368,7 @@ - name: Restore a volume dellemc.powerstore.volume: array_ip: "{{array_ip}}" - verifycert: "{{verifycert}}" + validate_certs: "{{validate_certs}}" user: "{{user}}" password: "{{password}}" vol_name: "{{vol_name}}" @@ -377,7 +384,7 @@ - name: Configure a metro volume dellemc.powerstore.volume: array_ip: "{{array_ip}}" - verifycert: "{{verifycert}}" + validate_certs: "{{validate_certs}}" user: "{{user}}" password: "{{password}}" vol_name: "{{vol_name}}" @@ -387,18 +394,18 @@ - name: End a metro volume configuration dellemc.powerstore.volume: array_ip: "{{array_ip}}" - verifycert: "{{verifycert}}" + validate_certs: "{{validate_certs}}" user: "{{user}}" password: "{{password}}" vol_name: "{{vol_name}}" - end_metro_config: True - delete_remote_volume: True + end_metro_config: true + delete_remote_volume: true state: "present" - name: Delete volume dellemc.powerstore.volume: array_ip: "{{array_ip}}" - verifycert: "{{verifycert}}" + validate_certs: "{{validate_certs}}" user: "{{user}}" password: "{{password}}" vol_id: "{{result.volume_details.id}}" @@ -456,6 +463,12 @@ protection_policy_id: description: The protection policy of the volume. type: str + appliance_id: + description: ID of appliance on which the volume is provisioned. + type: str + appliance_name: + description: Name of appliance on which the volume is provisioned. + type: str snapshots: description: List of snapshot associated with the volume. type: complex @@ -618,7 +631,7 @@ VERSION_ERROR = py4ps_version['unsupported_version_message'] # Application type -APPLICATION_TYPE = 'Ansible/1.9.0' +APPLICATION_TYPE = 'Ansible/2.0.0' class PowerStoreVolume(object): @@ -629,7 +642,7 @@ def __init__(self): self.module_params = utils.get_powerstore_management_host_parameters() self.module_params.update(get_powerstore_volume_parameters()) - mutually_exclusive = [['vol_name', 'vol_id']] + mutually_exclusive = [['vol_name', 'vol_id'], ['appliance_name', 'appliance_id']] required_one_of = [['vol_name', 'vol_id']] required_by = { 'app_type_other': 'app_type', @@ -660,6 +673,7 @@ def __init__(self): self.module.params, application_type=APPLICATION_TYPE) self.provisioning = self.conn.provisioning self.protection = self.conn.protection + self.configuration = self.conn.config_mgmt self.performance_policy_dict = { 'low': 'default_low', 'medium': 'default_medium', @@ -693,6 +707,17 @@ def get_volume(self, vol_id=None, vol_name=None): LOG.error(error_msg) self.module.fail_json(msg=error_msg, **utils.failure_codes(e)) + def update_volume_details(self, volume_info): + try: + appliance_id = volume_info['appliance_id'] + volume_info['appliance_name'] = self.configuration.get_appliance_details(appliance_id)['name'] + return volume_info['appliance_name'] + + except Exception as e: + error_msg = f"Failed to update volume details with appliance name {e}" + LOG.error(error_msg) + self.module.fail_json(msg=error_msg, **utils.failure_codes(e)) + def create_volume(self, vol_name, size, volume_group_id, @@ -700,7 +725,8 @@ def create_volume(self, vol_name, performance_policy, description, app_type, - app_type_other): + app_type_other, + appliance_id): """Create PowerStore volume""" try: @@ -719,7 +745,8 @@ def create_volume(self, vol_name, protection_policy_id=protection_policy_id, volume_group_id=volume_group_id, app_type=app_type, - app_type_other=app_type_other) + app_type_other=app_type_other, + appliance_id=appliance_id) return True except Exception as e: msg = 'Create volume {0} failed with error {1}'.format( @@ -1176,6 +1203,10 @@ def perform_module_operation(self): delete_remote_volume = self.module.params['delete_remote_volume'] app_type = self.module.params['app_type'] app_type_other = self.module.params['app_type_other'] + appliance_id = self.module.params['appliance_id'] + if self.module.params['appliance_name']: + appliance_id = self.get_appliance_id_by_name( + self.module.params['appliance_name']) changed = False is_volume_refreshed = False @@ -1224,7 +1255,8 @@ def perform_module_operation(self): performance_policy=performance_policy, description=description, app_type=app_type, - app_type_other=app_type_other) + app_type_other=app_type_other, + appliance_id=appliance_id) if changed: vol_id = self.get_volume_id_by_name(vol_name) volume = self.get_volume(vol_id=vol_id) @@ -1236,6 +1268,10 @@ def perform_module_operation(self): LOG.info(msg) self.module.fail_json(msg=msg) hlu_mod_flag = True + if appliance_id != volume['appliance_id'] and appliance_id: + error_msg = f"Modifying the appliance of a volume to {appliance_id} is not allowed." + LOG.error(error_msg) + self.module.fail_json(msg=error_msg) if host and hlu: hlu_mod_flag, error = check_for_hlu_modification( volume, host=host, hlu=hlu) @@ -1290,7 +1326,8 @@ def perform_module_operation(self): 'performance_policy_id': performance_policy, 'size': size, 'app_type': app_type, - 'app_type_other': app_type_other + 'app_type_other': app_type_other, + 'appliance_id': appliance_id } # In update_dict parameters which are to be updated will have @@ -1397,6 +1434,7 @@ def perform_module_operation(self): if self.result["volume_details"]: self.result["volume_details"].update( snapshots=self.get_volume_snapshots(self.result["volume_details"]['id'], all_snapshots=True)[1]) + self.result["volume_details"].update(appliance_name=self.update_volume_details(self.result["volume_details"])) self.module.exit_json(**self.result) def is_metro_configured(self, session_id, remote_system): @@ -1464,6 +1502,22 @@ def get_volume_group_id_by_name(self, volume_group_name): LOG.error(error_msg) self.module.fail_json(msg=error_msg, **utils.failure_codes(e)) + def get_appliance_id_by_name(self, appliance_name): + try: + + # Get the appliance details using name + appliance_info = self.configuration.get_appliance_by_name(appliance_name) + if appliance_info: + return appliance_info[0]['id'] + + error_msg = f"Appliance {appliance_name} not found" + LOG.error(error_msg) + self.module.fail_json(msg=error_msg) + except Exception as e: + error_msg = f"Get appliance: {appliance_name} failed with error: {e}" + LOG.error(error_msg) + self.module.fail_json(msg=error_msg, **utils.failure_codes(e)) + def get_protection_policy_id_by_name(self, protection_policy_name): try: if protection_policy_name is None: @@ -1698,7 +1752,7 @@ def get_backupsnap_profile_details(data): """ Get backupsnap profile details :param data: Refresh details or Restore details. - :return: backupsnap profil edetails. + :return: backupsnap profile details. """ backup_snap_profile = {} if data['backup_snap_profile']: @@ -1778,7 +1832,9 @@ def get_powerstore_volume_parameters(): "Virtualization_Virtual_Servers_VSI", "Virtualization_Containers_Kubernetes", "Virtualization_Virtual_Desktops_VDI", "Other"]), - app_type_other=dict(type='str') + app_type_other=dict(type='str'), + appliance_name=dict(type='str'), + appliance_id=dict(type='str') ) diff --git a/plugins/modules/volumegroup.py b/plugins/modules/volumegroup.py index d0b8bfa..0a43b6e 100644 --- a/plugins/modules/volumegroup.py +++ b/plugins/modules/volumegroup.py @@ -27,26 +27,24 @@ vg_name: description: - The name of the volume group. - required: False type: str vg_id: description: - The id of the volume group. - It can be used only for Modify, Add/Remove, or Delete operation. - required: False type: str volumes: description: - This is a list of volumes. - Either the volume ID or name must be provided for adding/removing existing volumes from a volume group. - - If volumes are given, then vol_state should also be specified. + - If volumes are given, then I(vol_state) should also be specified. type: list elements: str vol_state: description: - String variable. Describes the state of volumes inside a volume group. - - If volume is given, then vol_state should also be specified. + - If volume is given, then I(vol_state) should also be specified. choices: [present-in-group , absent-in-group] type: str new_vg_name: @@ -63,15 +61,13 @@ used for volume group. - Specifying an empty string or "" removes the existing protection policy from volume group. - required: false type: str is_write_order_consistent: description: - A boolean flag to indicate whether Snapshot sets of the volume group will be write-order consistent. - If this parameter is not specified, the array by default sets it to - true. - required: false + C(true). type: bool source_vg: description: @@ -85,7 +81,7 @@ description: - Specifies whether a backup snapshot set of the target volume group needs to be created before attempting refresh or restore. - - If not specified it will be set to True. + - If not specified it will be set to C(true). type: bool backup_snap_profile: description: @@ -113,7 +109,7 @@ description: - Name for the clone volume group. type: str - required: True + required: true description: description: - Description for the clone volume group. @@ -129,20 +125,20 @@ required: true type: str notes: -- Parameter vol_state is mandatory if volumes are provided. +- Parameter I(vol_state) is mandatory if volumes are provided. - A protection policy can be specified either for an volume group, or for the individual volumes inside the volume group. - A volume can be a member of at most one volume group. -- Specifying "protection_policy" as empty string or "" removes the existing +- Specifying I(protection_policy) as empty string or "" removes the existing protection policy from a volume group. -- The check_mode is not supported. +- The I(check_mode) is not supported. ''' EXAMPLES = r''' - name: Create volume group without protection policy dellemc.powerstore.volumegroup: array_ip: "{{array_ip}}" - verifycert: "{{verifycert}}" + validate_certs: "{{validate_certs}}" user: "{{user}}" password: "{{password}}" vg_name: "{{vg_name}}" @@ -152,7 +148,7 @@ - name: Get details of volume group dellemc.powerstore.volumegroup: array_ip: "{{array_ip}}" - verifycert: "{{verifycert}}" + validate_certs: "{{validate_certs}}" user: "{{user}}" password: "{{password}}" vg_name: "{{vg_name}}" @@ -161,7 +157,7 @@ - name: Add volumes to volume group dellemc.powerstore.volumegroup: array_ip: "{{array_ip}}" - verifycert: "{{verifycert}}" + validate_certs: "{{validate_certs}}" user: "{{user}}" password: "{{password}}" vg_name: "{{vg_name}}" @@ -175,7 +171,7 @@ - name: Remove volumes from volume group dellemc.powerstore.volumegroup: array_ip: "{{array_ip}}" - verifycert: "{{verifycert}}" + validate_certs: "{{validate_certs}}" user: "{{user}}" password: "{{password}}" vg_name: "{{vg_name}}" @@ -188,18 +184,18 @@ - name: Rename volume group and change is_write_order_consistent flag dellemc.powerstore.volumegroup: array_ip: "{{array_ip}}" - verifycert: "{{verifycert}}" + validate_certs: "{{validate_certs}}" user: "{{user}}" password: "{{password}}" vg_name: "{{vg_name}}" new_vg_name: "{{new_vg_name}}" - is_write_order_consistent: False + is_write_order_consistent: false state: "present" - name: Get details of volume group by ID dellemc.powerstore.volumegroup: array_ip: "{{array_ip}}" - verifycert: "{{verifycert}}" + validate_certs: "{{validate_certs}}" user: "{{user}}" password: "{{password}}" vg_id: "{{vg_id}}" @@ -208,7 +204,7 @@ - name: Delete volume group dellemc.powerstore.volumegroup: array_ip: "{{array_ip}}" - verifycert: "{{verifycert}}" + validate_certs: "{{validate_certs}}" user: "{{user}}" password: "{{password}}" name: "{{new_vg_name}}" @@ -217,12 +213,12 @@ - name: Refresh a volume group dellemc.powerstore.volumegroup: array_ip: "{{array_ip}}" - verifycert: "{{verifycert}}" + validate_certs: "{{validate_certs}}" user: "{{user}}" password: "{{password}}" vg_name: "ansible_vg" source_vg: "vg_source" - create_backup_snap: True + create_backup_snap: true backup_snap_profile: name: "test_snap" state: "present" @@ -230,12 +226,12 @@ - name: Restore a volume group dellemc.powerstore.volumegroup: array_ip: "{{array_ip}}" - verifycert: "{{verifycert}}" + validate_certs: "{{validate_certs}}" user: "{{user}}" password: "{{password}}" vg_name: "ansible_vg" source_snap: "snap_source" - create_backup_snap: True + create_backup_snap: true backup_snap_profile: name: "test_snap_restore" state: "present" @@ -243,7 +239,7 @@ - name: Clone a volume group dellemc.powerstore.volumegroup: array_ip: "{{array_ip}}" - verifycert: "{{verifycert}}" + validate_certs: "{{validate_certs}}" user: "{{user}}" password: "{{password}}" vg_name: "ansible_vg" @@ -402,7 +398,7 @@ VERSION_ERROR = py4ps_version['unsupported_version_message'] # Application type -APPLICATION_TYPE = 'Ansible/1.9.0' +APPLICATION_TYPE = 'Ansible/2.0.0' class PowerStoreVolumeGroup(object): diff --git a/tests/sanity/ignore-2.13.txt b/tests/sanity/ignore-2.13.txt index ae3ada3..192bfe9 100644 --- a/tests/sanity/ignore-2.13.txt +++ b/tests/sanity/ignore-2.13.txt @@ -2,6 +2,18 @@ plugins/modules/vcenter.py compile-2.7 plugins/modules/vcenter.py compile-3.5 plugins/modules/vcenter.py import-2.7 plugins/modules/vcenter.py import-3.5 +plugins/modules/volume.py compile-2.7 +plugins/modules/volume.py compile-3.5 +plugins/modules/volume.py import-2.7 +plugins/modules/volume.py import-3.5 +plugins/modules/storage_container.py compile-2.7 +plugins/modules/storage_container.py compile-3.5 +plugins/modules/storage_container.py import-2.7 +plugins/modules/storage_container.py import-3.5 +plugins/modules/replicationsession.py import-2.7 +plugins/modules/replicationsession.py import-3.5 +plugins/modules/replicationsession.py compile-2.7 +plugins/modules/replicationsession.py compile-3.5 plugins/modules/certificate.py validate-modules:missing-gplv3-license plugins/modules/cluster.py validate-modules:missing-gplv3-license plugins/modules/dns.py validate-modules:missing-gplv3-license @@ -31,6 +43,7 @@ plugins/modules/smbshare.py validate-modules:missing-gplv3-license plugins/modules/smtp_config.py validate-modules:missing-gplv3-license plugins/modules/snapshot.py validate-modules:missing-gplv3-license plugins/modules/snapshotrule.py validate-modules:missing-gplv3-license +plugins/modules/storage_container.py validate-modules:missing-gplv3-license plugins/modules/volume.py validate-modules:missing-gplv3-license plugins/modules/volumegroup.py validate-modules:missing-gplv3-license plugins/modules/ldap_domain.py validate-modules:missing-gplv3-license diff --git a/tests/sanity/ignore-2.14.txt b/tests/sanity/ignore-2.14.txt index ae3ada3..192bfe9 100644 --- a/tests/sanity/ignore-2.14.txt +++ b/tests/sanity/ignore-2.14.txt @@ -2,6 +2,18 @@ plugins/modules/vcenter.py compile-2.7 plugins/modules/vcenter.py compile-3.5 plugins/modules/vcenter.py import-2.7 plugins/modules/vcenter.py import-3.5 +plugins/modules/volume.py compile-2.7 +plugins/modules/volume.py compile-3.5 +plugins/modules/volume.py import-2.7 +plugins/modules/volume.py import-3.5 +plugins/modules/storage_container.py compile-2.7 +plugins/modules/storage_container.py compile-3.5 +plugins/modules/storage_container.py import-2.7 +plugins/modules/storage_container.py import-3.5 +plugins/modules/replicationsession.py import-2.7 +plugins/modules/replicationsession.py import-3.5 +plugins/modules/replicationsession.py compile-2.7 +plugins/modules/replicationsession.py compile-3.5 plugins/modules/certificate.py validate-modules:missing-gplv3-license plugins/modules/cluster.py validate-modules:missing-gplv3-license plugins/modules/dns.py validate-modules:missing-gplv3-license @@ -31,6 +43,7 @@ plugins/modules/smbshare.py validate-modules:missing-gplv3-license plugins/modules/smtp_config.py validate-modules:missing-gplv3-license plugins/modules/snapshot.py validate-modules:missing-gplv3-license plugins/modules/snapshotrule.py validate-modules:missing-gplv3-license +plugins/modules/storage_container.py validate-modules:missing-gplv3-license plugins/modules/volume.py validate-modules:missing-gplv3-license plugins/modules/volumegroup.py validate-modules:missing-gplv3-license plugins/modules/ldap_domain.py validate-modules:missing-gplv3-license diff --git a/tests/sanity/ignore-2.12.txt b/tests/sanity/ignore-2.15.txt similarity index 79% rename from tests/sanity/ignore-2.12.txt rename to tests/sanity/ignore-2.15.txt index dcfcafd..192bfe9 100644 --- a/tests/sanity/ignore-2.12.txt +++ b/tests/sanity/ignore-2.15.txt @@ -1,11 +1,19 @@ -plugins/modules/remote_support.py compile-2.6 plugins/modules/vcenter.py compile-2.7 plugins/modules/vcenter.py compile-3.5 -plugins/modules/remote_support.py import-2.6 -plugins/modules/vcenter.py compile-2.6 -plugins/modules/vcenter.py import-2.6 plugins/modules/vcenter.py import-2.7 plugins/modules/vcenter.py import-3.5 +plugins/modules/volume.py compile-2.7 +plugins/modules/volume.py compile-3.5 +plugins/modules/volume.py import-2.7 +plugins/modules/volume.py import-3.5 +plugins/modules/storage_container.py compile-2.7 +plugins/modules/storage_container.py compile-3.5 +plugins/modules/storage_container.py import-2.7 +plugins/modules/storage_container.py import-3.5 +plugins/modules/replicationsession.py import-2.7 +plugins/modules/replicationsession.py import-3.5 +plugins/modules/replicationsession.py compile-2.7 +plugins/modules/replicationsession.py compile-3.5 plugins/modules/certificate.py validate-modules:missing-gplv3-license plugins/modules/cluster.py validate-modules:missing-gplv3-license plugins/modules/dns.py validate-modules:missing-gplv3-license @@ -35,6 +43,7 @@ plugins/modules/smbshare.py validate-modules:missing-gplv3-license plugins/modules/smtp_config.py validate-modules:missing-gplv3-license plugins/modules/snapshot.py validate-modules:missing-gplv3-license plugins/modules/snapshotrule.py validate-modules:missing-gplv3-license +plugins/modules/storage_container.py validate-modules:missing-gplv3-license plugins/modules/volume.py validate-modules:missing-gplv3-license plugins/modules/volumegroup.py validate-modules:missing-gplv3-license plugins/modules/ldap_domain.py validate-modules:missing-gplv3-license diff --git a/tests/unit/plugins/module_utils/mock_fail_json.py b/tests/unit/plugins/module_utils/mock_fail_json.py new file mode 100644 index 0000000..8c9ce40 --- /dev/null +++ b/tests/unit/plugins/module_utils/mock_fail_json.py @@ -0,0 +1,21 @@ +# Copyright: (c) 2023, Dell Technologies + +# Apache License version 2.0 (see MODULE-LICENSE or http://www.apache.org/licenses/LICENSE-2.0.txt) + +"""Mock fail json for PowerStore Test modules""" + +from __future__ import (absolute_import, division, print_function) + +__metaclass__ = type + + +class FailJsonException(Exception): + def __init__(self, *args): + if args: + self.message = args[0] + else: + self.message = None + + +def fail_json(msg, **kwargs): + raise FailJsonException(msg) diff --git a/tests/unit/plugins/module_utils/mock_info_api.py b/tests/unit/plugins/module_utils/mock_info_api.py index efc9651..0c5d728 100644 --- a/tests/unit/plugins/module_utils/mock_info_api.py +++ b/tests/unit/plugins/module_utils/mock_info_api.py @@ -31,7 +31,9 @@ class MockInfoApi: 'NTP': [], 'RemoteSupport': [], 'RemoteSupportContact': [], - 'SMTPConfig': [] + 'SMTPConfig': [], + 'StorageContainers': [], + 'ReplicationGroups': [] } CLUSTER_DETAILS_TWO = [ diff --git a/tests/unit/plugins/module_utils/mock_replicationsession_api.py b/tests/unit/plugins/module_utils/mock_replicationsession_api.py index dd97762..7979bf4 100644 --- a/tests/unit/plugins/module_utils/mock_replicationsession_api.py +++ b/tests/unit/plugins/module_utils/mock_replicationsession_api.py @@ -15,10 +15,17 @@ class MockReplicationSessionApi: local_time = "2022-01-06T06:55:01.870946+00:00" vg = "Volume Group" ID = "b05b5108-26b6-4567-a1d8-1c7795b2e6bc" + VOL_NAME = "sample_volume" + REP_GROUP = "sample_repl_group" + FS_NAME = "sample_filesystem" + FAIL_OVER = "failed_over" + SYNCING_STATE = "synchronizing" + PAUSE_STATE = "paused" REPLICATION_SESSION_COMMON_ARGS = { 'array_ip': '**.***.**.***', 'volume_group': None, + 'replication_group': None, 'volume': None, 'nas_server': None, 'filesystem': None, @@ -33,7 +40,7 @@ class MockReplicationSessionApi: "id": ID, "last_sync_timestamp": local_time, "local_resource_id": "634e4b95-e7bd-49e7-957b-6dc932642464", - "local_resource_name": "sample_volume", + "local_resource_name": VOL_NAME, "migration_session": None, "progress_percentage": None, "remote_resource_id": "c1535ab7-e874-42eb-8692-7aa12aa4346e", @@ -81,12 +88,12 @@ class MockReplicationSessionApi: "name": "sample_replication_rule" }, "replication_rule_id": "05777d33-b2fb-4e65-8202-208ff4fe5878", - "resource_type": vg, + "resource_type": "volume_group", "resource_type_l10n": vg, "role": "Destination", "role_l10n": "Destination", - "state": "Paused", - "state_l10n": "Paused", + "state": PAUSE_STATE, + "state_l10n": PAUSE_STATE, "storage_element_pairs": [ { "local_storage_element_id": "b0acb8de-446b-48e4-82ae-89ed05a35d01", @@ -104,7 +111,7 @@ class MockReplicationSessionApi: "id": ID, "last_sync_timestamp": local_time, "local_resource_id": "634e4b95-e7bd-49e7-957b-6dc932642464", - "local_resource_name": "sample_volume", + "local_resource_name": VOL_NAME, "migration_session": None, "progress_percentage": None, "remote_resource_id": "c1535ab7-e874-42eb-8692-7aa12aa4346e", @@ -152,12 +159,12 @@ class MockReplicationSessionApi: "name": "sample_replication_rule" }, "replication_rule_id": "05777d33-b2fb-4e65-8202-208ff4fe5878", - "resource_type": vg, + "resource_type": "volume_group", "resource_type_l10n": vg, "role": "Destination", "role_l10n": "Destination", - "state": "Paused", - "state_l10n": "Paused", + "state": PAUSE_STATE, + "state_l10n": PAUSE_STATE, "storage_element_pairs": [ { "local_storage_element_id": "b0acb8de-446b-48e4-82ae-89ed05a35d01", @@ -223,12 +230,12 @@ class MockReplicationSessionApi: "name": "sample_replication_rule" }, "replication_rule_id": "05777d33-b2fb-4e65-8202-208ff4fe5878", - "resource_type": vg, + "resource_type": "volume_group", "resource_type_l10n": vg, "role": "Destination", "role_l10n": "Destination", - "state": "Paused", - "state_l10n": "Paused", + "state": PAUSE_STATE, + "state_l10n": PAUSE_STATE, "storage_element_pairs": [ { "local_storage_element_id": "b0acb8de-446b-48e4-82ae-89ed05a35d01", @@ -277,7 +284,7 @@ class MockReplicationSessionApi: "id": "62a72cbf-36a0-c57a-04f0-da3630264434", "state": "OK", "role": "Source", - "resource_type": "file_system", + "resource_type": "filesystem", "data_transfer_state": None, "type": "Asynchronous", "last_sync_timestamp": "2022-07-06T10:25:40+00:00", @@ -304,6 +311,59 @@ class MockReplicationSessionApi: "local_resource_state_l10n": None} ] + REPLICATION_SESSION_DETAILS_REP_GROUP = [ + { + "estimated_completion_timestamp": None, + "id": ID, + "last_sync_timestamp": local_time, + "data_transfer_state": "Asynchronous", + "data_transfer_state_l10n": "Asynchronous", + "local_resource_id": "634e4b95-e7bd-49e7-957b-6dc932642464", + "local_resource_name": REP_GROUP, + "migration_session": None, + "progress_percentage": None, + "remote_resource_id": "c1535ab7-e874-42eb-8692-7aa12aa4346e", + "remote_system": { + "id": "b5f62edd-f7aa-483a-afaa-4364ab6fcd3a", + "name": "WN-D8989" + }, + "remote_system_id": "b5f62edd-f7aa-483a-afaa-4364ab6fcd3a", + "replication_rule": { + "id": "05777d33-b2fb-4e65-8202-208ff4fe5878", + "name": "sample_replication_rule" + }, + "replication_rule_id": "05777d33-b2fb-4e65-8202-208ff4fe5878", + "resource_type": "replication_group", + "resource_type_l10n": "Replication Group", + "role": "Source", + "role_l10n": "Source", + "state": "ok", + "state_l10n": "ok", + "storage_element_pairs": [ + { + "local_storage_element_id": "b0acb8de-446b-48e4-82ae-89ed05a35d01", + "remote_storage_element_id": "c1535ab7-e874-42eb-8692-7aa12aa4346e", + "replication_shadow_id": None, + "storage_element_type": "virtual_volume" + } + ] + }] + + REP_GROUP_DETAILS = [{ + "id": "c4ba4ad3-2200-47d4-8f61-ddf51d83aac2", + "storage_container_id": "0b460d65-b8b6-40bf-8578-aa2e2fd3d02a", + "name": REP_GROUP, + "description": REP_GROUP, + "creator_type": "User", + "creation_timestamp": "2023-05-16T13:58:09.348368+00:00", + "is_replication_destination": False, + "creator_type_l10n": "User" + }] + + SESSION_IDS_REP_GROUP = [ + {'id': "c4ba4ad3-2200-47d4-8f61-ddf51d83aac2"} + ] + SESSION_IDS_VOLUME = [ {'id': ID} ] @@ -332,7 +392,7 @@ class MockReplicationSessionApi: "location_history": None, "mapped_volumes": [], "migration_session_id": None, - "name": "sample_volume", + "name": VOL_NAME, "nguid": "nguid.ac8ab0e2506d99be8ccf096800e29e40", "node_affinity": "System_Select_At_Attach", "node_affinity_l10n": "System Select At Attach", @@ -499,7 +559,41 @@ class MockReplicationSessionApi: "id": ID, "last_sync_timestamp": local_time, "local_resource_id": "634e4b95-e7bd-49e7-957b-6dc932642464", - "local_resource_name": "sample_volume", + "local_resource_name": VOL_NAME, + "migration_session": None, + "progress_percentage": None, + "remote_resource_id": "c1535ab7-e874-42eb-8692-7aa12aa4346e", + "remote_system": { + "id": "b5f62edd-f7aa-483a-afaa-4364ab6fcd3a", + "name": "WN-D8989" + }, + "remote_system_id": "b5f62edd-f7aa-483a-afaa-4364ab6fcd3a", + "replication_rule": { + "id": "05777d33-b2fb-4e65-8202-208ff4fe5878", + "name": "sample_replication_rule" + }, + "replication_rule_id": "05777d33-b2fb-4e65-8202-208ff4fe5878", + "resource_type": "Volume", + "resource_type_l10n": "Volume", + "role": "Source", + "role_l10n": "Source", + "state": SYNCING_STATE, + "state_l10n": SYNCING_STATE, + "storage_element_pairs": [ + { + "local_storage_element_id": "b0acb8de-446b-48e4-82ae-89ed05a35d01", + "remote_storage_element_id": "c1535ab7-e874-42eb-8692-7aa12aa4346e", + "replication_shadow_id": None, + "storage_element_type": "volume" + } + ] + }, + { + "estimated_completion_timestamp": None, + "id": ID, + "last_sync_timestamp": local_time, + "local_resource_id": "634e4b95-e7bd-49e7-957b-6dc932642464", + "local_resource_name": VOL_NAME, "migration_session": None, "progress_percentage": None, "remote_resource_id": "c1535ab7-e874-42eb-8692-7aa12aa4346e", @@ -517,8 +611,8 @@ class MockReplicationSessionApi: "resource_type_l10n": "Volume", "role": "Destination", "role_l10n": "Destination", - "state": "synchronizing", - "state_l10n": "synchronizing", + "state": SYNCING_STATE, + "state_l10n": SYNCING_STATE, "storage_element_pairs": [ { "local_storage_element_id": "b0acb8de-446b-48e4-82ae-89ed05a35d01", @@ -536,7 +630,7 @@ class MockReplicationSessionApi: "id": ID, "last_sync_timestamp": local_time, "local_resource_id": "634e4b95-e7bd-49e7-957b-6dc932642464", - "local_resource_name": "sample_volume", + "local_resource_name": VOL_NAME, "migration_session": None, "progress_percentage": None, "remote_resource_id": "c1535ab7-e874-42eb-8692-7aa12aa4346e", @@ -554,8 +648,8 @@ class MockReplicationSessionApi: "resource_type_l10n": "Volume", "role": "Source", "role_l10n": "Source", - "state": "synchronizing", - "state_l10n": "synchronizing", + "state": SYNCING_STATE, + "state_l10n": SYNCING_STATE, "storage_element_pairs": [ { "local_storage_element_id": "b0acb8de-446b-48e4-82ae-89ed05a35d01", @@ -573,7 +667,7 @@ class MockReplicationSessionApi: "id": ID, "last_sync_timestamp": local_time, "local_resource_id": "634e4b95-e7bd-49e7-957b-6dc932642464", - "local_resource_name": "sample_volume", + "local_resource_name": VOL_NAME, "migration_session": None, "progress_percentage": None, "remote_resource_id": "c1535ab7-e874-42eb-8692-7aa12aa4346e", @@ -591,8 +685,8 @@ class MockReplicationSessionApi: "resource_type_l10n": "Volume", "role": "Source", "role_l10n": "Source", - "state": "paused", - "state_l10n": "paused", + "state": PAUSE_STATE, + "state_l10n": PAUSE_STATE, "storage_element_pairs": [ { "local_storage_element_id": "b0acb8de-446b-48e4-82ae-89ed05a35d01", @@ -611,7 +705,7 @@ class MockReplicationSessionApi: "id": ID, "last_sync_timestamp": local_time, "local_resource_id": "634e4b95-e7bd-49e7-957b-6dc932642464", - "local_resource_name": "sample_volume", + "local_resource_name": VOL_NAME, "migration_session": None, "progress_percentage": None, "remote_resource_id": "c1535ab7-e874-42eb-8692-7aa12aa4346e", @@ -629,8 +723,8 @@ class MockReplicationSessionApi: "resource_type_l10n": "Volume", "role": "Source", "role_l10n": "Source", - "state": "paused", - "state_l10n": "paused", + "state": PAUSE_STATE, + "state_l10n": PAUSE_STATE, "storage_element_pairs": [ { "local_storage_element_id": "b0acb8de-446b-48e4-82ae-89ed05a35d01", @@ -649,7 +743,7 @@ class MockReplicationSessionApi: "id": ID, "last_sync_timestamp": local_time, "local_resource_id": "634e4b95-e7bd-49e7-957b-6dc932642464", - "local_resource_name": "sample_volume", + "local_resource_name": VOL_NAME, "migration_session": None, "progress_percentage": None, "remote_resource_id": "c1535ab7-e874-42eb-8692-7aa12aa4346e", @@ -667,8 +761,8 @@ class MockReplicationSessionApi: "resource_type_l10n": "Volume", "role": "Destination", "role_l10n": "Destination", - "state": "paused", - "state_l10n": "paused", + "state": PAUSE_STATE, + "state_l10n": PAUSE_STATE, "storage_element_pairs": [ { "local_storage_element_id": "b0acb8de-446b-48e4-82ae-89ed05a35d01", @@ -687,7 +781,7 @@ class MockReplicationSessionApi: "id": ID, "last_sync_timestamp": local_time, "local_resource_id": "634e4b95-e7bd-49e7-957b-6dc932642464", - "local_resource_name": "sample_volume", + "local_resource_name": VOL_NAME, "migration_session": None, "progress_percentage": None, "remote_resource_id": "c1535ab7-e874-42eb-8692-7aa12aa4346e", @@ -724,7 +818,7 @@ class MockReplicationSessionApi: "id": ID, "last_sync_timestamp": local_time, "local_resource_id": "634e4b95-e7bd-49e7-957b-6dc932642464", - "local_resource_name": "sample_volume", + "local_resource_name": VOL_NAME, "migration_session": None, "progress_percentage": None, "remote_resource_id": "c1535ab7-e874-42eb-8692-7aa12aa4346e", @@ -742,8 +836,8 @@ class MockReplicationSessionApi: "resource_type_l10n": "Volume", "role": "Source", "role_l10n": "Source", - "state": "failed_over", - "state_l10n": "failed_over", + "state": FAIL_OVER, + "state_l10n": FAIL_OVER, "storage_element_pairs": [ { "local_storage_element_id": "b0acb8de-446b-48e4-82ae-89ed05a35d01", @@ -761,7 +855,7 @@ class MockReplicationSessionApi: "id": ID, "last_sync_timestamp": local_time, "local_resource_id": "634e4b95-e7bd-49e7-957b-6dc932642464", - "local_resource_name": "sample_volume", + "local_resource_name": VOL_NAME, "migration_session": None, "progress_percentage": None, "remote_resource_id": "c1535ab7-e874-42eb-8692-7aa12aa4346e", @@ -779,8 +873,8 @@ class MockReplicationSessionApi: "resource_type_l10n": "Volume", "role": "Destination", "role_l10n": "Destination", - "state": "failed_over", - "state_l10n": "failed_over", + "state": FAIL_OVER, + "state_l10n": FAIL_OVER, "storage_element_pairs": [ { "local_storage_element_id": "b0acb8de-446b-48e4-82ae-89ed05a35d01", @@ -798,7 +892,7 @@ class MockReplicationSessionApi: "id": ID, "last_sync_timestamp": local_time, "local_resource_id": "634e4b95-e7bd-49e7-957b-6dc932642464", - "local_resource_name": "sample_volume", + "local_resource_name": VOL_NAME, "migration_session": None, "progress_percentage": None, "remote_resource_id": "c1535ab7-e874-42eb-8692-7aa12aa4346e", @@ -835,7 +929,7 @@ class MockReplicationSessionApi: "id": ID, "last_sync_timestamp": local_time, "local_resource_id": "634e4b95-e7bd-49e7-957b-6dc932642464", - "local_resource_name": "sample_volume", + "local_resource_name": VOL_NAME, "migration_session": None, "progress_percentage": None, "remote_resource_id": "c1535ab7-e874-42eb-8692-7aa12aa4346e", @@ -876,33 +970,45 @@ class MockReplicationSessionApi: ] @staticmethod - def failed_over_to_paused_failed_msg(): - return "replication session is in failed_over state, invalid transition to paused state." - - @staticmethod - def failing_over_to_paused_failed_msg(): - return "replication session is in failing_over state, invalid transition to paused state." - - @staticmethod - def change_state_from_transitioning_states_failed_msg(): - return "Replication Session is in resuming state. Please perform paused operation once this transition is completed." - - @staticmethod - def failed_over_to_sync_destination_failed_msg(): - return "Sync call can not be made at the destination when the session is in failed_over state" - - @staticmethod - def change_state_from_remaining_states_failed_msg(): - return "Any state change from this state is not supported by ansible module" - - @staticmethod - def paused_to_sync_dest_error_failed_msg(): - return "Synchronization at destination is not supported." - - @staticmethod - def volume_not_found_failed_msg(): - return "not found" + def get_rep_session_exception_response(response_type): + if response_type == "get_rep_session_exception": + return "Modifying the role Metro_Preferred of replication session" \ + " b05b5108-26b6-4567-a1d8-1c7795b2e6bc failed with error" + elif response_type == "pause_to_sync_dest_error": + return "Synchronization at destination is not supported. Please synchronize at source" + elif response_type == "failover_to_sync_destination_error": + return "Sync call can not be made at the destination when the session is in failed_over state" + elif response_type == "failOver_to_paused_error": + return "replication session is in failed_over state, invalid transition to paused state" + elif response_type == "any_to_remaining_state": + return "Replication Session is in system_paused state. Any state" \ + " change from this state is not supported by ansible module." + elif response_type == "state_from_transition_state": + return "Replication Session is in resuming state. Please perform" \ + " paused operation once this transition is completed" + elif response_type == "get_rep_session_error": + return "Get details of replication session with ID: " \ + "b05b5108-26b6-4567-a1d8-1c7795b2e6bc or vol: None, vol_grp None, " \ + "filesystemNone or nas_server None or replication group None failed with error" @staticmethod - def modify_role_failed_msg(): - return "Modifying the role Metro_Preferred of replication session b05b5108-26b6-4567-a1d8-1c7795b2e6bc failed with error" + def get_rep_session_error(response_type): + if response_type == "get_rep_group_error": + return "Get local resource id for replication group: sample_repl_group failed with error" + elif response_type == "get_cluster_error": + return "Failed to get the clusters with error" + elif response_type == "nas_error": + return "Get local resource id for nas server: sample_nas_server failed with error" + elif response_type == "fs_error": + return "Get local resource id for filesystem: sample_filesystem failed with error" + elif response_type == "vg_error": + return "Get local resource id for volume group: sample_vg failed with error" + elif response_type == "vol_error": + return "Get local resource id for volume: sample_vol failed with error" + elif response_type == "fs_nas_error": + return "Get NAS Server 6299d83a-37dc-340b-788f-4ad525462806 " \ + "for powerstore array name : WN-ABCD , global id : 0 failed with error" + elif response_type == "empty_cluster": + return "Unable to find any active cluster on this array" + elif response_type == "non_existing_session": + return "No replication session found with id" diff --git a/tests/unit/plugins/module_utils/mock_storage_container_api.py b/tests/unit/plugins/module_utils/mock_storage_container_api.py new file mode 100644 index 0000000..28374b5 --- /dev/null +++ b/tests/unit/plugins/module_utils/mock_storage_container_api.py @@ -0,0 +1,160 @@ +# Copyright: (c) 2023, Dell Technologies + +# Apache License version 2.0 (see MODULE-LICENSE or http://www.apache.org/licenses/LICENSE-2.0.txt) + +"""Mock Api response for Unit tests of storage container module for PowerStore""" + +from __future__ import (absolute_import, division, print_function) + +__metaclass__ = type + + +class MockStorageContainerApi: + MODULE_PATH = 'ansible_collections.dellemc.powerstore.plugins.modules.storage_container.PowerStoreStorageContainer' + BASE_PATH = 'ansible_collections.dellemc.powerstore.plugins.modules.storage_container.StorageContainerHandler' + MODULE_UTILS_PATH = 'ansible_collections.dellemc.powerstore.plugins.module_utils.storage.dell.utils' + + SC_ID = "e0ccd953-5650-41d8-9bce-f36d876d6a2a" + SC_ID_1 = "e0ccd953-5650-41d8-9bce-f36d876d6a2b" + REMOTE_SC_ID = "666deaed-c378-42dd-a649-14ee89101520" + REMOTE_SC_ID_1 = "666deaed-c378-42dd-a649-14ee89101521" + QUOTA = 21474836480 + REMOTE_SYS_NAME = "AB-D8337" + REMOTE_SYS_ID = "504b6fd2-0a41-4fe6-863d-2f04b2718804" + MASKED_VALUE = "x.x.x.x" + MASKED_VALUE1 = "y.y.y.y" + STORAGE_CONTAINER_COMMON_ARGS = { + 'array_ip': '**.***.**.***', + 'storage_container_id': None, + 'storage_container_name': None, + 'quota': 0, + 'quota_unit': "GB", + 'storage_protocol': "SCSI", + 'high_water_mark': 50, + 'force_delete': False, + 'new_name': None, + 'state': "present", + 'storage_container_destination': None, + 'storage_container_destination_state': "present" + } + STORAGE_CONTAINER_NAME_1 = "Ansible_storage_container_1" + STORAGE_CONTAINER_DETAILS = { + "datastores": [], + "destinations": [], + "id": SC_ID, + "name": STORAGE_CONTAINER_NAME_1, + "quota": QUOTA, + "replication_groups": [], + "storage_protocol": "NVMe", + "storage_protocol_l10n": "NVMe", + "virtual_volumes": [] + } + + CREATE_STORAGE_CONTAINER = { + "datastores": [], + "destinations": [], + "id": SC_ID, + "name": STORAGE_CONTAINER_NAME_1, + "quota": QUOTA, + "replication_groups": [], + "storage_protocol": "NVMe", + "storage_protocol_l10n": "NVMe", + "virtual_volumes": [] + } + + CREATE_STORAGE_CONTAINER_DESTINATION = { + "datastores": [], + "destinations": [{ + "id": "64f26e3f-6fb5-4acc-a39c-3fa2e7917716", + "remote_storage_container_id": REMOTE_SC_ID, + "remote_system_id": REMOTE_SYS_ID, + "remote_system_name": REMOTE_SYS_NAME + }], + "id": SC_ID, + "name": STORAGE_CONTAINER_NAME_1, + "quota": QUOTA, + "replication_groups": [], + "storage_protocol": "NVMe", + "storage_protocol_l10n": "NVMe", + "virtual_volumes": [] + } + + REMOTE_SYSTEM_DETAILS = [ + { + "id": REMOTE_SYS_ID, + "name": REMOTE_SYS_NAME + }, + { + "id": "504b6fd2-0a41-4fe6-863d-2f04b2718855", + "name": "AB-D8338" + } + ] + + REMOTE_SYSTEM_DETAILS1 = [ + { + "id": REMOTE_SYS_ID, + "name": REMOTE_SYS_NAME, + "management_address": MASKED_VALUE + } + ] + + REMOTE_STORAGE_CONTAINER = { + "datastores": [], + "destinations": [], + "id": REMOTE_SC_ID_1, + "name": STORAGE_CONTAINER_NAME_1, + "quota": 0, + "replication_groups": [], + "storage_protocol": "NVMe", + "storage_protocol_l10n": "NVMe", + "virtual_volumes": [] + } + + REMOTE_STORAGE_CONTAINER_1 = { + "datastores": [], + "destinations": [{ + "id": "64f26e3f-6fb5-4acc-a39c-3fa2e7917716", + "remote_storage_container_id": REMOTE_SC_ID, + "remote_system_id": REMOTE_SYS_ID, + "remote_system_name": REMOTE_SYS_NAME + }], + "id": REMOTE_SC_ID, + "name": STORAGE_CONTAINER_NAME_1, + "quota": 0, + "replication_groups": [], + "storage_protocol": "SCSI", + "storage_protocol_l10n": "SCSI", + "virtual_volumes": [] + } + + @staticmethod + def get_storage_container_exception_response(response_type): + if response_type == 'remote_dict_exception': + return "The storage_container_destination dict is required to " \ + "delete the storage container destination" + elif response_type == 'delete_destination_exp': + return "Failed to delete a storage container destination with error" + elif response_type == "create_destination_exp": + return "Failed to create a storage container destination with error" + elif response_type == "delete_container_exp": + return "Deletion of storage container" + elif response_type == "modify_container_exception": + return "Failed to modify the storage container instance with error" + elif response_type == "create_container_exception": + return "Creation of storage container with name {0} on " \ + "PowerStore array name : None , global id : None failed " \ + "with error".format(MockStorageContainerApi.STORAGE_CONTAINER_NAME_1) + elif response_type == "get_container_exception": + return "Get remote storage container details for PowerStore " \ + "array failed with error" + elif response_type == "remote_system_exception": + return "Failed to get the remote system" + + @staticmethod + def get_sc_exception(resp_type): + if resp_type == 'remote_none_sc': + return "Unable to find the remote storage container" + elif resp_type == "remote_sys_none": + return "Unable to find the remote system" + elif resp_type == "invalid_remote_addr": + return "Enter the valid remote_address for remote_system" diff --git a/tests/unit/plugins/module_utils/mock_volume_api.py b/tests/unit/plugins/module_utils/mock_volume_api.py index 8145728..e89e0f6 100644 --- a/tests/unit/plugins/module_utils/mock_volume_api.py +++ b/tests/unit/plugins/module_utils/mock_volume_api.py @@ -39,7 +39,9 @@ class MockVolumeApi: 'delete_remote_volume': None, 'state': None, 'app_type': None, - 'app_type_other': None + 'app_type_other': None, + 'appliance_name': None, + 'appliance_id': None } DESCRIPTION1 = 'Volume created' diff --git a/tests/unit/plugins/modules/test_cluster.py b/tests/unit/plugins/modules/test_cluster.py index d96e9c2..8b84264 100644 --- a/tests/unit/plugins/modules/test_cluster.py +++ b/tests/unit/plugins/modules/test_cluster.py @@ -12,8 +12,6 @@ import pytest from mock.mock import MagicMock from ansible_collections.dellemc.powerstore.tests.unit.plugins.module_utils.mock_cluster_api import MockClusterApi -from ansible_collections.dellemc.powerstore.tests.unit.plugins.module_utils.mock_sdk_response \ - import MockSDKResponse from ansible_collections.dellemc.powerstore.tests.unit.plugins.module_utils.mock_api_exception \ import MockApiException from ansible_collections.dellemc.powerstore.plugins.module_utils.storage.dell \ diff --git a/tests/unit/plugins/modules/test_dns.py b/tests/unit/plugins/modules/test_dns.py index 1f8116b..1bd4951 100644 --- a/tests/unit/plugins/modules/test_dns.py +++ b/tests/unit/plugins/modules/test_dns.py @@ -12,8 +12,6 @@ import pytest from mock.mock import MagicMock from ansible_collections.dellemc.powerstore.tests.unit.plugins.module_utils.mock_dns_api import MockDnsApi -from ansible_collections.dellemc.powerstore.tests.unit.plugins.module_utils.mock_sdk_response \ - import MockSDKResponse from ansible_collections.dellemc.powerstore.tests.unit.plugins.module_utils.mock_api_exception \ import MockApiException from ansible_collections.dellemc.powerstore.plugins.module_utils.storage.dell \ diff --git a/tests/unit/plugins/modules/test_filesystem.py b/tests/unit/plugins/modules/test_filesystem.py index 04b6fc9..300c2e3 100644 --- a/tests/unit/plugins/modules/test_filesystem.py +++ b/tests/unit/plugins/modules/test_filesystem.py @@ -10,8 +10,6 @@ import pytest from mock.mock import MagicMock from ansible_collections.dellemc.powerstore.tests.unit.plugins.module_utils.mock_filesystem_api import MockFilesystemApi -from ansible_collections.dellemc.powerstore.tests.unit.plugins.module_utils.mock_sdk_response \ - import MockSDKResponse from ansible_collections.dellemc.powerstore.tests.unit.plugins.module_utils.mock_api_exception \ import MockApiException from ansible_collections.dellemc.powerstore.plugins.module_utils.storage.dell \ diff --git a/tests/unit/plugins/modules/test_filesystem_snapshot.py b/tests/unit/plugins/modules/test_filesystem_snapshot.py index f4fed0d..9521d80 100644 --- a/tests/unit/plugins/modules/test_filesystem_snapshot.py +++ b/tests/unit/plugins/modules/test_filesystem_snapshot.py @@ -11,8 +11,6 @@ import pytest from mock.mock import MagicMock from ansible_collections.dellemc.powerstore.tests.unit.plugins.module_utils.mock_filesystem_snapshot_api import MockFilesystemSnapshotApi -from ansible_collections.dellemc.powerstore.tests.unit.plugins.module_utils.mock_sdk_response \ - import MockSDKResponse from ansible_collections.dellemc.powerstore.tests.unit.plugins.module_utils.mock_api_exception \ import MockApiException from ansible_collections.dellemc.powerstore.plugins.module_utils.storage.dell \ diff --git a/tests/unit/plugins/modules/test_host.py b/tests/unit/plugins/modules/test_host.py index 1b16c97..85ed1ae 100644 --- a/tests/unit/plugins/modules/test_host.py +++ b/tests/unit/plugins/modules/test_host.py @@ -12,8 +12,6 @@ import pytest from mock.mock import MagicMock from ansible_collections.dellemc.powerstore.tests.unit.plugins.module_utils.mock_host_api import MockHostApi -from ansible_collections.dellemc.powerstore.tests.unit.plugins.module_utils.mock_sdk_response \ - import MockSDKResponse from ansible_collections.dellemc.powerstore.tests.unit.plugins.module_utils.mock_api_exception \ import MockApiException from ansible_collections.dellemc.powerstore.plugins.module_utils.storage.dell \ diff --git a/tests/unit/plugins/modules/test_hostgroup.py b/tests/unit/plugins/modules/test_hostgroup.py index b20a63f..8db9bec 100644 --- a/tests/unit/plugins/modules/test_hostgroup.py +++ b/tests/unit/plugins/modules/test_hostgroup.py @@ -11,8 +11,6 @@ import pytest from mock.mock import MagicMock from ansible_collections.dellemc.powerstore.tests.unit.plugins.module_utils.mock_hostgroup_api import MockHostGroupApi -from ansible_collections.dellemc.powerstore.tests.unit.plugins.module_utils.mock_sdk_response \ - import MockSDKResponse from ansible_collections.dellemc.powerstore.tests.unit.plugins.module_utils.mock_api_exception \ import MockApiException from ansible_collections.dellemc.powerstore.plugins.module_utils.storage.dell \ diff --git a/tests/unit/plugins/modules/test_info.py b/tests/unit/plugins/modules/test_info.py index 6fd2052..ae12585 100644 --- a/tests/unit/plugins/modules/test_info.py +++ b/tests/unit/plugins/modules/test_info.py @@ -11,8 +11,6 @@ import pytest from mock.mock import MagicMock from ansible_collections.dellemc.powerstore.tests.unit.plugins.module_utils.mock_info_api import MockInfoApi -from ansible_collections.dellemc.powerstore.tests.unit.plugins.module_utils.mock_sdk_response \ - import MockSDKResponse from ansible_collections.dellemc.powerstore.tests.unit.plugins.module_utils.mock_api_exception \ import MockApiException from ansible_collections.dellemc.powerstore.plugins.module_utils.storage.dell \ @@ -298,3 +296,23 @@ def test_get_virtual_volume_response(self, info_module_mock): info_module_mock.module.params = self.get_module_args info_module_mock.perform_module_operation() info_module_mock.configuration.get_virtual_volume_list.assert_called() + + def test_get_storage_container_response(self, info_module_mock): + self.get_module_args.update({ + 'gather_subset': ['storage_container'], + 'filters': None, + 'all_pages': None + }) + info_module_mock.module.params = self.get_module_args + info_module_mock.perform_module_operation() + info_module_mock.configuration.get_storage_container_list.assert_called() + + def test_get_replication_groups(self, info_module_mock): + self.get_module_args.update({ + 'gather_subset': ['replication_group'], + 'filters': None, + 'all_pages': None + }) + info_module_mock.module.params = self.get_module_args + info_module_mock.perform_module_operation() + info_module_mock.protection.get_replication_groups.assert_called() diff --git a/tests/unit/plugins/modules/test_job.py b/tests/unit/plugins/modules/test_job.py index 5bcf3ac..c9b4fb7 100644 --- a/tests/unit/plugins/modules/test_job.py +++ b/tests/unit/plugins/modules/test_job.py @@ -12,8 +12,6 @@ import pytest from mock.mock import MagicMock from ansible_collections.dellemc.powerstore.tests.unit.plugins.module_utils.mock_job_api import MockJobApi -from ansible_collections.dellemc.powerstore.tests.unit.plugins.module_utils.mock_sdk_response \ - import MockSDKResponse from ansible_collections.dellemc.powerstore.tests.unit.plugins.module_utils.mock_api_exception \ import MockApiException from ansible_collections.dellemc.powerstore.plugins.module_utils.storage.dell \ diff --git a/tests/unit/plugins/modules/test_ldap_account.py b/tests/unit/plugins/modules/test_ldap_account.py index c06ab12..f5bb00c 100644 --- a/tests/unit/plugins/modules/test_ldap_account.py +++ b/tests/unit/plugins/modules/test_ldap_account.py @@ -12,8 +12,6 @@ import pytest from mock.mock import MagicMock from ansible_collections.dellemc.powerstore.tests.unit.plugins.module_utils.mock_ldap_account_api import MockLDAPAccountApi -from ansible_collections.dellemc.powerstore.tests.unit.plugins.module_utils.mock_sdk_response \ - import MockSDKResponse from ansible_collections.dellemc.powerstore.tests.unit.plugins.module_utils.mock_api_exception \ import MockApiException from ansible_collections.dellemc.powerstore.plugins.module_utils.storage.dell \ diff --git a/tests/unit/plugins/modules/test_ldap_domain.py b/tests/unit/plugins/modules/test_ldap_domain.py index 1688092..0dddaed 100644 --- a/tests/unit/plugins/modules/test_ldap_domain.py +++ b/tests/unit/plugins/modules/test_ldap_domain.py @@ -11,8 +11,6 @@ import pytest from mock.mock import MagicMock from ansible_collections.dellemc.powerstore.tests.unit.plugins.module_utils.mock_ldap_domain_api import MockLDAPDomainApi -from ansible_collections.dellemc.powerstore.tests.unit.plugins.module_utils.mock_sdk_response \ - import MockSDKResponse from ansible_collections.dellemc.powerstore.tests.unit.plugins.module_utils.mock_api_exception \ import MockApiException from ansible_collections.dellemc.powerstore.plugins.module_utils.storage.dell import utils diff --git a/tests/unit/plugins/modules/test_local_user.py b/tests/unit/plugins/modules/test_local_user.py index 702a2d3..69f4de6 100644 --- a/tests/unit/plugins/modules/test_local_user.py +++ b/tests/unit/plugins/modules/test_local_user.py @@ -11,8 +11,6 @@ import pytest from mock.mock import MagicMock from ansible_collections.dellemc.powerstore.tests.unit.plugins.module_utils.mock_local_user_api import MockLocalUserApi -from ansible_collections.dellemc.powerstore.tests.unit.plugins.module_utils.mock_sdk_response \ - import MockSDKResponse from ansible_collections.dellemc.powerstore.tests.unit.plugins.module_utils.mock_api_exception \ import MockApiException from ansible_collections.dellemc.powerstore.plugins.module_utils.storage.dell \ diff --git a/tests/unit/plugins/modules/test_nasserver.py b/tests/unit/plugins/modules/test_nasserver.py index 033b5f5..807b992 100644 --- a/tests/unit/plugins/modules/test_nasserver.py +++ b/tests/unit/plugins/modules/test_nasserver.py @@ -11,8 +11,6 @@ import pytest from mock.mock import MagicMock from ansible_collections.dellemc.powerstore.tests.unit.plugins.module_utils.mock_nasserver_api import MockNasServerApi -from ansible_collections.dellemc.powerstore.tests.unit.plugins.module_utils.mock_sdk_response \ - import MockSDKResponse from ansible_collections.dellemc.powerstore.tests.unit.plugins.module_utils.mock_api_exception \ import MockApiException from ansible_collections.dellemc.powerstore.plugins.module_utils.storage.dell \ diff --git a/tests/unit/plugins/modules/test_network.py b/tests/unit/plugins/modules/test_network.py index 8a07cf0..bf4c7ba 100644 --- a/tests/unit/plugins/modules/test_network.py +++ b/tests/unit/plugins/modules/test_network.py @@ -11,8 +11,6 @@ import pytest from mock.mock import MagicMock from ansible_collections.dellemc.powerstore.tests.unit.plugins.module_utils.mock_network_api import MockNetworkApi -from ansible_collections.dellemc.powerstore.tests.unit.plugins.module_utils.mock_sdk_response \ - import MockSDKResponse from ansible_collections.dellemc.powerstore.tests.unit.plugins.module_utils.mock_api_exception \ import MockApiException from ansible_collections.dellemc.powerstore.plugins.module_utils.storage.dell \ diff --git a/tests/unit/plugins/modules/test_nfs.py b/tests/unit/plugins/modules/test_nfs.py index 18c6b92..b11ed3e 100644 --- a/tests/unit/plugins/modules/test_nfs.py +++ b/tests/unit/plugins/modules/test_nfs.py @@ -11,8 +11,6 @@ import pytest from mock.mock import MagicMock from ansible_collections.dellemc.powerstore.tests.unit.plugins.module_utils.mock_nfs_api import MockNfsApi -from ansible_collections.dellemc.powerstore.tests.unit.plugins.module_utils.mock_sdk_response \ - import MockSDKResponse from ansible_collections.dellemc.powerstore.tests.unit.plugins.module_utils.mock_api_exception \ import MockApiException from ansible_collections.dellemc.powerstore.plugins.module_utils.storage.dell \ diff --git a/tests/unit/plugins/modules/test_ntp.py b/tests/unit/plugins/modules/test_ntp.py index 86b10e0..4bed8e7 100644 --- a/tests/unit/plugins/modules/test_ntp.py +++ b/tests/unit/plugins/modules/test_ntp.py @@ -12,8 +12,6 @@ from mock.mock import MagicMock from ansible_collections.dellemc.powerstore.tests.unit.plugins.module_utils.mock_ntp_api \ import MockNtpApi -from ansible_collections.dellemc.powerstore.tests.unit.plugins.module_utils.mock_sdk_response \ - import MockSDKResponse from ansible_collections.dellemc.powerstore.tests.unit.plugins.module_utils.mock_api_exception \ import MockApiException from ansible_collections.dellemc.powerstore.plugins.module_utils.storage.dell \ diff --git a/tests/unit/plugins/modules/test_protectionpolicy.py b/tests/unit/plugins/modules/test_protectionpolicy.py index d407f7f..9ed44f0 100644 --- a/tests/unit/plugins/modules/test_protectionpolicy.py +++ b/tests/unit/plugins/modules/test_protectionpolicy.py @@ -11,8 +11,6 @@ import pytest from mock.mock import MagicMock from ansible_collections.dellemc.powerstore.tests.unit.plugins.module_utils.mock_protectionpolicy_api import MockProtectionpolicyApi -from ansible_collections.dellemc.powerstore.tests.unit.plugins.module_utils.mock_sdk_response \ - import MockSDKResponse from ansible_collections.dellemc.powerstore.tests.unit.plugins.module_utils.mock_api_exception \ import MockApiException from ansible_collections.dellemc.powerstore.plugins.module_utils.storage.dell \ diff --git a/tests/unit/plugins/modules/test_quota.py b/tests/unit/plugins/modules/test_quota.py index db40041..23d7fd3 100644 --- a/tests/unit/plugins/modules/test_quota.py +++ b/tests/unit/plugins/modules/test_quota.py @@ -11,8 +11,6 @@ import pytest from mock.mock import MagicMock from ansible_collections.dellemc.powerstore.tests.unit.plugins.module_utils.mock_quota_api import MockQuotaApi -from ansible_collections.dellemc.powerstore.tests.unit.plugins.module_utils.mock_sdk_response \ - import MockSDKResponse from ansible_collections.dellemc.powerstore.tests.unit.plugins.module_utils.mock_api_exception \ import MockApiException from ansible_collections.dellemc.powerstore.plugins.module_utils.storage.dell \ diff --git a/tests/unit/plugins/modules/test_remote_support.py b/tests/unit/plugins/modules/test_remote_support.py index 10e092b..0645b06 100644 --- a/tests/unit/plugins/modules/test_remote_support.py +++ b/tests/unit/plugins/modules/test_remote_support.py @@ -13,8 +13,6 @@ from mock.mock import MagicMock from ansible_collections.dellemc.powerstore.tests.unit.plugins.module_utils.mock_remote_support_api \ import MockRemoteSupportApi -from ansible_collections.dellemc.powerstore.tests.unit.plugins.module_utils.mock_sdk_response \ - import MockSDKResponse from ansible_collections.dellemc.powerstore.tests.unit.plugins.module_utils.mock_api_exception \ import MockApiException from ansible_collections.dellemc.powerstore.plugins.module_utils.storage.dell \ diff --git a/tests/unit/plugins/modules/test_remote_support_contact.py b/tests/unit/plugins/modules/test_remote_support_contact.py index 93fdfec..26e78e5 100644 --- a/tests/unit/plugins/modules/test_remote_support_contact.py +++ b/tests/unit/plugins/modules/test_remote_support_contact.py @@ -13,8 +13,6 @@ from mock.mock import MagicMock from ansible_collections.dellemc.powerstore.tests.unit.plugins.module_utils.mock_remote_support_contact_api \ import MockRemoteSupportContactApi -from ansible_collections.dellemc.powerstore.tests.unit.plugins.module_utils.mock_sdk_response \ - import MockSDKResponse from ansible_collections.dellemc.powerstore.tests.unit.plugins.module_utils.mock_api_exception \ import MockApiException from ansible_collections.dellemc.powerstore.plugins.module_utils.storage.dell \ diff --git a/tests/unit/plugins/modules/test_remotesystem.py b/tests/unit/plugins/modules/test_remotesystem.py index 17b4490..2280b32 100644 --- a/tests/unit/plugins/modules/test_remotesystem.py +++ b/tests/unit/plugins/modules/test_remotesystem.py @@ -12,8 +12,6 @@ import pytest from mock.mock import MagicMock from ansible_collections.dellemc.powerstore.tests.unit.plugins.module_utils.mock_remotesystem_api import MockRemoteSystemApi -from ansible_collections.dellemc.powerstore.tests.unit.plugins.module_utils.mock_sdk_response \ - import MockSDKResponse from ansible_collections.dellemc.powerstore.tests.unit.plugins.module_utils.mock_api_exception \ import MockApiException from ansible_collections.dellemc.powerstore.plugins.module_utils.storage.dell \ diff --git a/tests/unit/plugins/modules/test_replicationrule.py b/tests/unit/plugins/modules/test_replicationrule.py index 7958db6..09626b2 100644 --- a/tests/unit/plugins/modules/test_replicationrule.py +++ b/tests/unit/plugins/modules/test_replicationrule.py @@ -12,8 +12,6 @@ import pytest from mock.mock import MagicMock from ansible_collections.dellemc.powerstore.tests.unit.plugins.module_utils.mock_replicationrule_api import MockReplicationRuleApi -from ansible_collections.dellemc.powerstore.tests.unit.plugins.module_utils.mock_sdk_response \ - import MockSDKResponse from ansible_collections.dellemc.powerstore.tests.unit.plugins.module_utils.mock_api_exception \ import MockApiException from ansible_collections.dellemc.powerstore.plugins.module_utils.storage.dell \ diff --git a/tests/unit/plugins/modules/test_replicationsession.py b/tests/unit/plugins/modules/test_replicationsession.py index cb67ac2..03ad4bf 100644 --- a/tests/unit/plugins/modules/test_replicationsession.py +++ b/tests/unit/plugins/modules/test_replicationsession.py @@ -12,8 +12,6 @@ import pytest from mock.mock import MagicMock from ansible_collections.dellemc.powerstore.tests.unit.plugins.module_utils.mock_replicationsession_api import MockReplicationSessionApi -from ansible_collections.dellemc.powerstore.tests.unit.plugins.module_utils.mock_sdk_response \ - import MockSDKResponse from ansible_collections.dellemc.powerstore.tests.unit.plugins.module_utils.mock_api_exception \ import MockApiException from ansible_collections.dellemc.powerstore.plugins.module_utils.storage.dell \ @@ -24,7 +22,10 @@ utils.PowerStoreException = MagicMock() from ansible.module_utils import basic basic.AnsibleModule = MagicMock() -from ansible_collections.dellemc.powerstore.plugins.modules.replicationsession import PowerstoreReplicationSession +from ansible_collections.dellemc.powerstore.plugins.modules.replicationsession\ + import PowerstoreReplicationSession +from ansible_collections.dellemc.powerstore.tests.unit.plugins.module_utils.\ + mock_fail_json import FailJsonException, fail_json class TestPowerstoreReplicationSession(): @@ -36,17 +37,28 @@ def replicationsession_module_mock(self, mocker): mocker.patch(MockReplicationSessionApi.MODULE_UTILS_PATH + '.PowerStoreException', new=MockApiException) replicationsession_module_mock = PowerstoreReplicationSession() replicationsession_module_mock.module = MagicMock() + replicationsession_module_mock.module.fail_json = fail_json return replicationsession_module_mock + def capture_fail_json_call(self, error_msg, replicationsession_module_mock): + try: + replicationsession_module_mock.perform_module_operation() + except FailJsonException as fj_object: + assert error_msg in fj_object.message + def test_get_replication_session_response(self, replicationsession_module_mock): self.get_module_args.update({ - 'session_id': "b05b5108-26b6-4567-a1d8-1c7795b2e6bc" + 'session_id': MockReplicationSessionApi.ID }) replicationsession_module_mock.module.params = self.get_module_args + replicationsession_module_mock.provisioning.get_cluster_list = MagicMock( + return_value=MockReplicationSessionApi.CLUSTER_DETAILS) replicationsession_module_mock.conn.protection.get_replication_session_details = MagicMock( return_value=MockReplicationSessionApi.REPLICATION_SESSION_DETAILS[0]) replicationsession_module_mock.perform_module_operation() - assert self.get_module_args['session_id'] == replicationsession_module_mock.module.exit_json.call_args[1]['replication_session_details']['id'] + assert self.get_module_args['session_id'] == \ + replicationsession_module_mock.module.exit_json.call_args[1][ + 'replication_session_details']['id'] replicationsession_module_mock.conn.protection.get_replication_session_details.assert_called() def test_get_replication_session_using_volume_response(self, replicationsession_module_mock): @@ -54,6 +66,8 @@ def test_get_replication_session_using_volume_response(self, replicationsession_ 'volume': "sample_volume" }) replicationsession_module_mock.module.params = self.get_module_args + replicationsession_module_mock.provisioning.get_cluster_list = MagicMock( + return_value=MockReplicationSessionApi.CLUSTER_DETAILS) replicationsession_module_mock.protection.get_replication_session_details = MagicMock( return_value=MockReplicationSessionApi.REPLICATION_SESSION_DETAILS[0]) replicationsession_module_mock.protection.get_replication_sessions = MagicMock( @@ -70,6 +84,8 @@ def test_get_replication_session_using_volume_id_response(self, replicationsessi 'volume': "634e4b95-e7bd-49e7-957b-6dc932642464" }) replicationsession_module_mock.module.params = self.get_module_args + replicationsession_module_mock.provisioning.get_cluster_list = MagicMock( + return_value=MockReplicationSessionApi.CLUSTER_DETAILS) replicationsession_module_mock.protection.get_replication_session_details = MagicMock( return_value=MockReplicationSessionApi.REPLICATION_SESSION_DETAILS[0]) replicationsession_module_mock.protection.get_replication_sessions = MagicMock( @@ -87,6 +103,8 @@ def test_get_replication_session_using_volume_not_found_response(self, replicati 'volume': "634e4b95-e7bd-49e7-957b-6dc932642464" }) replicationsession_module_mock.module.params = self.get_module_args + replicationsession_module_mock.provisioning.get_cluster_list = MagicMock( + return_value=MockReplicationSessionApi.CLUSTER_DETAILS) replicationsession_module_mock.protection.get_replication_session_details = MagicMock( return_value=MockReplicationSessionApi.REPLICATION_SESSION_DETAILS[0]) replicationsession_module_mock.protection.get_replication_sessions = MagicMock( @@ -101,6 +119,8 @@ def test_get_replication_session_using_volume_group_response(self, replicationse 'volume_group': "sample_volume_group" }) replicationsession_module_mock.module.params = self.get_module_args + replicationsession_module_mock.provisioning.get_cluster_list = MagicMock( + return_value=MockReplicationSessionApi.CLUSTER_DETAILS) replicationsession_module_mock.protection.get_replication_session_details = MagicMock( return_value=MockReplicationSessionApi.REPLICATION_SESSION_DETAILS_VG[1]) replicationsession_module_mock.protection.get_replication_sessions = MagicMock( @@ -117,6 +137,8 @@ def test_get_replication_session_using_nas_server_response(self, replicationsess 'nas_server': "sample_nas_server" }) replicationsession_module_mock.module.params = self.get_module_args + replicationsession_module_mock.provisioning.get_cluster_list = MagicMock( + return_value=MockReplicationSessionApi.CLUSTER_DETAILS) replicationsession_module_mock.protection.get_replication_session_details = MagicMock( return_value=MockReplicationSessionApi.REPLICATION_SESSION_DETAILS_NAS_SERVER[0]) replicationsession_module_mock.protection.get_replication_sessions = MagicMock( @@ -130,15 +152,17 @@ def test_get_replication_session_using_nas_server_response(self, replicationsess def test_get_replication_session_using_filesystem_response(self, replicationsession_module_mock): self.get_module_args.update({ - 'filesystem': "sample_filesystem" + 'filesystem': MockReplicationSessionApi.FS_NAME }) replicationsession_module_mock.module.params = self.get_module_args - replicationsession_module_mock.protection.get_replication_session_details = MagicMock( - return_value=MockReplicationSessionApi.REPLICATION_SESSION_DETAILS_FILESYSTEM[0]) - replicationsession_module_mock.protection.get_replication_sessions = MagicMock( - return_value=MockReplicationSessionApi.SESSION_IDS_FILESYSTEM) + replicationsession_module_mock.provisioning.get_cluster_list = MagicMock( + return_value=MockReplicationSessionApi.CLUSTER_DETAILS) replicationsession_module_mock.provisioning.get_filesystem_by_name = MagicMock( return_value=MockReplicationSessionApi.FILESYSTEM_DETAILS) + replicationsession_module_mock.protection.get_replication_sessions = MagicMock( + return_value=MockReplicationSessionApi.SESSION_IDS_FILESYSTEM) + replicationsession_module_mock.protection.get_replication_session_details = MagicMock( + return_value=MockReplicationSessionApi.REPLICATION_SESSION_DETAILS_FILESYSTEM[0]) replicationsession_module_mock.provisioning.get_filesystem_details = MagicMock( return_value=MockReplicationSessionApi.FILESYSTEM_DETAILS[0]) replicationsession_module_mock.perform_module_operation() @@ -146,10 +170,12 @@ def test_get_replication_session_using_filesystem_response(self, replicationsess def test_modify_from_ok_to_synchronizing_response(self, replicationsession_module_mock): self.get_module_args.update({ - 'session_id': "b05b5108-26b6-4567-a1d8-1c7795b2e6bc", - 'session_state': "synchronizing" + 'session_id': MockReplicationSessionApi.ID, + 'session_state': MockReplicationSessionApi.SYNCING_STATE }) replicationsession_module_mock.module.params = self.get_module_args + replicationsession_module_mock.provisioning.get_cluster_list = MagicMock( + return_value=MockReplicationSessionApi.CLUSTER_DETAILS) replicationsession_module_mock.conn.protection.get_replication_session_details = MagicMock( return_value=MockReplicationSessionApi.REPLICATION_SESSION_DETAILS[0]) replicationsession_module_mock.perform_module_operation() @@ -157,10 +183,12 @@ def test_modify_from_ok_to_synchronizing_response(self, replicationsession_modul def test_modify_from_ok_to_paused_response(self, replicationsession_module_mock): self.get_module_args.update({ - 'session_id': "b05b5108-26b6-4567-a1d8-1c7795b2e6bc", - 'session_state': "paused" + 'session_id': MockReplicationSessionApi.ID, + 'session_state': MockReplicationSessionApi.PAUSE_STATE }) replicationsession_module_mock.module.params = self.get_module_args + replicationsession_module_mock.provisioning.get_cluster_list = MagicMock( + return_value=MockReplicationSessionApi.CLUSTER_DETAILS) replicationsession_module_mock.conn.protection.get_replication_session_details = MagicMock( return_value=MockReplicationSessionApi.REPLICATION_SESSION_DETAILS[0]) replicationsession_module_mock.perform_module_operation() @@ -168,10 +196,12 @@ def test_modify_from_ok_to_paused_response(self, replicationsession_module_mock) def test_modify_from_ok_to_failed_over_response(self, replicationsession_module_mock): self.get_module_args.update({ - 'session_id': "b05b5108-26b6-4567-a1d8-1c7795b2e6bc", - 'session_state': "failed_over" + 'session_id': MockReplicationSessionApi.ID, + 'session_state': MockReplicationSessionApi.FAIL_OVER }) replicationsession_module_mock.module.params = self.get_module_args + replicationsession_module_mock.provisioning.get_cluster_list = MagicMock( + return_value=MockReplicationSessionApi.CLUSTER_DETAILS) replicationsession_module_mock.conn.protection.get_replication_session_details = MagicMock( return_value=MockReplicationSessionApi.REPLICATION_SESSION_DETAILS[0]) replicationsession_module_mock.perform_module_operation() @@ -179,10 +209,12 @@ def test_modify_from_ok_to_failed_over_response(self, replicationsession_module_ def test_modify_from_ok_to_failed_over_src_response(self, replicationsession_module_mock): self.get_module_args.update({ - 'session_id': "b05b5108-26b6-4567-a1d8-1c7795b2e6bc", - 'session_state': "failed_over" + 'session_id': MockReplicationSessionApi.ID, + 'session_state': MockReplicationSessionApi.FAIL_OVER }) replicationsession_module_mock.module.params = self.get_module_args + replicationsession_module_mock.provisioning.get_cluster_list = MagicMock( + return_value=MockReplicationSessionApi.CLUSTER_DETAILS) replicationsession_module_mock.conn.protection.get_replication_session_details = MagicMock( return_value=MockReplicationSessionApi.REPLICATION_SESSION_DETAILS_SRC[0]) replicationsession_module_mock.perform_module_operation() @@ -193,10 +225,12 @@ def test_modify_from_ok_to_failed_over_exception(self, replicationsession_module MockApiException.err_code = "1" MockApiException.status_code = "404" self.get_module_args.update({ - 'session_id': "b05b5108-26b6-4567-a1d8-1c7795b2e6bc", - 'session_state': "failed_over" + 'session_id': MockReplicationSessionApi.ID, + 'session_state': MockReplicationSessionApi.FAIL_OVER }) replicationsession_module_mock.module.params = self.get_module_args + replicationsession_module_mock.provisioning.get_cluster_list = MagicMock( + return_value=MockReplicationSessionApi.CLUSTER_DETAILS) replicationsession_module_mock.conn.protection.get_replication_session_details = MagicMock( return_value=MockReplicationSessionApi.REPLICATION_SESSION_DETAILS[0]) replicationsession_module_mock.conn.protection.failover_replication_session = MagicMock( @@ -206,10 +240,12 @@ def test_modify_from_ok_to_failed_over_exception(self, replicationsession_module def test_modify_from_sync_to_paused_response(self, replicationsession_module_mock): self.get_module_args.update({ - 'session_id': "b05b5108-26b6-4567-a1d8-1c7795b2e6bc", - 'session_state': "paused" + 'session_id': MockReplicationSessionApi.ID, + 'session_state': MockReplicationSessionApi.PAUSE_STATE }) replicationsession_module_mock.module.params = self.get_module_args + replicationsession_module_mock.provisioning.get_cluster_list = MagicMock( + return_value=MockReplicationSessionApi.CLUSTER_DETAILS) replicationsession_module_mock.conn.protection.get_replication_session_details = MagicMock( return_value=MockReplicationSessionApi.REPLICATION_SESSION_DETAILS_SYNC[0]) replicationsession_module_mock.perform_module_operation() @@ -217,10 +253,12 @@ def test_modify_from_sync_to_paused_response(self, replicationsession_module_moc def test_modify_from_sync_to_synchronizing_response(self, replicationsession_module_mock): self.get_module_args.update({ - 'session_id': "b05b5108-26b6-4567-a1d8-1c7795b2e6bc", - 'session_state': "synchronizing" + 'session_id': MockReplicationSessionApi.ID, + 'session_state': MockReplicationSessionApi.SYNCING_STATE }) replicationsession_module_mock.module.params = self.get_module_args + replicationsession_module_mock.provisioning.get_cluster_list = MagicMock( + return_value=MockReplicationSessionApi.CLUSTER_DETAILS) replicationsession_module_mock.conn.protection.get_replication_session_details = MagicMock( return_value=MockReplicationSessionApi.REPLICATION_SESSION_DETAILS_SYNC[0]) replicationsession_module_mock.perform_module_operation() @@ -231,23 +269,28 @@ def test_modify_from_sync_to_paused_exception(self, replicationsession_module_mo MockApiException.err_code = "1" MockApiException.status_code = "404" self.get_module_args.update({ - 'session_id': "b05b5108-26b6-4567-a1d8-1c7795b2e6bc", - 'session_state': "paused" + 'session_id': MockReplicationSessionApi.ID, + 'session_state': MockReplicationSessionApi.PAUSE_STATE }) replicationsession_module_mock.module.params = self.get_module_args + replicationsession_module_mock.provisioning.get_cluster_list = MagicMock( + return_value=MockReplicationSessionApi.CLUSTER_DETAILS) replicationsession_module_mock.conn.protection.get_replication_session_details = MagicMock( return_value=MockReplicationSessionApi.REPLICATION_SESSION_DETAILS_SYNC[0]) replicationsession_module_mock.conn.protection.pause_replication_session = MagicMock( side_effect=MockApiException) - replicationsession_module_mock.perform_module_operation() - replicationsession_module_mock.conn.protection.pause_replication_session.assert_called() + self.capture_fail_json_call( + MockReplicationSessionApi.get_rep_session_exception_response( + 'get_rep_session_exception'), replicationsession_module_mock) def test_modify_from_sync_to_failed_over_response(self, replicationsession_module_mock): self.get_module_args.update({ - 'session_id': "b05b5108-26b6-4567-a1d8-1c7795b2e6bc", - 'session_state': "failed_over" + 'session_id': MockReplicationSessionApi.ID, + 'session_state': MockReplicationSessionApi.FAIL_OVER }) replicationsession_module_mock.module.params = self.get_module_args + replicationsession_module_mock.provisioning.get_cluster_list = MagicMock( + return_value=MockReplicationSessionApi.CLUSTER_DETAILS) replicationsession_module_mock.conn.protection.get_replication_session_details = MagicMock( return_value=MockReplicationSessionApi.REPLICATION_SESSION_DETAILS_SYNC[0]) replicationsession_module_mock.perform_module_operation() @@ -255,10 +298,12 @@ def test_modify_from_sync_to_failed_over_response(self, replicationsession_modul def test_modify_from_sync_to_failed_over_src_response(self, replicationsession_module_mock): self.get_module_args.update({ - 'session_id': "b05b5108-26b6-4567-a1d8-1c7795b2e6bc", - 'session_state': "failed_over" + 'session_id': MockReplicationSessionApi.ID, + 'session_state': MockReplicationSessionApi.FAIL_OVER }) replicationsession_module_mock.module.params = self.get_module_args + replicationsession_module_mock.provisioning.get_cluster_list = MagicMock( + return_value=MockReplicationSessionApi.CLUSTER_DETAILS) replicationsession_module_mock.conn.protection.get_replication_session_details = MagicMock( return_value=MockReplicationSessionApi.REPLICATION_SESSION_DETAILS_SYNC_SRC[0]) replicationsession_module_mock.perform_module_operation() @@ -266,10 +311,12 @@ def test_modify_from_sync_to_failed_over_src_response(self, replicationsession_m def test_modify_from_paused_to_sync_response(self, replicationsession_module_mock): self.get_module_args.update({ - 'session_id': "b05b5108-26b6-4567-a1d8-1c7795b2e6bc", - 'session_state': "synchronizing" + 'session_id': MockReplicationSessionApi.ID, + 'session_state': MockReplicationSessionApi.SYNCING_STATE }) replicationsession_module_mock.module.params = self.get_module_args + replicationsession_module_mock.provisioning.get_cluster_list = MagicMock( + return_value=MockReplicationSessionApi.CLUSTER_DETAILS) replicationsession_module_mock.conn.protection.get_replication_session_details = MagicMock( return_value=MockReplicationSessionApi.REPLICATION_SESSION_DETAILS_PAUSED[0]) replicationsession_module_mock.perform_module_operation() @@ -277,10 +324,12 @@ def test_modify_from_paused_to_sync_response(self, replicationsession_module_moc def test_modify_from_paused_to_paused_response(self, replicationsession_module_mock): self.get_module_args.update({ - 'session_id': "b05b5108-26b6-4567-a1d8-1c7795b2e6bc", - 'session_state': "paused" + 'session_id': MockReplicationSessionApi.ID, + 'session_state': MockReplicationSessionApi.PAUSE_STATE }) replicationsession_module_mock.module.params = self.get_module_args + replicationsession_module_mock.provisioning.get_cluster_list = MagicMock( + return_value=MockReplicationSessionApi.CLUSTER_DETAILS) replicationsession_module_mock.conn.protection.get_replication_session_details = MagicMock( return_value=MockReplicationSessionApi.REPLICATION_SESSION_DETAILS_PAUSED[0]) replicationsession_module_mock.perform_module_operation() @@ -288,22 +337,26 @@ def test_modify_from_paused_to_paused_response(self, replicationsession_module_m def test_modify_from_paused_to_sync_dest_error(self, replicationsession_module_mock): self.get_module_args.update({ - 'session_id': "b05b5108-26b6-4567-a1d8-1c7795b2e6bc", - 'session_state': "synchronizing" + 'session_id': MockReplicationSessionApi.ID, + 'session_state': MockReplicationSessionApi.SYNCING_STATE }) replicationsession_module_mock.module.params = self.get_module_args + replicationsession_module_mock.provisioning.get_cluster_list = MagicMock( + return_value=MockReplicationSessionApi.CLUSTER_DETAILS) replicationsession_module_mock.conn.protection.get_replication_session_details = MagicMock( return_value=MockReplicationSessionApi.REPLICATION_SESSION_DETAILS_PAUSED_DES[0]) - replicationsession_module_mock.perform_module_operation() - assert MockReplicationSessionApi.paused_to_sync_dest_error_failed_msg() in \ - replicationsession_module_mock.module.fail_json.call_args[1]['msg'] + self.capture_fail_json_call( + MockReplicationSessionApi.get_rep_session_exception_response( + 'pause_to_sync_dest_error'), replicationsession_module_mock) def test_modify_from_paused_to_failed_over_response(self, replicationsession_module_mock): self.get_module_args.update({ - 'session_id': "b05b5108-26b6-4567-a1d8-1c7795b2e6bc", - 'session_state': "failed_over" + 'session_id': MockReplicationSessionApi.ID, + 'session_state': MockReplicationSessionApi.FAIL_OVER }) replicationsession_module_mock.module.params = self.get_module_args + replicationsession_module_mock.provisioning.get_cluster_list = MagicMock( + return_value=MockReplicationSessionApi.CLUSTER_DETAILS) replicationsession_module_mock.conn.protection.get_replication_session_details = MagicMock( return_value=MockReplicationSessionApi.REPLICATION_SESSION_DETAILS_PAUSED[0]) replicationsession_module_mock.perform_module_operation() @@ -311,10 +364,12 @@ def test_modify_from_paused_to_failed_over_response(self, replicationsession_mod def test_modify_from_paused_to_failed_over_des_response(self, replicationsession_module_mock): self.get_module_args.update({ - 'session_id': "b05b5108-26b6-4567-a1d8-1c7795b2e6bc", - 'session_state': "failed_over" + 'session_id': MockReplicationSessionApi.ID, + 'session_state': MockReplicationSessionApi.FAIL_OVER }) replicationsession_module_mock.module.params = self.get_module_args + replicationsession_module_mock.provisioning.get_cluster_list = MagicMock( + return_value=MockReplicationSessionApi.CLUSTER_DETAILS) replicationsession_module_mock.conn.protection.get_replication_session_details = MagicMock( return_value=MockReplicationSessionApi.REPLICATION_SESSION_DETAILS_PAUSED_DES[0]) replicationsession_module_mock.perform_module_operation() @@ -325,23 +380,28 @@ def test_modify_from_paused_to_failed_over_exception(self, replicationsession_mo MockApiException.err_code = "1" MockApiException.status_code = "404" self.get_module_args.update({ - 'session_id': "b05b5108-26b6-4567-a1d8-1c7795b2e6bc", - 'session_state': "failed_over" + 'session_id': MockReplicationSessionApi.ID, + 'session_state': MockReplicationSessionApi.FAIL_OVER }) replicationsession_module_mock.module.params = self.get_module_args + replicationsession_module_mock.provisioning.get_cluster_list = MagicMock( + return_value=MockReplicationSessionApi.CLUSTER_DETAILS) replicationsession_module_mock.conn.protection.get_replication_session_details = MagicMock( return_value=MockReplicationSessionApi.REPLICATION_SESSION_DETAILS_PAUSED[0]) replicationsession_module_mock.conn.protection.failover_replication_session = MagicMock( side_effect=MockApiException) - replicationsession_module_mock.perform_module_operation() - replicationsession_module_mock.conn.protection.failover_replication_session.assert_called() + self.capture_fail_json_call( + MockReplicationSessionApi.get_rep_session_exception_response( + 'get_rep_session_exception'), replicationsession_module_mock) def test_modify_from_failing_over_to_sync_response(self, replicationsession_module_mock): self.get_module_args.update({ - 'session_id': "b05b5108-26b6-4567-a1d8-1c7795b2e6bc", - 'session_state': "synchronizing" + 'session_id': MockReplicationSessionApi.ID, + 'session_state': MockReplicationSessionApi.SYNCING_STATE }) replicationsession_module_mock.module.params = self.get_module_args + replicationsession_module_mock.provisioning.get_cluster_list = MagicMock( + return_value=MockReplicationSessionApi.CLUSTER_DETAILS) replicationsession_module_mock.conn.protection.get_replication_session_details = MagicMock( return_value=MockReplicationSessionApi.REPLICATION_SESSION_DETAILS_FAILING_OVER[0]) replicationsession_module_mock.perform_module_operation() @@ -352,23 +412,28 @@ def test_modify_from_failing_over_to_sync_exception(self, replicationsession_mod MockApiException.err_code = "1" MockApiException.status_code = "404" self.get_module_args.update({ - 'session_id': "b05b5108-26b6-4567-a1d8-1c7795b2e6bc", - 'session_state': "synchronizing" + 'session_id': MockReplicationSessionApi.ID, + 'session_state': MockReplicationSessionApi.SYNCING_STATE }) replicationsession_module_mock.module.params = self.get_module_args + replicationsession_module_mock.provisioning.get_cluster_list = MagicMock( + return_value=MockReplicationSessionApi.CLUSTER_DETAILS) replicationsession_module_mock.conn.protection.get_replication_session_details = MagicMock( return_value=MockReplicationSessionApi.REPLICATION_SESSION_DETAILS_FAILING_OVER[0]) replicationsession_module_mock.conn.protection.sync_replication_session = MagicMock( side_effect=MockApiException) - replicationsession_module_mock.perform_module_operation() - replicationsession_module_mock.conn.protection.sync_replication_session.assert_called() + self.capture_fail_json_call( + MockReplicationSessionApi.get_rep_session_exception_response( + 'get_rep_session_exception'), replicationsession_module_mock) def test_modify_from_failing_over_to_paused_response(self, replicationsession_module_mock): self.get_module_args.update({ - 'session_id': "b05b5108-26b6-4567-a1d8-1c7795b2e6bc", - 'session_state': "paused" + 'session_id': MockReplicationSessionApi.ID, + 'session_state': MockReplicationSessionApi.PAUSE_STATE }) replicationsession_module_mock.module.params = self.get_module_args + replicationsession_module_mock.provisioning.get_cluster_list = MagicMock( + return_value=MockReplicationSessionApi.CLUSTER_DETAILS) replicationsession_module_mock.conn.protection.get_replication_session_details = MagicMock( return_value=MockReplicationSessionApi.REPLICATION_SESSION_DETAILS_FAILING_OVER[0]) replicationsession_module_mock.perform_module_operation() @@ -376,10 +441,12 @@ def test_modify_from_failing_over_to_paused_response(self, replicationsession_mo def test_modify_from_failing_over_to_failed_over_response(self, replicationsession_module_mock): self.get_module_args.update({ - 'session_id': "b05b5108-26b6-4567-a1d8-1c7795b2e6bc", - 'session_state': "failed_over" + 'session_id': MockReplicationSessionApi.ID, + 'session_state': MockReplicationSessionApi.FAIL_OVER }) replicationsession_module_mock.module.params = self.get_module_args + replicationsession_module_mock.provisioning.get_cluster_list = MagicMock( + return_value=MockReplicationSessionApi.CLUSTER_DETAILS) replicationsession_module_mock.conn.protection.get_replication_session_details = MagicMock( return_value=MockReplicationSessionApi.REPLICATION_SESSION_DETAILS_FAILING_OVER[0]) replicationsession_module_mock.perform_module_operation() @@ -387,10 +454,12 @@ def test_modify_from_failing_over_to_failed_over_response(self, replicationsessi def test_modify_from_failed_over_to_sync_response(self, replicationsession_module_mock): self.get_module_args.update({ - 'session_id': "b05b5108-26b6-4567-a1d8-1c7795b2e6bc", - 'session_state': "synchronizing" + 'session_id': MockReplicationSessionApi.ID, + 'session_state': MockReplicationSessionApi.SYNCING_STATE }) replicationsession_module_mock.module.params = self.get_module_args + replicationsession_module_mock.provisioning.get_cluster_list = MagicMock( + return_value=MockReplicationSessionApi.CLUSTER_DETAILS) replicationsession_module_mock.conn.protection.get_replication_session_details = MagicMock( return_value=MockReplicationSessionApi.REPLICATION_SESSION_DETAILS_FAILED_OVER[0]) replicationsession_module_mock.perform_module_operation() @@ -398,10 +467,12 @@ def test_modify_from_failed_over_to_sync_response(self, replicationsession_modul def test_modify_from_failed_over_to_failed_over_response(self, replicationsession_module_mock): self.get_module_args.update({ - 'session_id': "b05b5108-26b6-4567-a1d8-1c7795b2e6bc", - 'session_state': "failed_over" + 'session_id': MockReplicationSessionApi.ID, + 'session_state': MockReplicationSessionApi.FAIL_OVER }) replicationsession_module_mock.module.params = self.get_module_args + replicationsession_module_mock.provisioning.get_cluster_list = MagicMock( + return_value=MockReplicationSessionApi.CLUSTER_DETAILS) replicationsession_module_mock.conn.protection.get_replication_session_details = MagicMock( return_value=MockReplicationSessionApi.REPLICATION_SESSION_DETAILS_FAILED_OVER[0]) replicationsession_module_mock.perform_module_operation() @@ -409,10 +480,12 @@ def test_modify_from_failed_over_to_failed_over_response(self, replicationsessio def test_modify_from_failed_over_to_failed_over_des_response(self, replicationsession_module_mock): self.get_module_args.update({ - 'session_id': "b05b5108-26b6-4567-a1d8-1c7795b2e6bc", - 'session_state': "failed_over" + 'session_id': MockReplicationSessionApi.ID, + 'session_state': MockReplicationSessionApi.FAIL_OVER }) replicationsession_module_mock.module.params = self.get_module_args + replicationsession_module_mock.provisioning.get_cluster_list = MagicMock( + return_value=MockReplicationSessionApi.CLUSTER_DETAILS) replicationsession_module_mock.conn.protection.get_replication_session_details = MagicMock( return_value=MockReplicationSessionApi.REPLICATION_SESSION_DETAILS_FAILED_OVER_DES[0]) replicationsession_module_mock.perform_module_operation() @@ -420,87 +493,86 @@ def test_modify_from_failed_over_to_failed_over_des_response(self, replicationse def test_modify_from_failed_over_to_sync_destination_response(self, replicationsession_module_mock): self.get_module_args.update({ - 'session_id': "b05b5108-26b6-4567-a1d8-1c7795b2e6bc", - 'session_state': "synchronizing" + 'session_id': MockReplicationSessionApi.ID, + 'session_state': MockReplicationSessionApi.SYNCING_STATE }) replicationsession_module_mock.module.params = self.get_module_args + replicationsession_module_mock.provisioning.get_cluster_list = MagicMock( + return_value=MockReplicationSessionApi.CLUSTER_DETAILS) replicationsession_module_mock.conn.protection.get_replication_session_details = MagicMock( return_value=MockReplicationSessionApi.REPLICATION_SESSION_DETAILS_FAILED_OVER_DES[0]) - replicationsession_module_mock.perform_module_operation() - assert MockReplicationSessionApi.failed_over_to_sync_destination_failed_msg() in \ - replicationsession_module_mock.module.fail_json.call_args[1]['msg'] + self.capture_fail_json_call( + MockReplicationSessionApi.get_rep_session_exception_response( + 'failover_to_sync_destination_error'), replicationsession_module_mock) def test_modify_from_failed_over_to_sync_exception(self, replicationsession_module_mock): MockApiException.HTTP_ERR = "1" MockApiException.err_code = "1" MockApiException.status_code = "404" self.get_module_args.update({ - 'session_id': "b05b5108-26b6-4567-a1d8-1c7795b2e6bc", - 'session_state': "synchronizing" + 'session_id': MockReplicationSessionApi.ID, + 'session_state': MockReplicationSessionApi.SYNCING_STATE }) replicationsession_module_mock.module.params = self.get_module_args + replicationsession_module_mock.provisioning.get_cluster_list = MagicMock( + return_value=MockReplicationSessionApi.CLUSTER_DETAILS) replicationsession_module_mock.conn.protection.get_replication_session_details = MagicMock( return_value=MockReplicationSessionApi.REPLICATION_SESSION_DETAILS_FAILED_OVER[0]) replicationsession_module_mock.conn.protection.sync_replication_session = MagicMock( side_effect=MockApiException) - replicationsession_module_mock.perform_module_operation() - replicationsession_module_mock.conn.protection.sync_replication_session.assert_called() + self.capture_fail_json_call(MockReplicationSessionApi.get_rep_session_exception_response( + 'get_rep_session_exception'), replicationsession_module_mock) def test_modify_from_failed_over_to_paused_error(self, replicationsession_module_mock): self.get_module_args.update({ - 'session_id': "b05b5108-26b6-4567-a1d8-1c7795b2e6bc", - 'session_state': "paused" + 'session_id': MockReplicationSessionApi.ID, + 'session_state': MockReplicationSessionApi.PAUSE_STATE }) replicationsession_module_mock.module.params = self.get_module_args + replicationsession_module_mock.provisioning.get_cluster_list = MagicMock( + return_value=MockReplicationSessionApi.CLUSTER_DETAILS) replicationsession_module_mock.conn.protection.get_replication_session_details = MagicMock( return_value=MockReplicationSessionApi.REPLICATION_SESSION_DETAILS_FAILED_OVER[0]) - replicationsession_module_mock.perform_module_operation() - assert MockReplicationSessionApi.failed_over_to_paused_failed_msg() in \ - replicationsession_module_mock.module.fail_json.call_args[1]['msg'] + self.capture_fail_json_call( + MockReplicationSessionApi.get_rep_session_exception_response( + 'failOver_to_paused_error'), replicationsession_module_mock) def test_change_state_from_transitioning_states_response(self, replicationsession_module_mock): self.get_module_args.update({ - 'session_id': "b05b5108-26b6-4567-a1d8-1c7795b2e6bc", - 'session_state': "paused" + 'session_id': MockReplicationSessionApi.ID, + 'session_state': MockReplicationSessionApi.PAUSE_STATE }) replicationsession_module_mock.module.params = self.get_module_args + replicationsession_module_mock.provisioning.get_cluster_list = MagicMock( + return_value=MockReplicationSessionApi.CLUSTER_DETAILS) replicationsession_module_mock.conn.protection.get_replication_session_details = MagicMock( return_value=MockReplicationSessionApi.REPLICATION_SESSION_DETAILS_RESUMING[0]) - replicationsession_module_mock.perform_module_operation() - assert MockReplicationSessionApi.change_state_from_transitioning_states_failed_msg() in \ - replicationsession_module_mock.module.fail_json.call_args[1]['msg'] + self.capture_fail_json_call( + MockReplicationSessionApi.get_rep_session_exception_response( + 'state_from_transition_state'), replicationsession_module_mock) def test_change_state_from_remaining_states_response(self, replicationsession_module_mock): self.get_module_args.update({ - 'session_id': "b05b5108-26b6-4567-a1d8-1c7795b2e6bc", - 'session_state': "paused" + 'session_id': MockReplicationSessionApi.ID, + 'session_state': MockReplicationSessionApi.PAUSE_STATE }) replicationsession_module_mock.module.params = self.get_module_args + replicationsession_module_mock.provisioning.get_cluster_list = MagicMock( + return_value=MockReplicationSessionApi.CLUSTER_DETAILS) replicationsession_module_mock.conn.protection.get_replication_session_details = MagicMock( return_value=MockReplicationSessionApi.REPLICATION_SESSION_DETAILS_SYSTEM_PAUSED[0]) - replicationsession_module_mock.perform_module_operation() - assert MockReplicationSessionApi.change_state_from_remaining_states_failed_msg() in \ - replicationsession_module_mock.module.fail_json.call_args[1]['msg'] + self.capture_fail_json_call( + MockReplicationSessionApi.get_rep_session_exception_response( + 'any_to_remaining_state'), replicationsession_module_mock) - def test_get_replication_session_multi_cluster(self, replicationsession_module_mock): + def test_modify_role_replication_session(self, replicationsession_module_mock): self.get_module_args.update({ - 'session_id': "b05b5108-26b6-4567-a1d8-1c7795b2e6bc" + 'session_id': MockReplicationSessionApi.ID, + 'role': "Metro_Preferred" }) replicationsession_module_mock.module.params = self.get_module_args - replicationsession_module_mock.conn.protection.get_replication_session_details = MagicMock( - return_value=MockReplicationSessionApi.REPLICATION_SESSION_DETAILS[0]) replicationsession_module_mock.provisioning.get_cluster_list = MagicMock( return_value=MockReplicationSessionApi.CLUSTER_DETAILS) - replicationsession_module_mock.perform_module_operation() - assert self.get_module_args['session_id'] == replicationsession_module_mock.module.exit_json.call_args[1]['replication_session_details']['id'] - replicationsession_module_mock.conn.protection.get_replication_session_details.assert_called() - - def test_modify_role_replicatio_session(self, replicationsession_module_mock): - self.get_module_args.update({ - 'session_id': "b05b5108-26b6-4567-a1d8-1c7795b2e6bc", - 'role': "Metro_Preferred" - }) - replicationsession_module_mock.module.params = self.get_module_args replicationsession_module_mock.conn.protection.get_replication_session_details = MagicMock( return_value=MockReplicationSessionApi.REPLICATION_SESSION_DETAILS[0]) replicationsession_module_mock.perform_module_operation() @@ -509,21 +581,23 @@ def test_modify_role_replicatio_session(self, replicationsession_module_mock): def test_modify_metro_paused_to_sync_response(self, replicationsession_module_mock): self.get_module_args.update({ - 'session_id': "b05b5108-26b6-4567-a1d8-1c7795b2e6bc", - 'session_state': "synchronizing" + 'session_id': MockReplicationSessionApi.ID, + 'session_state': MockReplicationSessionApi.SYNCING_STATE }) replicationsession_module_mock.module.params = self.get_module_args + replicationsession_module_mock.provisioning.get_cluster_list = MagicMock( + return_value=MockReplicationSessionApi.CLUSTER_DETAILS) replicationsession_module_mock.conn.protection.get_replication_session_details = MagicMock( return_value=MockReplicationSessionApi.METRO_SESSION_DETAILS_PAUSED[0]) replicationsession_module_mock.perform_module_operation() replicationsession_module_mock.conn.protection.resume_replication_session.assert_called() - def test_modify_role_replicatio_session_exception(self, replicationsession_module_mock): + def test_modify_role_replication_session_exception(self, replicationsession_module_mock): MockApiException.HTTP_ERR = "1" MockApiException.err_code = "1" MockApiException.status_code = "404" self.get_module_args.update({ - 'session_id': "b05b5108-26b6-4567-a1d8-1c7795b2e6bc", + 'session_id': MockReplicationSessionApi.ID, 'role': "Metro_Preferred" }) replicationsession_module_mock.module.params = self.get_module_args @@ -532,7 +606,201 @@ def test_modify_role_replicatio_session_exception(self, replicationsession_modul return_value=MockReplicationSessionApi.REPLICATION_SESSION_DETAILS[0]) replicationsession_module_mock.conn.protection.modify_replication_session = MagicMock( side_effect=MockApiException) + self.capture_fail_json_call(MockReplicationSessionApi.get_rep_session_exception_response( + 'get_rep_session_exception'), replicationsession_module_mock) + + def test_replication_session_with_repl_group(self, replicationsession_module_mock): + self.get_module_args.update({ + 'replication_group': MockReplicationSessionApi.REP_GROUP}) + replicationsession_module_mock.module.params = self.get_module_args + replicationsession_module_mock.provisioning.get_cluster_list = MagicMock( + return_value=MockReplicationSessionApi.CLUSTER_DETAILS) + replicationsession_module_mock.protection.get_replication_group_details_by_name = MagicMock( + return_value=MockReplicationSessionApi.REP_GROUP_DETAILS) + replicationsession_module_mock.protection.get_replication_sessions = MagicMock( + return_value=MockReplicationSessionApi.SESSION_IDS_REP_GROUP) + replicationsession_module_mock.protection.get_replication_session_details = MagicMock( + return_value=MockReplicationSessionApi.REPLICATION_SESSION_DETAILS_REP_GROUP[0]) + replicationsession_module_mock.protection.get_replication_group_details = MagicMock( + return_value=MockReplicationSessionApi.REP_GROUP_DETAILS[0]) replicationsession_module_mock.perform_module_operation() - replicationsession_module_mock.conn.protection.modify_replication_session.assert_called() - assert MockReplicationSessionApi.modify_role_failed_msg() in \ - replicationsession_module_mock.module.fail_json.call_args[1]['msg'] + replicationsession_module_mock.conn.protection.get_replication_session_details.assert_called() + + def test_replication_session_with_repl_group_id(self, replicationsession_module_mock): + self.get_module_args.update({ + 'replication_group': MockReplicationSessionApi.REP_GROUP}) + replicationsession_module_mock.module.params = self.get_module_args + replicationsession_module_mock.provisioning.get_cluster_list = MagicMock( + return_value=MockReplicationSessionApi.CLUSTER_DETAILS) + replicationsession_module_mock.protection.get_replication_sessions = MagicMock( + return_value=MockReplicationSessionApi.SESSION_IDS_REP_GROUP) + replicationsession_module_mock.protection.get_replication_session_details = MagicMock( + return_value=MockReplicationSessionApi.REPLICATION_SESSION_DETAILS_REP_GROUP[0]) + replicationsession_module_mock.protection.get_replication_group_details = MagicMock( + return_value=MockReplicationSessionApi.REP_GROUP_DETAILS[0]) + replicationsession_module_mock.perform_module_operation() + replicationsession_module_mock.conn.protection.get_replication_session_details.assert_called() + + def test_get_replication_session_exception(self, replicationsession_module_mock): + self.get_module_args.update({ + 'session_id': MockReplicationSessionApi.ID, + }) + replicationsession_module_mock.module.params = self.get_module_args + replicationsession_module_mock.provisioning.get_cluster_list = MagicMock( + return_value=MockReplicationSessionApi.CLUSTER_DETAILS) + replicationsession_module_mock.conn.protection.get_replication_session_details = MagicMock( + return_value=None) + self.capture_fail_json_call(MockReplicationSessionApi.get_rep_session_exception_response( + 'get_rep_session_error'), replicationsession_module_mock) + + def test_get_replication_session_rep_group_exception(self, replicationsession_module_mock): + self.get_module_args.update({ + 'replication_group': MockReplicationSessionApi.REP_GROUP, + }) + replicationsession_module_mock.module.params = self.get_module_args + replicationsession_module_mock.provisioning.get_cluster_list = MagicMock( + return_value=MockReplicationSessionApi.CLUSTER_DETAILS) + replicationsession_module_mock.protection.get_replication_group_details_by_name = MagicMock( + return_value=None) + self.capture_fail_json_call(MockReplicationSessionApi.get_rep_session_error( + 'get_rep_group_error'), replicationsession_module_mock) + + def test_cluster_exception(self, replicationsession_module_mock): + self.get_module_args.update({ + 'replication_group': MockReplicationSessionApi.REP_GROUP, + }) + replicationsession_module_mock.module.params = self.get_module_args + replicationsession_module_mock.provisioning.get_cluster_list = MagicMock( + side_effect=MockApiException) + self.capture_fail_json_call(MockReplicationSessionApi.get_rep_session_error( + 'get_cluster_error'), replicationsession_module_mock) + + def test_get_replication_session_nas_exception(self, replicationsession_module_mock): + self.get_module_args.update({ + 'nas_server': "sample_nas_server" + }) + replicationsession_module_mock.module.params = self.get_module_args + replicationsession_module_mock.provisioning.get_cluster_list = MagicMock( + return_value=MockReplicationSessionApi.CLUSTER_DETAILS) + replicationsession_module_mock.provisioning.get_nas_server_by_name = MagicMock( + return_value=None) + self.capture_fail_json_call(MockReplicationSessionApi.get_rep_session_error( + 'nas_error'), replicationsession_module_mock) + + def test_get_replication_session_filesystem_exception(self, replicationsession_module_mock): + self.get_module_args.update({ + 'filesystem': MockReplicationSessionApi.FS_NAME + }) + replicationsession_module_mock.module.params = self.get_module_args + replicationsession_module_mock.provisioning.get_cluster_list = MagicMock( + return_value=MockReplicationSessionApi.CLUSTER_DETAILS) + replicationsession_module_mock.provisioning.get_filesystem_by_name = MagicMock( + return_value=None) + self.capture_fail_json_call(MockReplicationSessionApi.get_rep_session_error( + 'fs_error'), replicationsession_module_mock) + + def test_get_replication_session_vg_exception(self, replicationsession_module_mock): + self.get_module_args.update({ + 'volume_group': "sample_vg" + }) + replicationsession_module_mock.module.params = self.get_module_args + replicationsession_module_mock.provisioning.get_cluster_list = MagicMock( + return_value=MockReplicationSessionApi.CLUSTER_DETAILS) + replicationsession_module_mock.provisioning.get_volume_group_by_name = MagicMock( + return_value=None) + self.capture_fail_json_call(MockReplicationSessionApi.get_rep_session_error( + 'vg_error'), replicationsession_module_mock) + + def test_get_replication_session_vol_exception(self, replicationsession_module_mock): + self.get_module_args.update({ + 'volume': "sample_vol" + }) + replicationsession_module_mock.module.params = self.get_module_args + replicationsession_module_mock.provisioning.get_cluster_list = MagicMock( + return_value=MockReplicationSessionApi.CLUSTER_DETAILS) + replicationsession_module_mock.provisioning.get_volume_by_name = MagicMock( + return_value=None) + self.capture_fail_json_call(MockReplicationSessionApi.get_rep_session_error( + 'vol_error'), replicationsession_module_mock) + + def test_modify_from_failed_over_to_sync_destination(self, replicationsession_module_mock): + self.get_module_args.update({ + 'session_id': MockReplicationSessionApi.ID, + 'session_state': MockReplicationSessionApi.FAIL_OVER + }) + replicationsession_module_mock.module.params = self.get_module_args + replicationsession_module_mock.provisioning.get_cluster_list = MagicMock( + return_value=MockReplicationSessionApi.CLUSTER_DETAILS) + replicationsession_module_mock.conn.protection.get_replication_session_details = MagicMock( + return_value=MockReplicationSessionApi.REPLICATION_SESSION_DETAILS_SYNC[1]) + replicationsession_module_mock.protection.failover_replication_session = MagicMock(return_value=True) + replicationsession_module_mock.perform_module_operation() + assert replicationsession_module_mock.module.exit_json.call_args[1]['changed'] is True + + def test_get_replication_session_filesystem_nas(self, replicationsession_module_mock): + self.get_module_args.update({ + 'filesystem': MockReplicationSessionApi.FS_NAME, + 'nas_server': "6299d83a-37dc-340b-788f-4ad525462806" + }) + replicationsession_module_mock.module.params = self.get_module_args + replicationsession_module_mock.provisioning.get_cluster_list = MagicMock( + return_value=MockReplicationSessionApi.CLUSTER_DETAILS) + replicationsession_module_mock.provisioning.get_nas_server_details = MagicMock( + MockReplicationSessionApi.NAS_SERVER_DETAILS[0]) + replicationsession_module_mock.provisioning.get_filesystem_by_name = MagicMock( + return_value=MockReplicationSessionApi.FILESYSTEM_DETAILS) + replicationsession_module_mock.protection.get_replication_sessions = MagicMock( + return_value=MockReplicationSessionApi.SESSION_IDS_FILESYSTEM) + replicationsession_module_mock.protection.get_replication_session_details = MagicMock( + return_value=MockReplicationSessionApi.REPLICATION_SESSION_DETAILS_FILESYSTEM[0]) + replicationsession_module_mock.provisioning.get_filesystem_details = MagicMock( + return_value=MockReplicationSessionApi.FILESYSTEM_DETAILS[0]) + replicationsession_module_mock.perform_module_operation() + replicationsession_module_mock.conn.protection.get_replication_session_details.assert_called() + + def test_get_replication_session_filesystem_nas_exception(self, replicationsession_module_mock): + self.get_module_args.update({ + 'filesystem': MockReplicationSessionApi.FS_NAME, + 'nas_server': "6299d83a-37dc-340b-788f-4ad525462806" + }) + replicationsession_module_mock.module.params = self.get_module_args + replicationsession_module_mock.provisioning.get_cluster_list = MagicMock( + return_value=MockReplicationSessionApi.CLUSTER_DETAILS) + replicationsession_module_mock.provisioning.get_nas_server_details = MagicMock( + side_effect=MockApiException) + self.capture_fail_json_call(MockReplicationSessionApi.get_rep_session_error( + 'fs_nas_error'), replicationsession_module_mock) + + def test_get_replication_session_filesystem_nas_none_exception(self, replicationsession_module_mock): + self.get_module_args.update({ + 'filesystem': MockReplicationSessionApi.FS_NAME, + 'nas_server': "6299d83a-37dc-340b-788f-4ad525462806" + }) + replicationsession_module_mock.module.params = self.get_module_args + replicationsession_module_mock.provisioning.get_cluster_list = MagicMock( + return_value=MockReplicationSessionApi.CLUSTER_DETAILS) + replicationsession_module_mock.provisioning.get_nas_server_details = MagicMock( + return_value=None) + self.capture_fail_json_call(MockReplicationSessionApi.get_rep_session_error( + 'fs_nas_error'), replicationsession_module_mock) + + def test_empty_cluster(self, replicationsession_module_mock): + self.get_module_args.update({ + 'replication_group': MockReplicationSessionApi.REP_GROUP, + }) + replicationsession_module_mock.module.params = self.get_module_args + replicationsession_module_mock.get_clusters = MagicMock( + return_value=[]) + self.capture_fail_json_call(MockReplicationSessionApi.get_rep_session_error( + 'empty_cluster'), replicationsession_module_mock) + + def test_rep_session_none(self, replicationsession_module_mock): + self.get_module_args.update({ + 'replication_group': MockReplicationSessionApi.REP_GROUP, + }) + replicationsession_module_mock.module.params = self.get_module_args + replicationsession_module_mock.provisioning.get_cluster_list = MagicMock( + return_value=MockReplicationSessionApi.CLUSTER_DETAILS) + replicationsession_module_mock.get_replication_session_details = MagicMock(return_value=[]) + self.capture_fail_json_call(MockReplicationSessionApi.get_rep_session_error( + 'non_existing_session'), replicationsession_module_mock) diff --git a/tests/unit/plugins/modules/test_role.py b/tests/unit/plugins/modules/test_role.py index d3655c0..b8c6f88 100644 --- a/tests/unit/plugins/modules/test_role.py +++ b/tests/unit/plugins/modules/test_role.py @@ -12,8 +12,6 @@ import pytest from mock.mock import MagicMock from ansible_collections.dellemc.powerstore.tests.unit.plugins.module_utils.mock_role_api import MockRoleApi -from ansible_collections.dellemc.powerstore.tests.unit.plugins.module_utils.mock_sdk_response \ - import MockSDKResponse from ansible_collections.dellemc.powerstore.tests.unit.plugins.module_utils.mock_api_exception \ import MockApiException from ansible_collections.dellemc.powerstore.plugins.module_utils.storage.dell \ diff --git a/tests/unit/plugins/modules/test_security_config.py b/tests/unit/plugins/modules/test_security_config.py index 39c7bed..38c246d 100644 --- a/tests/unit/plugins/modules/test_security_config.py +++ b/tests/unit/plugins/modules/test_security_config.py @@ -12,8 +12,6 @@ import pytest from mock.mock import MagicMock from ansible_collections.dellemc.powerstore.tests.unit.plugins.module_utils.mock_security_config_api import MockSecurityConfigApi -from ansible_collections.dellemc.powerstore.tests.unit.plugins.module_utils.mock_sdk_response \ - import MockSDKResponse from ansible_collections.dellemc.powerstore.tests.unit.plugins.module_utils.mock_api_exception \ import MockApiException from ansible_collections.dellemc.powerstore.plugins.module_utils.storage.dell \ diff --git a/tests/unit/plugins/modules/test_smbshare.py b/tests/unit/plugins/modules/test_smbshare.py index 0556bde..6da0c7e 100644 --- a/tests/unit/plugins/modules/test_smbshare.py +++ b/tests/unit/plugins/modules/test_smbshare.py @@ -11,8 +11,6 @@ import pytest from mock.mock import MagicMock from ansible_collections.dellemc.powerstore.tests.unit.plugins.module_utils.mock_smbshare_api import MockSMBShareApi -from ansible_collections.dellemc.powerstore.tests.unit.plugins.module_utils.mock_sdk_response \ - import MockSDKResponse from ansible_collections.dellemc.powerstore.tests.unit.plugins.module_utils.mock_api_exception \ import MockApiException from ansible_collections.dellemc.powerstore.plugins.module_utils.storage.dell \ diff --git a/tests/unit/plugins/modules/test_smtp_config.py b/tests/unit/plugins/modules/test_smtp_config.py index a9af020..26f3923 100644 --- a/tests/unit/plugins/modules/test_smtp_config.py +++ b/tests/unit/plugins/modules/test_smtp_config.py @@ -12,8 +12,6 @@ import pytest from mock.mock import MagicMock from ansible_collections.dellemc.powerstore.tests.unit.plugins.module_utils.mock_smtp_config_api import MockSmtpConfigApi -from ansible_collections.dellemc.powerstore.tests.unit.plugins.module_utils.mock_sdk_response \ - import MockSDKResponse from ansible_collections.dellemc.powerstore.tests.unit.plugins.module_utils.mock_api_exception \ import MockApiException from ansible_collections.dellemc.powerstore.plugins.module_utils.storage.dell \ diff --git a/tests/unit/plugins/modules/test_snapshot.py b/tests/unit/plugins/modules/test_snapshot.py index 30079b4..b83495f 100644 --- a/tests/unit/plugins/modules/test_snapshot.py +++ b/tests/unit/plugins/modules/test_snapshot.py @@ -12,8 +12,6 @@ from mock.mock import MagicMock from ansible_collections.dellemc.powerstore.tests.unit.plugins.module_utils.\ mock_snapshot_api import MockSnapshotApi -from ansible_collections.dellemc.powerstore.tests.unit.plugins.module_utils.\ - mock_sdk_response import MockSDKResponse from ansible_collections.dellemc.powerstore.tests.unit.plugins.module_utils.\ mock_api_exception import MockApiException from ansible_collections.dellemc.powerstore.plugins.module_utils.storage.dell import utils diff --git a/tests/unit/plugins/modules/test_snapshotrule.py b/tests/unit/plugins/modules/test_snapshotrule.py index 2847d66..133c314 100644 --- a/tests/unit/plugins/modules/test_snapshotrule.py +++ b/tests/unit/plugins/modules/test_snapshotrule.py @@ -11,8 +11,6 @@ import pytest from mock.mock import MagicMock from ansible_collections.dellemc.powerstore.tests.unit.plugins.module_utils.mock_snapshotrule_api import MockSnapshotruleApi -from ansible_collections.dellemc.powerstore.tests.unit.plugins.module_utils.mock_sdk_response \ - import MockSDKResponse from ansible_collections.dellemc.powerstore.tests.unit.plugins.module_utils.mock_api_exception \ import MockApiException from ansible_collections.dellemc.powerstore.plugins.module_utils.storage.dell \ diff --git a/tests/unit/plugins/modules/test_storage_container.py b/tests/unit/plugins/modules/test_storage_container.py new file mode 100644 index 0000000..3659c69 --- /dev/null +++ b/tests/unit/plugins/modules/test_storage_container.py @@ -0,0 +1,331 @@ +# Copyright: (c) 2023, Dell Technologies + +# Apache License version 2.0 (see MODULE-LICENSE or http://www.apache.org/licenses/LICENSE-2.0.txt) + +"""Unit Tests for storage container module for PowerStore""" + +from __future__ import (absolute_import, division, print_function) + +__metaclass__ = type + + +import pytest +from mock.mock import MagicMock +from ansible_collections.dellemc.powerstore.tests.unit.plugins.module_utils.mock_storage_container_api import MockStorageContainerApi +from ansible_collections.dellemc.powerstore.tests.unit.plugins.module_utils.mock_api_exception \ + import MockApiException +from ansible_collections.dellemc.powerstore.plugins.module_utils.storage.dell \ + import utils + +utils.get_logger = MagicMock() +remote_config = MagicMock() +remote_config.config_mgmt.get_storage_container_details = MagicMock(return_value=MockStorageContainerApi.REMOTE_STORAGE_CONTAINER_1) +utils.get_powerstore_connection = MagicMock(side_effect=[ + MagicMock(), + remote_config +]) +utils.PowerStoreException = MagicMock() +from ansible.module_utils import basic +basic.AnsibleModule = MagicMock() +from ansible_collections.dellemc.powerstore.plugins.modules.storage_container import PowerStoreStorageContainer, StorageContainerHandler +from ansible_collections.dellemc.powerstore.tests.unit.plugins.module_utils.mock_fail_json import FailJsonException, fail_json + + +class TestPowerStoreStorageContainer(): + + get_module_args = MockStorageContainerApi.STORAGE_CONTAINER_COMMON_ARGS + + @pytest.fixture + def storage_container_module_mock(self, mocker): + mocker.patch(MockStorageContainerApi.MODULE_UTILS_PATH + '.PowerStoreException', new=MockApiException) + storage_container_module_mock = PowerStoreStorageContainer() + storage_container_module_mock.module = MagicMock() + storage_container_module_mock.module.check_mode = False + storage_container_module_mock.module.fail_json = fail_json + return storage_container_module_mock + + def capture_fail_json_call(self, error_msg, storage_container_module_mock): + try: + StorageContainerHandler().handle( + storage_container_module_mock, + storage_container_module_mock.module.params) + except FailJsonException as fj_object: + assert error_msg in fj_object.message + + def test_get_storage_container_response(self, storage_container_module_mock): + self.get_module_args.update({ + 'storage_container_id': "storage_container_id", + 'state': "present" + }) + storage_container_module_mock.module.params = self.get_module_args + StorageContainerHandler().handle(storage_container_module_mock, storage_container_module_mock.module.params) + storage_container_module_mock.configuration.get_storage_container_details.assert_called() + + def test_get_storage_container_exception(self, storage_container_module_mock): + MockApiException.HTTP_ERR = "1" + MockApiException.err_code = "1" + MockApiException.status_code = "404" + self.get_module_args.update({ + 'storage_container_id': 16, + 'state': "present" + }) + storage_container_module_mock.module.params = self.get_module_args + storage_container_module_mock.configuration.get_storage_container_details = MagicMock( + side_effect=MockApiException) + self.capture_fail_json_call( + MockStorageContainerApi.get_storage_container_exception_response( + 'get_container_exception'), storage_container_module_mock) + + def test_get_storage_container_response_with_name(self, storage_container_module_mock): + self.get_module_args.update({ + 'storage_container_name': MockStorageContainerApi.STORAGE_CONTAINER_NAME_1, + 'state': "present" + }) + storage_container_module_mock.module.params = self.get_module_args + StorageContainerHandler().handle(storage_container_module_mock, storage_container_module_mock.module.params) + storage_container_module_mock.configuration.get_storage_container_details_by_name.assert_called() + + def test_create_storage_container(self, storage_container_module_mock): + self.get_module_args.update({'storage_container_name': MockStorageContainerApi.STORAGE_CONTAINER_NAME_1, + 'quota': 0, + 'storage_protocol': "SCSI", + 'high_water_mark': 60, + 'state': "present"}) + storage_container_module_mock.module.params = self.get_module_args + storage_container_module_mock.configuration.get_storage_container_details_by_name = MagicMock( + return_value=None) + StorageContainerHandler().handle(storage_container_module_mock, storage_container_module_mock.module.params) + storage_container_module_mock.configuration.create_storage_container.assert_called() + + def test_create_storage_container_exception(self, storage_container_module_mock): + MockApiException.HTTP_ERR = "1" + MockApiException.err_code = "1" + MockApiException.status_code = "404" + self.get_module_args.update({'storage_container_name': MockStorageContainerApi.STORAGE_CONTAINER_NAME_1, + 'quota': 10, + 'storage_protocol': "SCSI", + 'high_water_mark': 60, + 'state': "present"}) + storage_container_module_mock.module.params = self.get_module_args + storage_container_module_mock.configuration.get_storage_container_details_by_name = MagicMock( + return_value=None) + storage_container_module_mock.configuration.create_storage_container = MagicMock( + side_effect=MockApiException) + self.capture_fail_json_call( + MockStorageContainerApi.get_storage_container_exception_response( + 'create_container_exception'), storage_container_module_mock) + + def test_modify_storage_container(self, storage_container_module_mock): + self.get_module_args.update({'storage_container_id': "storage_container_id_1", + 'quota': 0, + 'storage_protocol': "NVMe", + 'new_name': "New_storage_container_name", + 'state': "present"}) + storage_container_module_mock.module.params = self.get_module_args + storage_container_module_mock.configuration.get_storage_container_details = MagicMock( + return_value=MockStorageContainerApi.STORAGE_CONTAINER_DETAILS) + StorageContainerHandler().handle(storage_container_module_mock, storage_container_module_mock.module.params) + + def test_modify_storage_container_exception(self, storage_container_module_mock): + MockApiException.HTTP_ERR = "1" + MockApiException.err_code = "1" + MockApiException.status_code = "404" + self.get_module_args.update({'storage_container_id': "storage_container_id_1", + 'quota': 0, + 'storage_protocol': "NVMe", + 'new_name': "New_storage_container_name", + 'state': "present"}) + storage_container_module_mock.module.params = self.get_module_args + storage_container_module_mock.configuration.get_storage_container_details = MagicMock( + return_value=MockStorageContainerApi.STORAGE_CONTAINER_DETAILS) + storage_container_module_mock.configuration.modify_storage_container_details = MagicMock( + side_effect=MockApiException) + self.capture_fail_json_call( + MockStorageContainerApi.get_storage_container_exception_response( + 'modify_container_exception'), storage_container_module_mock) + + def test_delete_storage_container(self, storage_container_module_mock): + self.get_module_args.update({ + 'storage_container_name': MockStorageContainerApi.STORAGE_CONTAINER_NAME_1, + 'state': "absent" + }) + storage_container_module_mock.module.params = self.get_module_args + StorageContainerHandler().handle(storage_container_module_mock, storage_container_module_mock.module.params) + storage_container_module_mock.configuration.delete_storage_container.assert_called() + + def test_delete_storage_container_exception(self, storage_container_module_mock): + MockApiException.HTTP_ERR = "1" + MockApiException.err_code = "1" + MockApiException.status_code = "404" + self.get_module_args.update({ + 'storage_container_name': MockStorageContainerApi.STORAGE_CONTAINER_NAME_1, + 'state': "absent" + }) + storage_container_module_mock.module.params = self.get_module_args + storage_container_module_mock.configuration.delete_storage_container = MagicMock( + side_effect=MockApiException) + self.capture_fail_json_call( + MockStorageContainerApi.get_storage_container_exception_response( + 'delete_container_exp'), storage_container_module_mock) + + def before_destinations_operation(self, storage_container_module_mock): + self.get_module_args.update({ + 'storage_container_name': MockStorageContainerApi.STORAGE_CONTAINER_NAME_1, + 'storage_container_destination': { + "remote_address": MockStorageContainerApi.MASKED_VALUE, + "user": "user", + "password": MockStorageContainerApi.MASKED_VALUE, + "verifycert": False, + "port": 443, + "timeout": 120, + "remote_system": MockStorageContainerApi.REMOTE_SYS_NAME, + "remote_storage_container": MockStorageContainerApi.STORAGE_CONTAINER_NAME_1 + }, + 'state': "present"}) + storage_container_module_mock.module.params = self.get_module_args + storage_container_module_mock.configuration.get_storage_container_details = MagicMock( + return_value=MockStorageContainerApi.CREATE_STORAGE_CONTAINER_DESTINATION) + + def test_create_storage_container_destination(self, storage_container_module_mock): + self.before_destinations_operation(storage_container_module_mock) + storage_container_module_mock.protection.get_remote_system_by_name = MagicMock( + return_value=MockStorageContainerApi.REMOTE_SYSTEM_DETAILS) + storage_container_module_mock.get_remote_storage_container = MagicMock( + return_value=MockStorageContainerApi.REMOTE_STORAGE_CONTAINER) + StorageContainerHandler().handle(storage_container_module_mock, storage_container_module_mock.module.params) + storage_container_module_mock.configuration.create_storage_container_destination.assert_called() + + def test_create_sc_destination_exception(self, storage_container_module_mock): + MockApiException.HTTP_ERR = "1" + MockApiException.err_code = "1" + MockApiException.status_code = "404" + self.before_destinations_operation(storage_container_module_mock) + storage_container_module_mock.protection.get_remote_system_by_name = MagicMock( + return_value=MockStorageContainerApi.REMOTE_SYSTEM_DETAILS1) + storage_container_module_mock.configuration.create_storage_container_destination = MagicMock( + side_effect=MockApiException) + self.capture_fail_json_call( + MockStorageContainerApi.get_storage_container_exception_response( + 'create_destination_exp'), storage_container_module_mock) + + def before_sc_destination_delete(self, storage_container_module_mock): + self.get_module_args.update({ + 'storage_container_name': MockStorageContainerApi.STORAGE_CONTAINER_NAME_1, + 'storage_container_destination_state': 'absent', + 'storage_container_destination': { + "remote_address": MockStorageContainerApi.MASKED_VALUE, + "user": "user", + "password": MockStorageContainerApi.MASKED_VALUE, + "validate_certs": False, + "port": 443, + "timeout": 120, + "remote_system": MockStorageContainerApi.REMOTE_SYS_ID, + "remote_storage_container": MockStorageContainerApi.REMOTE_SC_ID + }, + 'state': "present"}) + storage_container_module_mock.module.params = self.get_module_args + + def test_delete_storage_container_destination(self, storage_container_module_mock): + self.before_sc_destination_delete(storage_container_module_mock) + storage_container_module_mock.configuration.get_storage_container_details = MagicMock( + return_value=MockStorageContainerApi.REMOTE_STORAGE_CONTAINER_1) + storage_container_module_mock.protection.get_remote_system_details = MagicMock( + return_value=MockStorageContainerApi.REMOTE_SYSTEM_DETAILS[0]) + StorageContainerHandler().handle(storage_container_module_mock, storage_container_module_mock.module.params) + storage_container_module_mock.configuration.delete_storage_container_destination.assert_called() + + def test_delete_storage_container_destination_exp(self, storage_container_module_mock): + MockApiException.HTTP_ERR = "1" + MockApiException.err_code = "1" + MockApiException.status_code = "404" + self.before_sc_destination_delete(storage_container_module_mock) + storage_container_module_mock.configuration.get_storage_container_details = MagicMock( + return_value=MockStorageContainerApi.CREATE_STORAGE_CONTAINER_DESTINATION) + storage_container_module_mock.protection.get_remote_system_details = MagicMock( + return_value=MockStorageContainerApi.REMOTE_SYSTEM_DETAILS[0]) + storage_container_module_mock.get_remote_storage_container = MagicMock( + return_value=MockStorageContainerApi.REMOTE_STORAGE_CONTAINER_1) + storage_container_module_mock.configuration.delete_storage_container_destination = MagicMock( + side_effect=MockApiException) + self.capture_fail_json_call(MockStorageContainerApi.get_storage_container_exception_response( + 'delete_destination_exp'), storage_container_module_mock) + + def test_delete_storage_container_destination_empty_remote_container(self, storage_container_module_mock): + self.get_module_args.update({ + 'storage_container_name': MockStorageContainerApi.STORAGE_CONTAINER_NAME_1, + 'storage_container_destination_state': 'absent', + 'state': "present"}) + storage_container_module_mock.module.params = self.get_module_args + storage_container_module_mock.configuration.get_storage_container_details = MagicMock( + return_value=MockStorageContainerApi.CREATE_STORAGE_CONTAINER_DESTINATION) + self.capture_fail_json_call(MockStorageContainerApi.get_storage_container_exception_response( + 'remote_dict_exception'), storage_container_module_mock) + + def test_get_remote_system_exception(self, storage_container_module_mock): + self.before_destinations_operation(storage_container_module_mock) + storage_container_module_mock.protection.get_remote_system_by_name = MagicMock( + side_effect=MockApiException) + self.capture_fail_json_call(MockStorageContainerApi.get_storage_container_exception_response( + 'remote_system_exception'), storage_container_module_mock) + + def test_get_remote_storage_container_exception(self, storage_container_module_mock): + self.before_destinations_operation(storage_container_module_mock) + storage_container_module_mock.configuration.get_storage_container_details = MagicMock( + return_value=MockStorageContainerApi.CREATE_STORAGE_CONTAINER_DESTINATION) + storage_container_module_mock.protection.get_remote_system_by_name = MagicMock( + return_value=MockStorageContainerApi.REMOTE_SYSTEM_DETAILS) + storage_container_module_mock.get_remote_storage_container = MagicMock( + return_value=None) + self.capture_fail_json_call(MockStorageContainerApi.get_sc_exception( + 'remote_none_sc'), storage_container_module_mock) + + def test_get_remote_system_none_exception(self, storage_container_module_mock): + self.before_destinations_operation(storage_container_module_mock) + storage_container_module_mock.get_storage_container_details = MagicMock( + return_value=MockStorageContainerApi.CREATE_STORAGE_CONTAINER_DESTINATION) + storage_container_module_mock.get_remote_system = MagicMock( + return_value=None) + self.capture_fail_json_call(MockStorageContainerApi.get_sc_exception( + 'remote_sys_none'), storage_container_module_mock) + + def test_delete_storage_container_destination_get_remote_sc_exp(self, storage_container_module_mock): + self.before_sc_destination_delete(storage_container_module_mock) + storage_container_module_mock.configuration.get_storage_container_details = MagicMock( + return_value=MockStorageContainerApi.CREATE_STORAGE_CONTAINER_DESTINATION) + storage_container_module_mock.protection.get_remote_system_details = MagicMock( + return_value=MockStorageContainerApi.REMOTE_SYSTEM_DETAILS[0]) + storage_container_module_mock.get_remote_storage_container = MagicMock( + return_value=None) + self.capture_fail_json_call(MockStorageContainerApi.get_sc_exception( + 'remote_none_sc'), storage_container_module_mock) + + def test_delete_storage_container_destination_get_remote_sys_exp(self, storage_container_module_mock): + self.before_sc_destination_delete(storage_container_module_mock) + storage_container_module_mock.get_storage_container_details = MagicMock( + return_value=MockStorageContainerApi.CREATE_STORAGE_CONTAINER_DESTINATION) + storage_container_module_mock.get_remote_system = MagicMock( + return_value=None) + self.capture_fail_json_call(MockStorageContainerApi.get_sc_exception( + 'remote_sys_none'), storage_container_module_mock) + + def test_get_remote_system_invalid_addr_exception(self, storage_container_module_mock): + self.get_module_args.update({ + 'storage_container_name': MockStorageContainerApi.STORAGE_CONTAINER_NAME_1, + 'storage_container_destination': { + "remote_address": MockStorageContainerApi.MASKED_VALUE1, + "user": "user", + "password": MockStorageContainerApi.MASKED_VALUE, + "verifycert": False, + "port": 443, + "timeout": 120, + "remote_system": MockStorageContainerApi.REMOTE_SYS_NAME, + "remote_storage_container": MockStorageContainerApi.STORAGE_CONTAINER_NAME_1 + }, + 'state': "present"}) + storage_container_module_mock.module.params = self.get_module_args + storage_container_module_mock.configuration.get_storage_container_details = MagicMock( + return_value=MockStorageContainerApi.CREATE_STORAGE_CONTAINER_DESTINATION) + storage_container_module_mock.protection.get_remote_system_by_name = MagicMock( + return_value=MockStorageContainerApi.REMOTE_SYSTEM_DETAILS1) + self.capture_fail_json_call(MockStorageContainerApi.get_sc_exception( + 'invalid_remote_addr'), storage_container_module_mock) diff --git a/tests/unit/plugins/modules/test_vcenter.py b/tests/unit/plugins/modules/test_vcenter.py index dc6d20c..09e5c48 100644 --- a/tests/unit/plugins/modules/test_vcenter.py +++ b/tests/unit/plugins/modules/test_vcenter.py @@ -10,8 +10,6 @@ import pytest from mock.mock import MagicMock from ansible_collections.dellemc.powerstore.tests.unit.plugins.module_utils.mock_vcenter_api import MockVCenterApi -from ansible_collections.dellemc.powerstore.tests.unit.plugins.module_utils.mock_sdk_response \ - import MockSDKResponse from ansible_collections.dellemc.powerstore.tests.unit.plugins.module_utils.mock_api_exception \ import MockApiException from ansible_collections.dellemc.powerstore.plugins.module_utils.storage.dell \ diff --git a/tests/unit/plugins/modules/test_volume.py b/tests/unit/plugins/modules/test_volume.py index 9526bf7..9975337 100644 --- a/tests/unit/plugins/modules/test_volume.py +++ b/tests/unit/plugins/modules/test_volume.py @@ -10,8 +10,6 @@ import pytest from mock.mock import MagicMock from ansible_collections.dellemc.powerstore.tests.unit.plugins.module_utils.mock_volume_api import MockVolumeApi -from ansible_collections.dellemc.powerstore.tests.unit.plugins.module_utils.mock_sdk_response \ - import MockSDKResponse from ansible_collections.dellemc.powerstore.tests.unit.plugins.module_utils.mock_api_exception \ import MockApiException from ansible_collections.dellemc.powerstore.plugins.module_utils.storage.dell \ @@ -101,7 +99,8 @@ def test_create_volume(self, volume_module_mock): 'protection_policy': 'sample_protection_policy', 'state': 'present', 'app_type': 'Relational_Databases_Other', - 'app_type_other': 'Max_DB' + 'app_type_other': 'Max_DB', + 'appliance_id': 'A1' }) volume_module_mock.module.params = self.get_module_args volume_module_mock.provisioning.get_volume_by_name = MagicMock( diff --git a/tests/unit/plugins/modules/test_volumegroup.py b/tests/unit/plugins/modules/test_volumegroup.py index 65d0eda..0a757ba 100644 --- a/tests/unit/plugins/modules/test_volumegroup.py +++ b/tests/unit/plugins/modules/test_volumegroup.py @@ -10,8 +10,6 @@ import pytest from mock.mock import MagicMock from ansible_collections.dellemc.powerstore.tests.unit.plugins.module_utils.mock_volumegroup_api import MockVolumeGroupApi -from ansible_collections.dellemc.powerstore.tests.unit.plugins.module_utils.mock_sdk_response \ - import MockSDKResponse from ansible_collections.dellemc.powerstore.tests.unit.plugins.module_utils.mock_api_exception \ import MockApiException from ansible_collections.dellemc.powerstore.plugins.module_utils.storage.dell \ From 09e8300d5e33596ef992063a9d5d2789abe3c16c Mon Sep 17 00:00:00 2001 From: Pavan-Mudunuri Date: Mon, 26 Jun 2023 19:21:13 +0530 Subject: [PATCH 2/4] Ansible modules for PowerStore release version 2.0.0 --- .ansible-lint | 1 - .github/.ansible-lint | 5 -- CHANGELOG.rst | 3 +- changelogs/changelog.yaml | 4 +- docs/Release Notes.md | 3 +- docs/samples/create_multiple_volumes.yml | 29 ----------- .../samples/create_multiple_volumes_async.yml | 32 ------------ docs/samples/delete_multiple_volumes.yml | 26 ---------- docs/samples/find_empty_volume_groups.yml | 48 ------------------ playbooks/modules/email.yml | 2 +- .../samples/capacity_volumes.yml | 45 ++++++++--------- playbooks/samples/create_multiple_volumes.yml | 27 ++++++++++ .../samples/create_multiple_volumes_async.yml | 31 ++++++++++++ playbooks/samples/delete_multiple_volumes.yml | 25 ++++++++++ .../samples/find_empty_volume_groups.yml | 49 +++++++++++++++++++ ...get_fs_used_size_greaterthan_threshold.yml | 44 ++++++++--------- ...mbshares_associated_with_given_fs_name.yml | 42 ++++++++-------- {docs => playbooks}/samples/get_unused_fs.yml | 39 ++++++++------- .../samples/search_volumes.yml | 22 ++++----- 19 files changed, 237 insertions(+), 240 deletions(-) delete mode 100644 .github/.ansible-lint delete mode 100644 docs/samples/create_multiple_volumes.yml delete mode 100644 docs/samples/create_multiple_volumes_async.yml delete mode 100644 docs/samples/delete_multiple_volumes.yml delete mode 100644 docs/samples/find_empty_volume_groups.yml rename {docs => playbooks}/samples/capacity_volumes.yml (67%) create mode 100644 playbooks/samples/create_multiple_volumes.yml create mode 100644 playbooks/samples/create_multiple_volumes_async.yml create mode 100644 playbooks/samples/delete_multiple_volumes.yml create mode 100644 playbooks/samples/find_empty_volume_groups.yml rename {docs => playbooks}/samples/get_fs_used_size_greaterthan_threshold.yml (63%) rename {docs => playbooks}/samples/get_smbshares_associated_with_given_fs_name.yml (57%) rename {docs => playbooks}/samples/get_unused_fs.yml (60%) rename {docs => playbooks}/samples/search_volumes.yml (70%) diff --git a/.ansible-lint b/.ansible-lint index 14f922f..4a9971a 100644 --- a/.ansible-lint +++ b/.ansible-lint @@ -2,4 +2,3 @@ exclude_paths: - changelogs/ - .github/ - meta/ - - roles/powerflex_sdc/molecule/ diff --git a/.github/.ansible-lint b/.github/.ansible-lint deleted file mode 100644 index 14f922f..0000000 --- a/.github/.ansible-lint +++ /dev/null @@ -1,5 +0,0 @@ -exclude_paths: - - changelogs/ - - .github/ - - meta/ - - roles/powerflex_sdc/molecule/ diff --git a/CHANGELOG.rst b/CHANGELOG.rst index cabef71..3219bfd 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -12,7 +12,8 @@ Minor Changes ------------- - Added support for manual appliance selection in volume module. -- Added support for replication group in replication session module. +- Added support for replication group in replication session module to perform async vVOL replication. +- Added support for PowerStore Medusa 3.5.x. - Info module is enhanced to list storage containers and replication groups. New Modules diff --git a/changelogs/changelog.yaml b/changelogs/changelog.yaml index bf825bc..12990b3 100644 --- a/changelogs/changelog.yaml +++ b/changelogs/changelog.yaml @@ -190,8 +190,10 @@ releases: changes: minor_changes: - Added support for manual appliance selection in volume module. - - Added support for replication group in replication session module. + - Added support for replication group in replication session module + to perform async vVOL replication. - Info module is enhanced to list storage containers and replication group. + - Added support for PowerStore Medusa 3.5.x. modules: - description: Manage Storage Containers on Dell PowerStore name: storage_container diff --git a/docs/Release Notes.md b/docs/Release Notes.md index b4e6576..abe8cdc 100644 --- a/docs/Release Notes.md +++ b/docs/Release Notes.md @@ -40,7 +40,8 @@ Along with the previous release deliverables, this release supports these featur - Volume module is enhanced to support manual appliance selection. - Info module is enhanced to list storage containers and replication group. -- Replication session module is enhanced to support replication group. +- Added support for replication group in replication session module to perform async vVOL replication. +- Added support for PowerStore Medusa 3.5.x. - Storage container module supports the following functionalities: - Create storage container. - Create storage container destination. diff --git a/docs/samples/create_multiple_volumes.yml b/docs/samples/create_multiple_volumes.yml deleted file mode 100644 index f385ae0..0000000 --- a/docs/samples/create_multiple_volumes.yml +++ /dev/null @@ -1,29 +0,0 @@ -# This playbook illustrates the creation of multiple volumes sequentially ---- -- name: Creation of Multiple Volume - hosts: localhost - connection: local - vars: - array_ip: 'ip_address_of_the_array' - user: 'your_username' - password: 'your_password' - verifycert: False - vol_name: 'Volume_Module' - cap_unit: 'GB' - collections: - - dellemc.powerstore - tasks: - - name: Create multiple volumes - register: result_vol - volume: - array_ip: "{{array_ip}}" - user: "{{user}}" - password: "{{password}}" - verifycert: "{{verifycert}}" - vol_name: "{{vol_name +'_' }}{{item}}" - size: 1 - cap_unit: "{{cap_unit}}" - state: 'present' -# The loop will be executed for the number of elements in the list(created by the range). - loop: "{{ range(1, 100+ 1,1) | list }}" - diff --git a/docs/samples/create_multiple_volumes_async.yml b/docs/samples/create_multiple_volumes_async.yml deleted file mode 100644 index 5df1129..0000000 --- a/docs/samples/create_multiple_volumes_async.yml +++ /dev/null @@ -1,32 +0,0 @@ -# This playbook illustrates the creation of multiple volumes in async mode. ---- -- name: Creation of Multiple Volumes in Async Mode - hosts: localhost - connection: local - vars: - array_ip: 'ip_address_of_the_array' - user: 'your_username' - password: 'your_password' - verifycert: False - vol_name: 'Volume_Module' - cap_unit: 'GB' - collections: - - dellemc.powerstore - tasks: - - name: Create Multiple Volumes in Async Mode - register: result_vol - volume: - array_ip: "{{array_ip}}" - user: "{{user}}" - password: "{{password}}" - verifycert: "{{verifycert}}" - vol_name: "{{vol_name +'_' }}{{item}}" - size: 1 - cap_unit: "{{cap_unit}}" - state: 'present' - # The loop will be executed for the number of elements in the list(created by the range). - loop: "{{ range(1, 100+ 1,1) | list }}" - # The creation of multiple volumes in async mode depends on the values of the poll and async. - # Variation in the value of poll and async will affect the volume creation time. - async: 45 - poll: 0 diff --git a/docs/samples/delete_multiple_volumes.yml b/docs/samples/delete_multiple_volumes.yml deleted file mode 100644 index aac8d93..0000000 --- a/docs/samples/delete_multiple_volumes.yml +++ /dev/null @@ -1,26 +0,0 @@ -# This playbook deletes multiple volumes sequentially. ---- -- name: Deletion of Multiple Volumes - hosts: localhost - connection: local - vars: - array_ip: 'ip_address_of_the_array' - user: 'your_username' - password: 'your_password' - verifycert: False - vol_name: 'Volume_Module' - cap_unit: 'GB' - collections: - - dellemc.powerstore - tasks: - - name: Deleting multiple volumes - volume: - array_ip: "{{array_ip}}" - user: "{{user}}" - password: "{{password}}" - verifycert: "{{verifycert}}" - vol_name: "{{vol_name +'_' }}{{item}}" - # To delete the volume from the array. The value of the state is set as absent - state: "absent" - # The loop will be executed for the number of elements in the list(created by the range). - loop: "{{ range(1, 100+ 1,1) | list }}" diff --git a/docs/samples/find_empty_volume_groups.yml b/docs/samples/find_empty_volume_groups.yml deleted file mode 100644 index fb2a318..0000000 --- a/docs/samples/find_empty_volume_groups.yml +++ /dev/null @@ -1,48 +0,0 @@ -# This playbook finds the empty Volume groups for a given array. ---- -- name: Finding all the empty Volume Groups - hosts: localhost - connection: local - vars: - array_ip: 'ip_address_of_the_array' - user: 'your_username' - password: 'your_password' - verifycert: False - collections: - - dellemc.powerstore - tasks: - - name: Get the list of all the Volume Groups - info: - array_ip: "{{array_ip}}" - user: "{{user}}" - password: "{{password}}" - verifycert: "{{verifycert}}" - gather_subset: - - vg - register: subset_result - - # The set_fact fetches the names of the volume groups from the subset_result(output of the previous task) - - set_fact: - all_volumeGroups_names: "{{ subset_result['VolumeGroups'] | map(attribute='name') | list }}" - - - name: Get the details of all Volume Groups - volumegroup: - array_ip: "{{array_ip}}" - user: "{{user}}" - password: "{{password}}" - verifycert: "{{verifycert}}" - vg_name: "{{item}}" - state: "present" - register: all_volumeGroups_details - loop: "{{ all_volumeGroups_names }}" - - # The set_fact fetches the number of volumes present in the volume group. - - set_fact: - all_volumes_in_volumeGroups: "{{ all_volumeGroups_details['results']| map(attribute='volume_group_details.volumes') | list }}" - - # This task returns the names of the storage groups which have the zero number of volumes. - - name: List of all the Volume Groups which are empty - debug: - msg: "{{item.1}}" - loop: "{{ all_volumes_in_volumeGroups|zip(all_volumeGroups_names)|list }}" - when: item.0|length == 0 diff --git a/playbooks/modules/email.yml b/playbooks/modules/email.yml index 2ce4532..0fcdbf7 100644 --- a/playbooks/modules/email.yml +++ b/playbooks/modules/email.yml @@ -86,7 +86,7 @@ password: "{{ password }}" validate_certs: "{{ validate_certs }}" email_id: "xxx-xxxx-xxxx-xxx-xxxxxxx" - send_test_dellemc.powerstore.email: true + send_test_email: true state: "present" - name: Delete destination email diff --git a/docs/samples/capacity_volumes.yml b/playbooks/samples/capacity_volumes.yml similarity index 67% rename from docs/samples/capacity_volumes.yml rename to playbooks/samples/capacity_volumes.yml index a3a0dc1..31604e9 100644 --- a/docs/samples/capacity_volumes.yml +++ b/playbooks/samples/capacity_volumes.yml @@ -7,43 +7,44 @@ array_ip: 'ip_address_of_the_array' user: 'your_username' password: 'your_password' - verifycert: False + validate_certs: false threshold_size: enter_cap(in Bytes) - collections: - - dellemc.powerstore + tasks: - name: Get the details of the array - info: - array_ip: "{{array_ip}}" - user: "{{user}}" - password: "{{password}}" - verifycert: "{{verifycert}}" + dellemc.powerstore.info: + array_ip: "{{ array_ip }}" + user: "{{ user }}" + password: "{{ password }}" + validate_certs: "{{ validate_certs }}" gather_subset: - vol register: subset_result # The set_fact fetches the names of the volumes from the subset_result(output of the previous task). - - set_fact: + - name: Set fact + ansible.builtin.set_fact: all_volumes_names: "{{ subset_result['Volumes'] | map(attribute='name') | list }}" - + - name: Get the details of all the volumes in the array - volume: - array_ip: "{{array_ip}}" - user: "{{user}}" - password: "{{password}}" - verifycert: "{{verifycert}}" - vol_name: "{{item}}" + dellemc.powerstore.volume: + array_ip: "{{ array_ip }}" + user: "{{ user }}" + password: "{{ password }}" + validate_certs: "{{ validate_certs }}" + vol_name: "{{ item }}" state: "present" register: all_volumes_details loop: "{{ all_volumes_names }}" # The set_fact fetches the size attribute from the all_volumes_details(output of the previous task) - - set_fact: + - name: Set fact + ansible.builtin.set_fact: all_volumes_size: "{{ all_volumes_details['results'] | map(attribute='volume_details.size') | list }}" - -# The volumes are filtered based on the threshold size in the when statement. + +# The volumes are filtered based on the threshold size in the when statement. # The volumes which have the size more than the threshold size will be returned. Rest of the volumes will be skipped. - name: List of all the Volumes Which have capacity more than the threshold - debug: - msg: "{{item.1}}" - loop: "{{ all_volumes_size|zip(all_volumes_names)|list }}" + ansible.builtin.debug: + msg: "{{ item.1 }}" + loop: "{{ all_volumes_size | zip(all_volumes_names) | list }}" when: item.0|int >= threshold_size diff --git a/playbooks/samples/create_multiple_volumes.yml b/playbooks/samples/create_multiple_volumes.yml new file mode 100644 index 0000000..6d502a7 --- /dev/null +++ b/playbooks/samples/create_multiple_volumes.yml @@ -0,0 +1,27 @@ +# This playbook illustrates the creation of multiple volumes sequentially +--- +- name: Creation of Multiple Volume + hosts: localhost + connection: local + vars: + array_ip: 'ip_address_of_the_array' + user: 'your_username' + password: 'your_password' + validate_certs: false + vol_name: 'Volume_Module' + cap_unit: 'GB' + + tasks: + - name: Create multiple volumes + register: result_vol + dellemc.powerstore.volume: + array_ip: "{{ array_ip }}" + user: "{{ user }}" + password: "{{ password }}" + validate_certs: "{{ validate_certs }}" + vol_name: "{{ vol_name + '_' }}{{ item }}" + size: 1 + cap_unit: "{{ cap_unit }}" + state: 'present' + # The loop will be executed for the number of elements in the list(created by the range). + loop: "{{ range(1, 100 + 1, 1) | list }}" diff --git a/playbooks/samples/create_multiple_volumes_async.yml b/playbooks/samples/create_multiple_volumes_async.yml new file mode 100644 index 0000000..5d8f3a3 --- /dev/null +++ b/playbooks/samples/create_multiple_volumes_async.yml @@ -0,0 +1,31 @@ +# This playbook illustrates the creation of multiple volumes in async mode. +--- +- name: Creation of Multiple Volumes in Async Mode + hosts: localhost + connection: local + vars: + array_ip: 'ip_address_of_the_array' + user: 'your_username' + password: 'your_password' + validate_certs: false + vol_name: 'Volume_Module' + cap_unit: 'GB' + + tasks: + - name: Create Multiple Volumes in Async Mode + register: result_vol + dellemc.powerstore.volume: + array_ip: "{{ array_ip }}" + user: "{{ user }}" + password: "{{ password }}" + validate_certs: "{{ validate_certs }}" + vol_name: "{{ vol_name + '_' }}{{ item }}" + size: 1 + cap_unit: "{{ cap_unit }}" + state: 'present' + # The loop will be executed for the number of elements in the list(created by the range). + loop: "{{ range(1, 100 + 1, 1) | list }}" + # The creation of multiple volumes in async mode depends on the values of the poll and async. + # Variation in the value of poll and async will affect the volume creation time. + async: 45 + poll: 0 diff --git a/playbooks/samples/delete_multiple_volumes.yml b/playbooks/samples/delete_multiple_volumes.yml new file mode 100644 index 0000000..20a2718 --- /dev/null +++ b/playbooks/samples/delete_multiple_volumes.yml @@ -0,0 +1,25 @@ +# This playbook deletes multiple volumes sequentially. +--- +- name: Deletion of Multiple Volumes + hosts: localhost + connection: local + vars: + array_ip: 'ip_address_of_the_array' + user: 'your_username' + password: 'your_password' + validate_certs: false + vol_name: 'Volume_Module' + cap_unit: 'GB' + + tasks: + - name: Deleting multiple volumes + dellemc.powerstore.volume: + array_ip: "{{ array_ip }}" + user: "{{ user }}" + password: "{{ password }}" + validate_certs: "{{ validate_certs }}" + vol_name: "{{ vol_name + '_' }}{{ item }}" + # To delete the volume from the array. The value of the state is set as absent + state: "absent" + # The loop will be executed for the number of elements in the list(created by the range). + loop: "{{ range(1, 100 + 1, 1) | list }}" diff --git a/playbooks/samples/find_empty_volume_groups.yml b/playbooks/samples/find_empty_volume_groups.yml new file mode 100644 index 0000000..ef8b1ce --- /dev/null +++ b/playbooks/samples/find_empty_volume_groups.yml @@ -0,0 +1,49 @@ +# This playbook finds the empty Volume groups for a given array. +--- +- name: Finding all the empty Volume Groups + hosts: localhost + connection: local + vars: + array_ip: 'ip_address_of_the_array' + user: 'your_username' + password: 'your_password' + validate_certs: false + + tasks: + - name: Get the list of all the Volume Groups + dellemc.powerstore.info: + array_ip: "{{ array_ip }}" + user: "{{ user }}" + password: "{{ password }}" + validate_certs: "{{ validate_certs }}" + gather_subset: + - vg + register: subset_result + + # The set_fact fetches the names of the volume groups from the subset_result(output of the previous task) + - name: Set fact + ansible.builtin.set_fact: + all_volume_group_names: "{{ subset_result['VolumeGroups'] | map(attribute='name') | list }}" + + - name: Get the details of all Volume Groups + dellemc.powerstore.volumegroup: + array_ip: "{{ array_ip }}" + user: "{{ user }}" + password: "{{ password }}" + validate_certs: "{{ validate_certs }}" + vg_name: "{{ item }}" + state: "present" + register: all_volume_groups_details + loop: "{{ all_volume_group_names }}" + + # The set_fact fetches the number of volumes present in the volume group. + - name: Set fact + ansible.builtin.set_fact: + all_volumes_in_volume_groups: "{{ all_volume_groups_details['results'] | map(attribute='volume_group_details.volumes') | list }}" + + # This task returns the names of the storage groups which have the zero number of volumes. + - name: List of all the Volume Groups which are empty + ansible.builtin.debug: + msg: "{{ item.1 }}" + loop: "{{ all_volumes_in_volumeGroups | zip(all_volume_group_names) | list }}" + when: item.0|length == 0 diff --git a/docs/samples/get_fs_used_size_greaterthan_threshold.yml b/playbooks/samples/get_fs_used_size_greaterthan_threshold.yml similarity index 63% rename from docs/samples/get_fs_used_size_greaterthan_threshold.yml rename to playbooks/samples/get_fs_used_size_greaterthan_threshold.yml index aaf224d..66c5f0f 100644 --- a/docs/samples/get_fs_used_size_greaterthan_threshold.yml +++ b/playbooks/samples/get_fs_used_size_greaterthan_threshold.yml @@ -5,49 +5,49 @@ connection: local vars: array_ip: 'ip_address_of_the_array' - verifycert: False + validate_certs: false user: 'your_username' password: 'your_password' # threshold_percentage can be set to any valid int threshold_percentage: 90 - collections: - - dellemc.powerstore - tasks: + tasks: - name: Get filesystem - info: - array_ip: "{{array_ip}}" - verifycert: "{{verifycert}}" - user: "{{user}}" - password: "{{password}}" + dellemc.powerstore.info: + array_ip: "{{ array_ip }}" + validate_certs: "{{ validate_certs }}" + user: "{{ user }}" + password: "{{ password }}" gather_subset: - - file_system - all_pages: True + - file_system + all_pages: true register: all_filesystem - - set_fact: + - name: Set fact + ansible.builtin.set_fact: all_filesystem_ids: "{{ all_filesystem['FileSystems'] | map(attribute='id') | list }}" - name: Get filesystem detail by id - filesystem: - array_ip: "{{array_ip}}" - verifycert: "{{verifycert}}" - user: "{{user}}" - password: "{{password}}" - filesystem_id: "{{item}}" + dellemc.powerstore.filesystem: + array_ip: "{{ array_ip }}" + validate_certs: "{{ validate_certs }}" + user: "{{ user }}" + password: "{{ password }}" + filesystem_id: "{{ item }}" state: "present" register: all_fs_details loop: "{{ all_filesystem_ids }}" - - set_fact: + - name: Set fact + ansible.builtin.set_fact: all_fs_id: "{{ all_fs_details['results'] | map(attribute='filesystem_details.id') | list }}" all_size_total: "{{ all_fs_details['results'] | map(attribute='filesystem_details.size_total') | list }}" all_size_used: "{{ all_fs_details['results'] | map(attribute='filesystem_details.size_used') | list }}" - name: List filesystem ids whose capacity reached greater than given threshold - debug: - msg: "{{item.0}}" - loop: "{{ all_fs_id | zip(all_size_used,all_size_total) | list }}" + ansible.builtin.debug: + msg: "{{ item.0 }}" + loop: "{{ all_fs_id | zip(all_size_used, all_size_total) | list }}" when: - item.2|int != 0 - item.1|int *100 / item.2|int > threshold_percentage diff --git a/docs/samples/get_smbshares_associated_with_given_fs_name.yml b/playbooks/samples/get_smbshares_associated_with_given_fs_name.yml similarity index 57% rename from docs/samples/get_smbshares_associated_with_given_fs_name.yml rename to playbooks/samples/get_smbshares_associated_with_given_fs_name.yml index a12cc57..537ca69 100644 --- a/docs/samples/get_smbshares_associated_with_given_fs_name.yml +++ b/playbooks/samples/get_smbshares_associated_with_given_fs_name.yml @@ -5,47 +5,47 @@ connection: local vars: array_ip: 'ip_address_of_the_array' - verifycert: False + validate_certs: false user: 'your_username' password: 'your_password' filesystem_name: 'filesystem_name' - collections: - - dellemc.powerstore + tasks: - name: Get given filesystem - info: - array_ip: "{{array_ip}}" - verifycert: "{{verifycert}}" - user: "{{user}}" - password: "{{password}}" + dellemc.powerstore.info: + array_ip: "{{ array_ip }}" + validate_certs: "{{ validate_certs }}" + user: "{{ user }}" + password: "{{ password }}" gather_subset: - - file_system - all_pages: True + - file_system + all_pages: true filters: - filter_key: "name" filter_operator: "equal" - filter_value: "{{filesystem_name}}" + filter_value: "{{ filesystem_name }}" register: my_filesystem - name: Get all SMBShares - info: - array_ip: "{{array_ip}}" - verifycert: "{{verifycert}}" - user: "{{user}}" - password: "{{password}}" + dellemc.powerstore.info: + array_ip: "{{ array_ip }}" + validate_certs: "{{ validate_certs }}" + user: "{{ user }}" + password: "{{ password }}" gather_subset: - - smb_share - all_pages: True + - smb_share + all_pages: true filters: - filter_key: "file_system_id" filter_operator: "equal" - filter_value: "{{my_filesystem['FileSystems'][0]['id']}}" + filter_value: "{{ my_filesystem['FileSystems'][0]['id'] }}" register: all_smbshares # The set_fact fetches all smbshare ids - - set_fact: + - name: Set fact + ansible.builtin.set_fact: all_smbshare_ids: "{{ all_smbshares['SMBShares'] | map(attribute='id') | list }}" - name: Print SMB share IDs created on given filesystem - debug: + ansible.builtin.debug: var: all_smbshare_ids diff --git a/docs/samples/get_unused_fs.yml b/playbooks/samples/get_unused_fs.yml similarity index 60% rename from docs/samples/get_unused_fs.yml rename to playbooks/samples/get_unused_fs.yml index e9b00b7..d028a17 100644 --- a/docs/samples/get_unused_fs.yml +++ b/playbooks/samples/get_unused_fs.yml @@ -5,43 +5,44 @@ connection: local vars: array_ip: 'ip_address_of_the_array' - verifycert: False + validate_certs: false user: 'your_username' password: 'your_password' - collections: - - dellemc.powerstore + tasks: - name: Get filesystem - info: - array_ip: "{{array_ip}}" - verifycert: "{{verifycert}}" - user: "{{user}}" - password: "{{password}}" + dellemc.powerstore.info: + array_ip: "{{ array_ip }}" + validate_certs: "{{ validate_certs }}" + user: "{{ user }}" + password: "{{ password }}" gather_subset: - - file_system - all_pages: True + - file_system + all_pages: true register: all_filesystem - - set_fact: + - name: Set fact + ansible.builtin.set_fact: all_filesystem_ids: "{{ all_filesystem['FileSystems'] | map(attribute='id') | list }}" - name: Get filesystem detail by id - filesystem: - array_ip: "{{array_ip}}" - verifycert: "{{verifycert}}" - user: "{{user}}" - password: "{{password}}" - filesystem_id: "{{item}}" + dellemc.powerstore.filesystem: + array_ip: "{{ array_ip }}" + validate_certs: "{{ validate_certs }}" + user: "{{ user }}" + password: "{{ password }}" + filesystem_id: "{{ item }}" state: "present" register: all_fs_details loop: "{{ all_filesystem_ids }}" - - set_fact: + - name: Set fact + ansible.builtin.set_fact: all_fs_id: "{{ all_fs_details['results'] | map(attribute='filesystem_details.id') | list }}" all_size_used: "{{ all_fs_details['results'] | map(attribute='filesystem_details.size_used') | list }}" - name: Loop - debug: + ansible.builtin.debug: msg: "{{item.0}}" loop: "{{ all_fs_id | zip(all_size_used) | list }}" when: diff --git a/docs/samples/search_volumes.yml b/playbooks/samples/search_volumes.yml similarity index 70% rename from docs/samples/search_volumes.yml rename to playbooks/samples/search_volumes.yml index 551d01e..d2ee07c 100644 --- a/docs/samples/search_volumes.yml +++ b/playbooks/samples/search_volumes.yml @@ -7,26 +7,26 @@ array_ip: 'ip_address_of_the_array' user: 'your_username' password: 'your_password' - verifycert: False + validate_certs: false pattern: 'your_regex' - collections: - - dellemc.powerstore + tasks: - name: Get the details of all the Volumes - info: - array_ip: "{{array_ip}}" - user: "{{user}}" - password: "{{password}}" - verifycert: "{{verifycert}}" + dellemc.powerstore.info: + array_ip: "{{ array_ip }}" + user: "{{ user }}" + password: "{{ password }}" + validate_certs: "{{ validate_certs }}" gather_subset: - vol register: subset_result # The set_fact generates a list of the volume names using the details of volumes(the output of the previous task). - - set_fact: + - name: Set fact + ansible.builtin.set_fact: all_volumes_names: "{{ subset_result['Volumes'] | map(attribute='name') | list }}" # This task gets the list of the volumes which match a regular expression. The syntax of the regular expression is same as in python. - name: List of the all the volume names which match the pattern - debug: - msg: "{{ all_volumes_names | select('match',pattern ) | list }}" \ No newline at end of file + ansible.builtin.debug: + msg: "{{ all_volumes_names | select('match', pattern) | list }}" From 8fd91231110accff8de8ab631fdb47d4d81c842e Mon Sep 17 00:00:00 2001 From: Pavan-Mudunuri Date: Mon, 26 Jun 2023 19:29:25 +0530 Subject: [PATCH 3/4] Ansible modules for PowerStore release version 2.0.0 --- galaxy.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/galaxy.yml b/galaxy.yml index b6213bb..89d041f 100644 --- a/galaxy.yml +++ b/galaxy.yml @@ -36,8 +36,8 @@ description: Ansible modules for Powerstore # Either a single license or a list of licenses for content inside of a collection. Ansible Galaxy currently only # accepts L(SPDX,https://spdx.org/licenses/) licenses. This key is mutually exclusive with 'license_file' license: -- GPL-3.0-or-later -- Apache-2.0 + - GPL-3.0-or-later + - Apache-2.0 # A list of tags you want to associate with the collection for indexing/searching. A tag name has the same character # requirements as 'namespace' and 'name' From 28f50f1b25d64a1db098549bd6bab6fce8a1de9d Mon Sep 17 00:00:00 2001 From: Pavan-Mudunuri Date: Mon, 26 Jun 2023 19:36:23 +0530 Subject: [PATCH 4/4] Ansible modules for PowerStore release version 2.0.0 --- .github/CODEOWNERS | 3 +-- galaxy.yml | 22 +++++++++++----------- 2 files changed, 12 insertions(+), 13 deletions(-) diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS index 68c45e8..f2c482a 100644 --- a/.github/CODEOWNERS +++ b/.github/CODEOWNERS @@ -12,8 +12,7 @@ # Jennifer John (Jennifer-John) # Meenakshi Dembi (meenakshidembi691) # Pavan Mudunuri (Pavan-Mudunuri) -# Previnkumar G (Previnkumar-G) # Trisha Datta (trisha-dell) # for all files: -* @kuttattz @Bhavneet-Sharma @Jennifer-John @meenakshidembi691 @Pavan-Mudunuri @Previnkumar-G @trisha-dell +* @kuttattz @Bhavneet-Sharma @Jennifer-John @meenakshidembi691 @Pavan-Mudunuri @trisha-dell diff --git a/galaxy.yml b/galaxy.yml index 89d041f..dcc905d 100644 --- a/galaxy.yml +++ b/galaxy.yml @@ -17,17 +17,17 @@ readme: README.md # A list of the collection's content authors. Can be just the name or in the format 'Full Name (url) # @nicks:irc/im.site#channel' authors: -- Akash Shendge -- Ambuj Dubey -- Arindam Datta -- Manisha Agrawal -- P Srinivas Rao -- Prashant Rakheja -- Rajshree Khare -- Bhavneet Sharma -- Trisha Datta -- Ananthu S Kuttattu -- Pavan Mudunuri + - Akash Shendge + - Ambuj Dubey + - Arindam Datta + - Manisha Agrawal + - P Srinivas Rao + - Prashant Rakheja + - Rajshree Khare + - Bhavneet Sharma + - Trisha Datta + - Ananthu S Kuttattu + - Pavan Mudunuri ### OPTIONAL but strongly recommended # A short summary description of the collection