diff --git a/.ansible-lint b/.ansible-lint
new file mode 100644
index 0000000..4a9971a
--- /dev/null
+++ b/.ansible-lint
@@ -0,0 +1,4 @@
+exclude_paths:
+ - changelogs/
+ - .github/
+ - meta/
diff --git a/.github/workflows/ansible-test.yml b/.github/workflows/ansible-test.yml
index d9fb5cf..58d3ea0 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/unity
+
+ 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-unity/ansible-unity
diff --git a/CHANGELOG.rst b/CHANGELOG.rst
index 55eb73c..b4f6070 100644
--- a/CHANGELOG.rst
+++ b/CHANGELOG.rst
@@ -5,15 +5,30 @@ Dellemc.Unity Change Log
.. contents:: Topics
+v1.7.0
+======
+
+Minor Changes
+-------------
+
+- Added replication session module to get details, pause, resume, sync, failover, failback and delete replication sessions.
+- Added support for Unity XT SeaHawk 5.3
+- Documentation updates for boolean values based on ansible community guidelines.
+
+New Modules
+-----------
+
+- dellemc.unity.replication_session - Manage replication session on the Unity storage system
+
v1.6.0
======
Minor Changes
-------------
+- Add synchronous replication support for filesystem.
- Support addition of host from the Host List to NFS Export in nfs module.
- Support enable/disable advanced dedup in volume module.
-- Add synchronous replication support for filesystem.
v1.5.0
======
diff --git a/README.md b/README.md
index 58dbb95..840642f 100644
--- a/README.md
+++ b/README.md
@@ -2,63 +2,64 @@
The Ansible Modules for Dell Technologies (Dell) Unity allow Data Center and IT administrators to use RedHat Ansible to automate and orchestrate the configuration and management of Dell Unity arrays.
-The capabilities of the Ansible modules are managing consistency groups, filesystem, filesystem snapshots, CIFS server, NAS server, NFS server, NFS export, SMB share, interface, hosts, snapshots, snapshot schedules, storage pools, user quotas, quota trees and volumes. Capabilities also include gathering facts 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 consistency groups, filesystem, filesystem snapshots, CIFS server, NAS server, NFS server, NFS export, SMB share, interface, hosts, snapshots, snapshot schedules, storage pools, user quotas, quota trees, replication sessions and volumes. Capabilities also include gathering facts 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-unity/blob/1.6.0/docs/CODE_OF_CONDUCT.md)
-* [Maintainer guide](https://github.com/dell/ansible-unity/blob/1.6.0/docs/MAINTAINER_GUIDE.md)
-* [Committer guide](https://github.com/dell/ansible-unity/blob/1.6.0/docs/COMMITTER_GUIDE.md)
-* [Contributing guide](https://github.com/dell/ansible-unity/blob/1.6.0/docs/CONTRIBUTING.md)
-* [Branching strategy](https://github.com/dell/ansible-unity/blob/1.6.0/docs/BRANCHING.md)
-* [List of adopters](https://github.com/dell/ansible-unity/blob/1.6.0/docs/ADOPTERS.md)
-* [Maintainers](https://github.com/dell/ansible-unity/blob/1.6.0/docs/MAINTAINERS.md)
-* [Support](https://github.com/dell/ansible-unity/blob/1.6.0/docs/SUPPORT.md)
+* [Code of conduct](https://github.com/dell/ansible-unity/blob/1.7.0/docs/CODE_OF_CONDUCT.md)
+* [Maintainer guide](https://github.com/dell/ansible-unity/blob/1.7.0/docs/MAINTAINER_GUIDE.md)
+* [Committer guide](https://github.com/dell/ansible-unity/blob/1.7.0/docs/COMMITTER_GUIDE.md)
+* [Contributing guide](https://github.com/dell/ansible-unity/blob/1.7.0/docs/CONTRIBUTING.md)
+* [Branching strategy](https://github.com/dell/ansible-unity/blob/1.7.0/docs/BRANCHING.md)
+* [List of adopters](https://github.com/dell/ansible-unity/blob/1.7.0/docs/ADOPTERS.md)
+* [Maintainers](https://github.com/dell/ansible-unity/blob/1.7.0/docs/MAINTAINERS.md)
+* [Support](https://github.com/dell/ansible-unity/blob/1.7.0/docs/SUPPORT.md)
* [License](#license)
-* [Security](https://github.com/dell/ansible-unity/blob/1.6.0/docs/SECURITY.md)
+* [Security](https://github.com/dell/ansible-unity/blob/1.7.0/docs/SECURITY.md)
* [Prerequisites](#prerequisites)
* [List of Ansible modules for Dell Unity](#list-of-ansible-modules-for-dell-unity)
* [Installation and execution of Ansible modules for Dell Unity](#installation-and-execution-of-ansible-modules-for-dell-unity)
* [Releasing, Maintenance and Deprecation](#releasing-maintenance-and-deprecation)
## License
-The Ansible collection for Unity is released and licensed under the GPL-3.0 license. See [LICENSE](https://github.com/dell/ansible-unity/blob/1.6.0/LICENSE) for the full terms. Ansible modules and module utilities that are part of the Ansible collection for Unity are released and licensed under the Apache 2.0 license. See [MODULE-LICENSE](https://github.com/dell/ansible-unity/blob/1.6.0/MODULE-LICENSE) for the full terms.
+The Ansible collection for Unity is released and licensed under the GPL-3.0 license. See [LICENSE](https://github.com/dell/ansible-unity/blob/1.7.0/LICENSE) for the full terms. Ansible modules and module utilities that are part of the Ansible collection for Unity are released and licensed under the Apache 2.0 license. See [MODULE-LICENSE](https://github.com/dell/ansible-unity/blob/1.7.0/MODULE-LICENSE) for the full terms.
## Supported Platforms
- * Dell Unity Arrays version 5.1, 5.2
+ * Dell Unity Arrays version 5.1, 5.2, 5.3
## Prerequisites
This table provides information about the software prerequisites for the Ansible Modules for Dell Unity.
| **Ansible Modules** | **Python version** | **Storops - Python SDK version** | **Ansible** |
|---------------------|--------------------|----------------------------------|-------------|
-| v1.6.0 | 3.9
3.10
3.11 | 1.2.11 | 2.12
2.13
2.14|
+| v1.7.0 | 3.9
3.10
3.11 | 1.2.11 | 2.13
2.14
2.15|
## Idempotency
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 Unity
- * [Consistency group module](https://github.com/dell/ansible-unity/blob/1.6.0/docs/modules/consistencygroup.rst)
- * [Filesystem module](https://github.com/dell/ansible-unity/blob/1.6.0/docs/modules/filesystem.rst)
- * [Filesystem snapshot module](https://github.com/dell/ansible-unity/blob/1.6.0/docs/modules/filesystem_snapshot.rst)
- * [Info module](https://github.com/dell/ansible-unity/blob/1.6.0/docs/modules/info.rst)
- * [Host module](https://github.com/dell/ansible-unity/blob/1.6.0/docs/modules/host.rst)
- * [CIFS server module](https://github.com/dell/ansible-unity/blob/1.6.0/docs/modules/cifsserver.rst)
- * [NAS server module](https://github.com/dell/ansible-unity/blob/1.6.0/docs/modules/nasserver.rst)
- * [NFS server module](https://github.com/dell/ansible-unity/blob/1.6.0/docs/modules/nfsserver.rst)
- * [NFS export module](https://github.com/dell/ansible-unity/blob/1.6.0/docs/modules/nfs.rst)
- * [SMB share module](https://github.com/dell/ansible-unity/blob/1.6.0/docs/modules/smbshare.rst)
- * [Interface module](https://github.com/dell/ansible-unity/blob/1.6.0/docs/modules/interface.rst)
- * [Snapshot module](https://github.com/dell/ansible-unity/blob/1.6.0/docs/modules/snapshot.rst)
- * [Snapshot schedule module](https://github.com/dell/ansible-unity/blob/1.6.0/docs/modules/snapshotschedule.rst)
- * [Storage pool module](https://github.com/dell/ansible-unity/blob/1.6.0/docs/modules/storagepool.rst)
- * [User quota module](https://github.com/dell/ansible-unity/blob/1.6.0/docs/modules/user_quota.rste)
- * [Quota tree module ](https://github.com/dell/ansible-unity/blob/1.6.0/docs/modules/tree_quota.rst)
- * [Volume module](https://github.com/dell/ansible-unity/blob/1.6.0/docs/modules/volume.rst)
+ * [Consistency group module](https://github.com/dell/ansible-unity/blob/1.7.0/docs/modules/consistencygroup.rst)
+ * [Filesystem module](https://github.com/dell/ansible-unity/blob/1.7.0/docs/modules/filesystem.rst)
+ * [Filesystem snapshot module](https://github.com/dell/ansible-unity/blob/1.7.0/docs/modules/filesystem_snapshot.rst)
+ * [Info module](https://github.com/dell/ansible-unity/blob/1.7.0/docs/modules/info.rst)
+ * [Host module](https://github.com/dell/ansible-unity/blob/1.7.0/docs/modules/host.rst)
+ * [CIFS server module](https://github.com/dell/ansible-unity/blob/1.7.0/docs/modules/cifsserver.rst)
+ * [NAS server module](https://github.com/dell/ansible-unity/blob/1.7.0/docs/modules/nasserver.rst)
+ * [NFS server module](https://github.com/dell/ansible-unity/blob/1.7.0/docs/modules/nfsserver.rst)
+ * [NFS export module](https://github.com/dell/ansible-unity/blob/1.7.0/docs/modules/nfs.rst)
+ * [SMB share module](https://github.com/dell/ansible-unity/blob/1.7.0/docs/modules/smbshare.rst)
+ * [Interface module](https://github.com/dell/ansible-unity/blob/1.7.0/docs/modules/interface.rst)
+ * [Snapshot module](https://github.com/dell/ansible-unity/blob/1.7.0/docs/modules/snapshot.rst)
+ * [Snapshot schedule module](https://github.com/dell/ansible-unity/blob/1.7.0/docs/modules/snapshotschedule.rst)
+ * [Storage pool module](https://github.com/dell/ansible-unity/blob/1.7.0/docs/modules/storagepool.rst)
+ * [User quota module](https://github.com/dell/ansible-unity/blob/1.7.0/docs/modules/user_quota.rste)
+ * [Quota tree module ](https://github.com/dell/ansible-unity/blob/1.7.0/docs/modules/tree_quota.rst)
+ * [Volume module](https://github.com/dell/ansible-unity/blob/1.7.0/docs/modules/volume.rst)
+ * [Replication session module](https://github.com/dell/ansible-unity/blob/1.7.0/docs/modules/replication_session.rst)
## Installation and execution of Ansible modules for Dell Unity
-The installation and execution steps of Ansible modules for Dell Unity can be found [here](https://github.com/dell/ansible-unity/blob/1.6.0/docs/INSTALLATION.md).
+The installation and execution steps of Ansible modules for Dell Unity can be found [here](https://github.com/dell/ansible-unity/blob/1.7.0/docs/INSTALLATION.md).
## Releasing, Maintenance and Deprecation
@@ -66,6 +67,6 @@ Ansible Modules for Dell Technnologies Unity follows [Semantic Versioning](https
New version will be release regularly if significant changes (bug fix or new feature) are made in the collection.
-Released code versions are located on "release" branches with names of the form "release-x.y.z" where x.y.z corresponds to the version number. More information on branching strategy followed can be found [here](https://github.com/dell/ansible-unity/blob/1.6.0/docs/BRANCHING.md).
+Released code versions are located on "release" branches with names of the form "release-x.y.z" where x.y.z corresponds to the version number. More information on branching strategy followed can be found [here](https://github.com/dell/ansible-unity/blob/1.7.0/docs/BRANCHING.md).
Ansible Modules for Dell Technologies Unity deprecation cycle is aligned with that of [Ansible](https://docs.ansible.com/ansible/latest/dev_guide/module_lifecycle.html).
diff --git a/changelogs/.plugin-cache.yaml b/changelogs/.plugin-cache.yaml
index 40d737b..f6064e4 100644
--- a/changelogs/.plugin-cache.yaml
+++ b/changelogs/.plugin-cache.yaml
@@ -6,6 +6,7 @@ plugins:
callback: {}
cliconf: {}
connection: {}
+ filter: {}
httpapi: {}
inventory: {}
lookup: {}
@@ -60,6 +61,11 @@ plugins:
name: nfsserver
namespace: ''
version_added: 1.4.0
+ replication_session:
+ description: Manage replication session on Unity storage system
+ name: replication_session
+ namespace: ''
+ version_added: 1.7.0
smbshare:
description: Manage SMB shares on Unity storage system
name: smbshare
@@ -98,5 +104,6 @@ plugins:
netconf: {}
shell: {}
strategy: {}
+ test: {}
vars: {}
-version: 1.6.0
+version: 1.7.0
diff --git a/changelogs/changelog.yaml b/changelogs/changelog.yaml
index ee13691..65782a3 100644
--- a/changelogs/changelog.yaml
+++ b/changelogs/changelog.yaml
@@ -153,7 +153,19 @@ releases:
1.6.0:
changes:
minor_changes:
+ - Add synchronous replication support for filesystem.
- Support addition of host from the Host List to NFS Export in nfs module.
- Support enable/disable advanced dedup in volume module.
- - Add synchronous replication support for filesystem.
release_date: '2023-03-31'
+ 1.7.0:
+ changes:
+ minor_changes:
+ - Added replication session module to get details, pause, resume, sync, failover,
+ failback and delete replication sessions.
+ - Added support for Unity XT SeaHawk 5.3
+ - Documentation updates for boolean values based on ansible community guidelines.
+ modules:
+ - description: Manage replication session on the Unity storage system
+ name: replication_session
+ namespace: ''
+ release_date: '2023-06-30'
diff --git a/docs/CONTRIBUTING.md b/docs/CONTRIBUTING.md
index 1cf25a5..4e1eea0 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-unity/blob/1.6.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-unity/blob/1.7.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 Unity 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-unity/blob/1.6.0/docs/ISSUE_TRIAGE.md).
+Read more about the ways you can [Triage issues](https://github.com/dell/ansible-unity/blob/1.7.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 Unity](https://github.com/dell/ansible-unity/blob/1.6.0/docs/BRANCHING.md)
+* [Branching Strategy for Ansible modules for Dell Unity](https://github.com/dell/ansible-unity/blob/1.7.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-unity/blob/1.6.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-unity/blob/1.7.0/docs/SUPPORT.md).
#### Code sanitization
diff --git a/docs/INSTALLATION.md b/docs/INSTALLATION.md
index 01f2856..e0584e6 100644
--- a/docs/INSTALLATION.md
+++ b/docs/INSTALLATION.md
@@ -35,7 +35,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/unity) /[Automation Hub](https://console.redhat.com/ansible/automation-hub/repo/published/dellemc/unity) and use this command to install the collection anywhere in your system:
- ansible-galaxy collection install dellemc-unity-1.6.0.tar.gz -p
+ ansible-galaxy collection install dellemc-unity-1.7.0.tar.gz -p
* Set the environment variable:
@@ -62,7 +62,7 @@ You may obtain a copy of the License at
## Ansible modules execution
-The Ansible server must be configured with Python library for Unity to run the Ansible playbooks. The [Documents](https://github.com/dell/ansible-unity/blob/1.6.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 Unity to run the Ansible playbooks. The [Documents](https://github.com/dell/ansible-unity/blob/1.7.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 d3e4434..a15eb15 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.10]
- - Ansible modules for Dell Unity Version: [e.g. 1.6.0]
+ - Ansible modules for Dell Unity Version: [e.g. 1.7.0]
- Unity SDK version: [e.g. Unity 1.2.11]
- Any other additional information...
diff --git a/docs/MAINTAINER_GUIDE.md b/docs/MAINTAINER_GUIDE.md
index 78d13dd..a1da6e1 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-unity/blob/1.6.0/docs/CODE_OF_CONDUCT.md) and the guidelines in the [Contributing](https://github.com/dell/ansible-unity/blob/1.6.0/docs/CONTRIBUTING.md) and [Committer](https://github.com/dell/ansible-unity/blob/1.6.0/docs/COMMITTER_GUIDE.md) guides
+* Follow the [Code of Conduct](https://github.com/dell/ansible-unity/blob/1.7.0/docs/CODE_OF_CONDUCT.md) and the guidelines in the [Contributing](https://github.com/dell/ansible-unity/blob/1.7.0/docs/CONTRIBUTING.md) and [Committer](https://github.com/dell/ansible-unity/blob/1.7.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 47d3fa3..275d295 100644
--- a/docs/Release Notes.md
+++ b/docs/Release Notes.md
@@ -1,6 +1,6 @@
**Ansible Modules for Dell Technologies Unity**
=========================================
-### Release Notes 1.6.0
+### Release Notes 1.7.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 Unity 1.6.0 |
+| 01 | June 2023 | Current release of Ansible Modules for Dell Unity 1.7.0 |
Product Description
-------------------
@@ -71,8 +71,7 @@ for Unity GitHub](https://github.com/dell/ansible-unity/) page.
Documentation
-------------
-The documentation is available on [Ansible Modules for Unity GitHub](https://github.com/dell/ansible-unity/tree/1.6.0/docs)
+The documentation is available on [Ansible Modules for Unity GitHub](https://github.com/dell/ansible-unity/tree/1.7.0/docs)
page. It includes the following:
- README
- Release Notes (this document)
-- Product Guide
diff --git a/docs/SECURITY.md b/docs/SECURITY.md
index 16e1acf..95a3de5 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 Unity 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-unity/blob/1.6.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-unity/blob/1.7.0/docs/CONTRIBUTING.md#Pull-requests) for more information.
## Reporting a vulnerability
diff --git a/docs/modules/cifsserver.rst b/docs/modules/cifsserver.rst
index 71b7527..2c3c928 100644
--- a/docs/modules/cifsserver.rst
+++ b/docs/modules/cifsserver.rst
@@ -21,7 +21,7 @@ Requirements
The below requirements are needed on the host that executes this module.
- A Dell Unity Storage device version 5.1 or later.
-- Ansible-core 2.12 or later.
+- Ansible-core 2.13 or later.
- Python 3.9, 3.10 or 3.11.
- Storops Python SDK 1.2.11.
diff --git a/docs/modules/consistencygroup.rst b/docs/modules/consistencygroup.rst
index ac5727c..4f6060c 100644
--- a/docs/modules/consistencygroup.rst
+++ b/docs/modules/consistencygroup.rst
@@ -21,7 +21,7 @@ Requirements
The below requirements are needed on the host that executes this module.
- A Dell Unity Storage device version 5.1 or later.
-- Ansible-core 2.12 or later.
+- Ansible-core 2.13 or later.
- Python 3.9, 3.10 or 3.11.
- Storops Python SDK 1.2.11.
diff --git a/docs/modules/filesystem.rst b/docs/modules/filesystem.rst
index 81881df..05ff4eb 100644
--- a/docs/modules/filesystem.rst
+++ b/docs/modules/filesystem.rst
@@ -21,7 +21,7 @@ Requirements
The below requirements are needed on the host that executes this module.
- A Dell Unity Storage device version 5.1 or later.
-- Ansible-core 2.12 or later.
+- Ansible-core 2.13 or later.
- Python 3.9, 3.10 or 3.11.
- Storops Python SDK 1.2.11.
diff --git a/docs/modules/filesystem_snapshot.rst b/docs/modules/filesystem_snapshot.rst
index c75f816..02fa2a6 100644
--- a/docs/modules/filesystem_snapshot.rst
+++ b/docs/modules/filesystem_snapshot.rst
@@ -21,7 +21,7 @@ Requirements
The below requirements are needed on the host that executes this module.
- A Dell Unity Storage device version 5.1 or later.
-- Ansible-core 2.12 or later.
+- Ansible-core 2.13 or later.
- Python 3.9, 3.10 or 3.11.
- Storops Python SDK 1.2.11.
diff --git a/docs/modules/host.rst b/docs/modules/host.rst
index b0afe55..d2e48dd 100644
--- a/docs/modules/host.rst
+++ b/docs/modules/host.rst
@@ -21,7 +21,7 @@ Requirements
The below requirements are needed on the host that executes this module.
- A Dell Unity Storage device version 5.1 or later.
-- Ansible-core 2.12 or later.
+- Ansible-core 2.13 or later.
- Python 3.9, 3.10 or 3.11.
- Storops Python SDK 1.2.11.
diff --git a/docs/modules/info.rst b/docs/modules/info.rst
index 7b1ef11..6b2a9d8 100644
--- a/docs/modules/info.rst
+++ b/docs/modules/info.rst
@@ -21,7 +21,7 @@ Requirements
The below requirements are needed on the host that executes this module.
- A Dell Unity Storage device version 5.1 or later.
-- Ansible-core 2.12 or later.
+- Ansible-core 2.13 or later.
- Python 3.9, 3.10 or 3.11.
- Storops Python SDK 1.2.11.
diff --git a/docs/modules/interface.rst b/docs/modules/interface.rst
index aad1c02..cc33254 100644
--- a/docs/modules/interface.rst
+++ b/docs/modules/interface.rst
@@ -21,7 +21,7 @@ Requirements
The below requirements are needed on the host that executes this module.
- A Dell Unity Storage device version 5.1 or later.
-- Ansible-core 2.12 or later.
+- Ansible-core 2.13 or later.
- Python 3.9, 3.10 or 3.11.
- Storops Python SDK 1.2.11.
diff --git a/docs/modules/nasserver.rst b/docs/modules/nasserver.rst
index 284f373..97d298b 100644
--- a/docs/modules/nasserver.rst
+++ b/docs/modules/nasserver.rst
@@ -21,7 +21,7 @@ Requirements
The below requirements are needed on the host that executes this module.
- A Dell Unity Storage device version 5.1 or later.
-- Ansible-core 2.12 or later.
+- Ansible-core 2.13 or later.
- Python 3.9, 3.10 or 3.11.
- Storops Python SDK 1.2.11.
diff --git a/docs/modules/nfs.rst b/docs/modules/nfs.rst
index cce2058..c64c898 100644
--- a/docs/modules/nfs.rst
+++ b/docs/modules/nfs.rst
@@ -21,7 +21,7 @@ Requirements
The below requirements are needed on the host that executes this module.
- A Dell Unity Storage device version 5.1 or later.
-- Ansible-core 2.12 or later.
+- Ansible-core 2.13 or later.
- Python 3.9, 3.10 or 3.11.
- Storops Python SDK 1.2.11.
diff --git a/docs/modules/nfsserver.rst b/docs/modules/nfsserver.rst
index 0836bb6..15d786d 100644
--- a/docs/modules/nfsserver.rst
+++ b/docs/modules/nfsserver.rst
@@ -21,7 +21,7 @@ Requirements
The below requirements are needed on the host that executes this module.
- A Dell Unity Storage device version 5.1 or later.
-- Ansible-core 2.12 or later.
+- Ansible-core 2.13 or later.
- Python 3.9, 3.10 or 3.11.
- Storops Python SDK 1.2.11.
diff --git a/docs/modules/replication_session.rst b/docs/modules/replication_session.rst
new file mode 100644
index 0000000..b401c40
--- /dev/null
+++ b/docs/modules/replication_session.rst
@@ -0,0 +1,294 @@
+.. _replication_session_module:
+
+
+replication_session -- Manage replication session on Unity storage system
+=========================================================================
+
+.. contents::
+ :local:
+ :depth: 1
+
+
+Synopsis
+--------
+
+Managing replication session on Unity storage system includes getting details, pause, resume, sync, failover, failback and deleting the replication session.
+
+
+
+Requirements
+------------
+The below requirements are needed on the host that executes this module.
+
+- A Dell Unity Storage device version 5.1 or later.
+- Ansible-core 2.13 or later.
+- Python 3.9, 3.10 or 3.11.
+- Storops Python SDK 1.2.11.
+
+
+
+Parameters
+----------
+
+ session_id (optional, str, None)
+ ID of replication session.
+
+
+ session_name (optional, str, None)
+ Name of replication session.
+
+
+ pause (optional, bool, None)
+ Pause or resume replication session.
+
+
+ sync (optional, bool, None)
+ Sync a replication session.
+
+
+ failover_with_sync (optional, bool, None)
+ If ``true``, Sync the source and destination resources before failing over the asynchronous replication session or keep them in sync after failing over the synchronous replication session.
+
+ If ``false``, Failover a replication session.
+
+
+ failback (optional, bool, None)
+ Failback a replication session.
+
+
+ force_full_copy (optional, bool, None)
+ Indicates whether to sync back all data from the destination SP to the source SP during the failback session. Needed during resume operation when replication session goes out of sync due to a fault.
+
+
+ force (optional, bool, None)
+ Skip pre-checks on file system(s) replication sessions of a NAS server when a replication failover is issued from the source NAS server.
+
+
+ state (optional, str, present)
+ State variable to determine whether replication session will exist or not.
+
+
+ unispherehost (True, str, None)
+ IP or FQDN of the Unity management server.
+
+
+ username (True, str, None)
+ The username of the Unity management server.
+
+
+ password (True, str, None)
+ The password of the Unity management server.
+
+
+ validate_certs (optional, bool, True)
+ Boolean variable to specify whether or not to validate SSL certificate.
+
+ ``true`` - Indicates that the SSL certificate should be verified.
+
+ ``false`` - Indicates that the SSL certificate should not be verified.
+
+
+ port (optional, int, 443)
+ Port number through which communication happens with Unity management server.
+
+
+
+
+
+Notes
+-----
+
+.. note::
+ - The *check_mode* is supported.
+ - The modules present in this collection named as 'dellemc.unity' are built to support the Dell Unity storage platform.
+
+
+
+
+Examples
+--------
+
+.. code-block:: yaml+jinja
+
+
+ - name: Get replication session details
+ dellemc.unity.replication_session:
+ unispherehost: "{{unispherehost}}"
+ username: "{{username}}"
+ password: "{{password}}"
+ validate_certs: "{{validate_certs}}"
+ session_name: "fs_replication"
+
+ - name: Get replication session details based on session_id
+ dellemc.unity.replication_session:
+ unispherehost: "{{unispherehost}}"
+ username: "{{username}}"
+ password: "{{password}}"
+ validate_certs: "{{validate_certs}}"
+ session_id: "103079215114_APM00213404195_0000_103079215274_APM00213404194_0000"
+
+ - name: Pause a replication session
+ dellemc.unity.replication_session:
+ unispherehost: "{{unispherehost}}"
+ username: "{{username}}"
+ password: "{{password}}"
+ validate_certs: "{{validate_certs}}"
+ session_name: "fs_replication"
+ pause: true
+
+ - name: Resume a replication session
+ dellemc.unity.replication_session:
+ unispherehost: "{{unispherehost}}"
+ username: "{{username}}"
+ password: "{{password}}"
+ validate_certs: "{{validate_certs}}"
+ session_name: "fs_replication"
+ pause: false
+ force_full_copy: true
+
+ - name: Sync a replication session
+ dellemc.unity.replication_session:
+ unispherehost: "{{unispherehost}}"
+ username: "{{username}}"
+ password: "{{password}}"
+ validate_certs: "{{validate_certs}}"
+ session_name: "fs_replication"
+ sync: true
+
+ - name: Failover with sync a replication session
+ dellemc.unity.replication_session:
+ unispherehost: "{{unispherehost}}"
+ username: "{{username}}"
+ password: "{{password}}"
+ validate_certs: "{{validate_certs}}"
+ session_name: "fs_replication"
+ failover_with_sync: true
+ force: true
+
+ - name: Failover a replication session
+ dellemc.unity.replication_session:
+ unispherehost: "{{unispherehost}}"
+ username: "{{username}}"
+ password: "{{password}}"
+ validate_certs: "{{validate_certs}}"
+ session_name: "fs_replication"
+ failover_with_sync: false
+
+ - name: Failback a replication session
+ dellemc.unity.replication_session:
+ unispherehost: "{{unispherehost}}"
+ username: "{{username}}"
+ password: "{{password}}"
+ validate_certs: "{{validate_certs}}"
+ session_name: "fs_replication"
+ failback: true
+ force_full_copy: true
+
+ - name: Delete a replication session
+ dellemc.unity.replication_session:
+ unispherehost: "{{unispherehost}}"
+ username: "{{username}}"
+ password: "{{password}}"
+ validate_certs: "{{validate_certs}}"
+ session_name: "fs_replication"
+ state: "absent"
+
+
+
+Return Values
+-------------
+
+changed (always, bool, True)
+ Whether or not the resource has changed.
+
+
+replication_session_details (When replication session exists., dict, {'current_transfer_est_remain_time': 0, 'daily_snap_replication_policy': None, 'dst_resource_id': 'nas_8', 'dst_spa_interface': {'UnityRemoteInterface': {'hash': 8771253398547, 'id': 'APM00213404195:if_181'}}, 'dst_spb_interface': {'UnityRemoteInterface': {'hash': 8771253424144, 'id': 'APM00213404195:if_180'}}, 'dst_status': 'ReplicationSessionStatusEnum.OK', 'existed': True, 'hash': 8771259012271, 'health': {'UnityHealth': {'hash': 8771253424168}}, 'hourly_snap_replication_policy': None, 'id': '103079215114_APM00213404195_0000_103079215274_APM00213404194_0000', 'last_sync_time': '2023-04-18 10:35:25+00:00', 'local_role': 'ReplicationSessionReplicationRoleEnum.DESTINATION', 'max_time_out_of_sync': 0, 'members': None, 'name': 'rep_sess_nas', 'network_status': 'ReplicationSessionNetworkStatusEnum.OK', 'remote_system': {'UnityRemoteSystem': {'hash': 8771253380142}}, 'replication_resource_type': 'ReplicationEndpointResourceTypeEnum.NASSERVER', 'src_resource_id': 'nas_213', 'src_spa_interface': {'UnityRemoteInterface': {'hash': 8771253475010, 'id': 'APM00213404194:if_195'}}, 'src_spb_interface': {'UnityRemoteInterface': {'hash': 8771253374169, 'id': 'APM00213404194:if_194'}}, 'src_status': 'ReplicationSessionStatusEnum.OK', 'status': 'ReplicationOpStatusEnum.ACTIVE', 'sync_progress': 0, 'sync_state': 'ReplicationSessionSyncStateEnum.IN_SYNC'})
+ Details of the replication session.
+
+
+ id (, str, )
+ Unique identifier of the replicationSession instance.
+
+
+ name (, str, )
+ User-specified replication session name.
+
+
+ replicationResourceType (, str, )
+ Replication resource type of replication session endpoints.
+
+
+ status (, str, )
+ Replication status of the replication session.
+
+
+ remoteSystem (, dict, )
+ Specifies the remote system to use as the destination for the replication session.
+
+
+ UnityRemoteSystem (, dict, )
+ Information about remote storage system.
+
+
+ id (, str, )
+ Unique identifier of the remote system instance.
+
+
+ serialNumber (, str, )
+ Serial number of the remote system.
+
+
+
+
+ maxTimeOutOfSync (, int, )
+ Maximum time to wait before the system syncs the source and destination resources.
+
+
+ srcStatus (, str, )
+ Status of the source end of the session.
+
+
+ networkStatus (, str, )
+ Status of the network connection used by the replication session.
+
+
+ dstStatus (, str, )
+ Status of the destination end of the replication session.
+
+
+ lastSyncTime (, str, )
+ Date and time of the last replication synchronization.
+
+
+ syncState (, str, )
+ Synchronization state between source and destination resource of the replication session.
+
+
+ syncProgress (, int, )
+ Synchronization completion percentage between source and destination resources of the replication session.
+
+
+ dstResourceId (, str, )
+ Identifier of the destination resource.
+
+
+ currentTransferEstRemainTime (, int, )
+ Estimated time left for the replication synchronization to complete.
+
+
+
+
+
+
+Status
+------
+
+
+
+
+
+Authors
+~~~~~~~
+
+- Jennifer John (@Jennifer-John)
+
diff --git a/docs/modules/smbshare.rst b/docs/modules/smbshare.rst
index 697bda3..027fcee 100644
--- a/docs/modules/smbshare.rst
+++ b/docs/modules/smbshare.rst
@@ -21,7 +21,7 @@ Requirements
The below requirements are needed on the host that executes this module.
- A Dell Unity Storage device version 5.1 or later.
-- Ansible-core 2.12 or later.
+- Ansible-core 2.13 or later.
- Python 3.9, 3.10 or 3.11.
- Storops Python SDK 1.2.11.
diff --git a/docs/modules/snapshot.rst b/docs/modules/snapshot.rst
index 46b2aa9..5ef5821 100644
--- a/docs/modules/snapshot.rst
+++ b/docs/modules/snapshot.rst
@@ -21,7 +21,7 @@ Requirements
The below requirements are needed on the host that executes this module.
- A Dell Unity Storage device version 5.1 or later.
-- Ansible-core 2.12 or later.
+- Ansible-core 2.13 or later.
- Python 3.9, 3.10 or 3.11.
- Storops Python SDK 1.2.11.
diff --git a/docs/modules/snapshotschedule.rst b/docs/modules/snapshotschedule.rst
index 4e9a37d..2ee511e 100644
--- a/docs/modules/snapshotschedule.rst
+++ b/docs/modules/snapshotschedule.rst
@@ -21,7 +21,7 @@ Requirements
The below requirements are needed on the host that executes this module.
- A Dell Unity Storage device version 5.1 or later.
-- Ansible-core 2.12 or later.
+- Ansible-core 2.13 or later.
- Python 3.9, 3.10 or 3.11.
- Storops Python SDK 1.2.11.
diff --git a/docs/modules/storagepool.rst b/docs/modules/storagepool.rst
index 764f2a8..4887589 100644
--- a/docs/modules/storagepool.rst
+++ b/docs/modules/storagepool.rst
@@ -21,7 +21,7 @@ Requirements
The below requirements are needed on the host that executes this module.
- A Dell Unity Storage device version 5.1 or later.
-- Ansible-core 2.12 or later.
+- Ansible-core 2.13 or later.
- Python 3.9, 3.10 or 3.11.
- Storops Python SDK 1.2.11.
diff --git a/docs/modules/tree_quota.rst b/docs/modules/tree_quota.rst
index 285ab9d..68afe34 100644
--- a/docs/modules/tree_quota.rst
+++ b/docs/modules/tree_quota.rst
@@ -21,7 +21,7 @@ Requirements
The below requirements are needed on the host that executes this module.
- A Dell Unity Storage device version 5.1 or later.
-- Ansible-core 2.12 or later.
+- Ansible-core 2.13 or later.
- Python 3.9, 3.10 or 3.11.
- Storops Python SDK 1.2.11.
diff --git a/docs/modules/user_quota.rst b/docs/modules/user_quota.rst
index 7d0bbb8..1f7be59 100644
--- a/docs/modules/user_quota.rst
+++ b/docs/modules/user_quota.rst
@@ -21,7 +21,7 @@ Requirements
The below requirements are needed on the host that executes this module.
- A Dell Unity Storage device version 5.1 or later.
-- Ansible-core 2.12 or later.
+- Ansible-core 2.13 or later.
- Python 3.9, 3.10 or 3.11.
- Storops Python SDK 1.2.11.
diff --git a/docs/modules/volume.rst b/docs/modules/volume.rst
index ed4c5f2..bcb767f 100644
--- a/docs/modules/volume.rst
+++ b/docs/modules/volume.rst
@@ -21,7 +21,7 @@ Requirements
The below requirements are needed on the host that executes this module.
- A Dell Unity Storage device version 5.1 or later.
-- Ansible-core 2.12 or later.
+- Ansible-core 2.13 or later.
- Python 3.9, 3.10 or 3.11.
- Storops Python SDK 1.2.11.
diff --git a/galaxy.yml b/galaxy.yml
index d799cd1..ca2f977 100644
--- a/galaxy.yml
+++ b/galaxy.yml
@@ -10,7 +10,7 @@ namespace: dellemc
name: unity
# The version of the collection. Must be compatible with semantic versioning
-version: 1.6.0
+version: 1.7.0
# The path to the Markdown (.md) readme file. This path is relative to the
# root of the collection
@@ -54,13 +54,13 @@ tags: [storage]
dependencies: {}
# The URL of the originating SCM repository
-repository: https://github.com/dell/ansible-unity/tree/1.6.0
+repository: https://github.com/dell/ansible-unity/tree/1.7.0
# The URL to any online docs
-documentation: https://github.com/dell/ansible-unity/tree/1.6.0/docs
+documentation: https://github.com/dell/ansible-unity/tree/1.7.0/docs
# The URL to the homepage of the collection/project
-homepage: https://github.com/dell/ansible-unity/tree/1.6.0
+homepage: https://github.com/dell/ansible-unity/tree/1.7.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 31f9124..82e44c7 100644
--- a/meta/runtime.yml
+++ b/meta/runtime.yml
@@ -1,5 +1,5 @@
---
-requires_ansible: ">=2.12"
+requires_ansible: ">=2.13"
plugin_routing:
modules:
dellemc_unity_info:
diff --git a/playbooks/modules/cifsserver.yml b/playbooks/modules/cifsserver.yml
new file mode 100644
index 0000000..ee2f980
--- /dev/null
+++ b/playbooks/modules/cifsserver.yml
@@ -0,0 +1,151 @@
+---
+- name: CIFS Server Operations
+ hosts: localhost
+ connection: local
+ gather_facts: false
+ vars:
+ unispherehost: '10.*.*.*'
+ validate_certs: false
+ username: 'user'
+ password: '***'
+ domain_username: 'domain_user'
+ domain_password: '**'
+
+ tasks:
+ - name: Create standalone CIFS server with check mode
+ dellemc.unity.cifsserver:
+ unispherehost: "{{ unispherehost }}"
+ username: "{{ username }}"
+ password: "{{ password }}"
+ validate_certs: "{{ validate_certs }}"
+ netbios_name: "ansible_cifs"
+ workgroup: "ansible"
+ local_password: "**"
+ nas_server_name: "Ansible_server_1"
+ state: "present"
+ check_mode: true
+
+ - name: Create standalone CIFS server
+ register: result
+ dellemc.unity.cifsserver:
+ unispherehost: "{{ unispherehost }}"
+ username: "{{ username }}"
+ password: "{{ password }}"
+ validate_certs: "{{ validate_certs }}"
+ netbios_name: "ansible_cifs"
+ workgroup: "ansible"
+ local_password: "**"
+ nas_server_name: "Ansible_server_1"
+ state: "present"
+
+ - name: Create standalone CIFS server - Idempotency
+ register: result
+ dellemc.unity.cifsserver:
+ unispherehost: "{{ unispherehost }}"
+ username: "{{ username }}"
+ password: "{{ password }}"
+ validate_certs: "{{ validate_certs }}"
+ netbios_name: "ansible_cifs"
+ workgroup: "ansible"
+ local_password: "**"
+ nas_server_name: "Ansible_server_1"
+ state: "present"
+
+ - name: Get CIFS server details
+ dellemc.unity.cifsserver:
+ unispherehost: "{{ unispherehost }}"
+ username: "{{ username }}"
+ password: "{{ password }}"
+ validate_certs: "{{ validate_certs }}"
+ cifs_server_id: "{{ result.cifs_server_details.id }}"
+ state: "present"
+
+ - name: Get CIFS server details using NAS server name
+ dellemc.unity.cifsserver:
+ unispherehost: "{{ unispherehost }}"
+ username: "{{ username }}"
+ password: "{{ password }}"
+ validate_certs: "{{ validate_certs }}"
+ nas_server_name: "Ansible_server_1"
+ state: "present"
+
+ - name: Get CIFS server details using NAS server ID
+ dellemc.unity.cifsserver:
+ unispherehost: "{{ unispherehost }}"
+ username: "{{ username }}"
+ password: "{{ password }}"
+ validate_certs: "{{ validate_certs }}"
+ nas_server_id: "{{ result.cifs_server_details.nas_server.UnityNasServer.id }}"
+ state: "present"
+
+ - name: Delete CIFS server
+ dellemc.unity.cifsserver:
+ unispherehost: "{{ unispherehost }}"
+ username: "{{ username }}"
+ password: "{{ password }}"
+ validate_certs: "{{ validate_certs }}"
+ cifs_server_id: "{{ result.cifs_server_details.id }}"
+ state: "absent"
+
+ - name: Create CIFS server belonging to Active Directory
+ dellemc.unity.cifsserver:
+ unispherehost: "{{ unispherehost }}"
+ username: "{{ username }}"
+ password: "{{ password }}"
+ validate_certs: "{{ validate_certs }}"
+ nas_server_id: "nas_52"
+ cifs_server_name: "test_cifs_server"
+ domain: "test.lab.domain.com"
+ domain_username: "{{ domain_username }}"
+ domain_password: "{{ domain_password }}"
+ state: "present"
+
+ - name: Create CIFS server belonging to Active Directory - Idempotency
+ dellemc.unity.cifsserver:
+ unispherehost: "{{ unispherehost }}"
+ username: "{{ username }}"
+ password: "{{ password }}"
+ validate_certs: "{{ validate_certs }}"
+ nas_server_id: "nas_52"
+ cifs_server_name: "test_cifs_server"
+ domain: "test.lab.domain.com"
+ domain_username: "{{ domain_username }}"
+ domain_password: "{{ domain_password }}"
+ state: "present"
+
+ - name: Delete CIFS server with check mode
+ dellemc.unity.cifsserver:
+ unispherehost: "{{ unispherehost }}"
+ username: "{{ username }}"
+ password: "{{ password }}"
+ validate_certs: "{{ validate_certs }}"
+ cifs_server_name: "test_cifs_server"
+ unjoin_cifs_server_account: true
+ domain_username: "{{ domain_username }}"
+ domain_password: "{{ domain_password }}"
+ state: "absent"
+ check_mode: true
+
+ - name: Delete CIFS server
+ dellemc.unity.cifsserver:
+ unispherehost: "{{ unispherehost }}"
+ username: "{{ username }}"
+ password: "{{ password }}"
+ validate_certs: "{{ validate_certs }}"
+ cifs_server_name: "test_cifs_server"
+ unjoin_cifs_server_account: true
+ domain_username: "{{ domain_username }}"
+ domain_password: "{{ domain_password }}"
+ state: "absent"
+
+ - name: Delete CIFS server - Idempotency
+ dellemc.unity.cifsserver:
+ unispherehost: "{{ unispherehost }}"
+ username: "{{ username }}"
+ password: "{{ password }}"
+ validate_certs: "{{ validate_certs }}"
+ cifs_server_name: "test_cifs_server"
+ unjoin_cifs_server_account: true
+ domain_username: "{{ domain_username }}"
+ domain_password: "{{ domain_password }}"
+ state: "absent"
diff --git a/playbooks/modules/consistencygroup.yml b/playbooks/modules/consistencygroup.yml
new file mode 100644
index 0000000..f183304
--- /dev/null
+++ b/playbooks/modules/consistencygroup.yml
@@ -0,0 +1,259 @@
+---
+- name: Consistency Group Operations
+ hosts: localhost
+ connection: local
+ vars:
+ unispherehost: '10.*.*.*'
+ validate_certs: false
+ username: 'user'
+ password: '***'
+ cg_name: 'Ansible_CG_Testing'
+ new_cg_name: 'Ansible_CG_Rename_Testing'
+ description: "Ansible demo"
+ snap_schedule1: "Ansible_Test"
+ snap_schedule2: "CG_test_schedule"
+ tiering_policy1: "LOWEST"
+ state_present: "present"
+ state_absent: "absent"
+ vol_state_present: "present-in-group"
+ vol_state_absent: "absent-in-group"
+ mapping_state_present: "mapped"
+ mapping_state_absent: "unmapped"
+
+ tasks:
+ - name: Create consistency group with volume and host access
+ register: result_cg
+ dellemc.unity.consistencygroup:
+ unispherehost: "{{ unispherehost }}"
+ validate_certs: "{{ validate_certs }}"
+ username: "{{ username }}"
+ password: "{{ password }}"
+ cg_name: "{{ cg_name }}"
+ description: "{{ description }}"
+ snap_schedule: "{{ snap_schedule1 }}"
+ volumes:
+ - vol_name: "Test_cg_vol-1"
+ vol_state: "{{ vol_state_present }}"
+ hosts:
+ - host_name: "10.*.*.*"
+ - host_id: "Host_511"
+ mapping_state: "{{ mapping_state_present }}"
+ state: "{{ state_present }}"
+
+ - name: Set cg_id
+ ansible.builtin.set_fact:
+ cg_id: "{{ result_cg.consistency_group_details.id }}"
+
+ - name: Get details of consistency group using id
+ dellemc.unity.consistencygroup:
+ unispherehost: "{{ unispherehost }}"
+ username: "{{ username }}"
+ password: "{{ password }}"
+ validate_certs: "{{ validate_certs }} "
+ cg_id: "{{ cg_id }}"
+ state: "{{ state_present }}"
+
+ - name: Add volumes to consistency group
+ dellemc.unity.consistencygroup:
+ unispherehost: "{{ unispherehost }}"
+ username: "{{ username }}"
+ password: "{{ password }}"
+ validate_certs: "{{ validate_certs }}"
+ cg_id: "{{ cg_id }}"
+ volumes:
+ - vol_name: "Test_cg_vol-2"
+ - vol_id: "sv_8984"
+ vol_state: "{{ vol_state_present }}"
+ state: "{{ state_present }}"
+
+ - name: Add volumes to consistency group - Idempotency
+ dellemc.unity.consistencygroup:
+ unispherehost: "{{ unispherehost }}"
+ username: "{{ username }}"
+ password: "{{ password }}"
+ validate_certs: "{{ validate_certs }}"
+ cg_id: "{{ cg_id }}"
+ volumes:
+ - vol_name: "Test_cg_vol-2"
+ - vol_id: "sv_8984"
+ vol_state: "{{ vol_state_present }}"
+ state: "{{ state_present }}"
+
+ - name: Rename consistency group
+ dellemc.unity.consistencygroup:
+ unispherehost: "{{ unispherehost }}"
+ username: "{{ username }}"
+ password: "{{ password }}"
+ validate_certs: "{{ validate_certs }}"
+ cg_name: "{{ cg_name }}"
+ new_cg_name: "{{ new_cg_name }}"
+ state: "{{ state_present }}"
+
+ - name: Rename consistency group - Idempotency
+ dellemc.unity.consistencygroup:
+ unispherehost: "{{ unispherehost }}"
+ username: "{{ username }}"
+ password: "{{ password }}"
+ validate_certs: "{{ validate_certs }}"
+ cg_name: "{{ new_cg_name }}"
+ new_cg_name: "{{ new_cg_name }}"
+ state: "{{ state_present }}"
+
+ - name: Modify consistency group details
+ dellemc.unity.consistencygroup:
+ unispherehost: "{{ unispherehost }}"
+ username: "{{ username }}"
+ password: "{{ password }}"
+ validate_certs: "{{ validate_certs }}"
+ cg_name: "{{ new_cg_name }}"
+ snap_schedule: "{{ snap_schedule2 }}"
+ tiering_policy: "{{ tiering_policy1 }}"
+ state: "{{ state_present }}"
+
+ - name: Modify consistency group details - Idempotency
+ dellemc.unity.consistencygroup:
+ unispherehost: "{{ unispherehost }}"
+ username: "{{ username }}"
+ password: "{{ password }}"
+ validate_certs: "{{ validate_certs }}"
+ cg_name: "{{ new_cg_name }}"
+ snap_schedule: "{{ snap_schedule2 }}"
+ tiering_policy: "{{ tiering_policy1 }}"
+ state: "{{ state_present }}"
+
+ - name: Map host to consistency group
+ dellemc.unity.consistencygroup:
+ unispherehost: "{{ unispherehost }}"
+ username: "{{ username }}"
+ password: "{{ password }}"
+ validate_certs: "{{ validate_certs }}"
+ cg_name: "{{ new_cg_name }}"
+ hosts:
+ - host_name: "10.*.*.*"
+ mapping_state: "{{ mapping_state_present }}"
+ state: "{{ state_present }}"
+
+ - name: Map host to consistency group -- Idempotency
+ dellemc.unity.consistencygroup:
+ unispherehost: "{{ unispherehost }}"
+ username: "{{ username }}"
+ password: "{{ password }}"
+ validate_certs: "{{ validate_certs }}"
+ cg_name: "{{ new_cg_name }}"
+ hosts:
+ - host_name: "10.*.*.*"
+ mapping_state: "{{ mapping_state_present }}"
+ state: "{{ state_present }}"
+
+ - name: Unmap host to consistency group
+ dellemc.unity.consistencygroup:
+ unispherehost: "{{ unispherehost }}"
+ username: "{{ username }}"
+ password: "{{ password }}"
+ validate_certs: "{{ validate_certs }}"
+ cg_name: "{{ new_cg_name }}"
+ hosts:
+ - host_name: "10.*.*.*"
+ - host_id: "Host_511"
+ mapping_state: "{{ mapping_state_absent }}"
+ state: "{{ state_present }}"
+
+ - name: Unmap host to consistency group -- Idempotency
+ dellemc.unity.consistencygroup:
+ unispherehost: "{{ unispherehost }}"
+ username: "{{ username }}"
+ password: "{{ password }}"
+ validate_certs: "{{ validate_certs }}"
+ cg_name: "{{ new_cg_name }}"
+ hosts:
+ - host_name: "10.*.*.*"
+ - host_id: "Host_511"
+ mapping_state: "{{ mapping_state_absent }}"
+ state: "{{ state_present }}"
+
+ - name: Remove volumes from consistency group
+ dellemc.unity.consistencygroup:
+ unispherehost: "{{ unispherehost }}"
+ username: "{{ username }}"
+ password: "{{ password }}"
+ validate_certs: "{{ validate_certs }}"
+ cg_name: "{{ new_cg_name }}"
+ volumes:
+ - vol_name: "Test_cg_vol-1"
+ - vol_name: "Test_cg_vol-2"
+ - vol_id: "sv_8984"
+ vol_state: "{{ vol_state_absent }}"
+ state: "{{ state_present }}"
+
+ - name: Remove volumes from consistency group - Idempotency
+ dellemc.unity.consistencygroup:
+ unispherehost: "{{ unispherehost }}"
+ username: "{{ username }}"
+ password: "{{ password }}"
+ validate_certs: "{{ validate_certs }}"
+ cg_name: "{{ new_cg_name }}"
+ volumes:
+ - vol_name: "Test_cg_vol-1"
+ - vol_name: "Test_cg_vol-2"
+ - vol_id: "sv_8984"
+ vol_state: "{{ vol_state_absent }}"
+ state: "{{ state_present }}"
+
+ - name: Delete consistency group
+ dellemc.unity.consistencygroup:
+ unispherehost: "{{ unispherehost }}"
+ username: "{{ username }}"
+ password: "{{ password }}"
+ validate_certs: "{{ validate_certs }}"
+ cg_name: "{{ new_cg_name }}"
+ state: "{{ state_absent }}"
+
+ - name: Delete consistency group Idempotency
+ dellemc.unity.consistencygroup:
+ unispherehost: "{{ unispherehost }}"
+ username: "{{ username }}"
+ password: "{{ password }}"
+ validate_certs: "{{ validate_certs }}"
+ cg_name: "{{ new_cg_name }}"
+ state: "{{ state_absent }}"
+
+ - name: Enable replication for consistency group
+ dellemc.unity.consistencygroup:
+ unispherehost: "{{ unispherehost }}"
+ username: "{{ username }}"
+ password: "{{ password }}"
+ validate_certs: "{{ validate_certs }}"
+ cg_name: "dis_repl_ans_source"
+ replication_params:
+ destination_cg_name: "destination_dis_repl_ans_source"
+ replication_mode: "asynchronous"
+ rpo: 60
+ replication_type: "remote"
+ remote_system:
+ remote_system_host: '10.*.*.*'
+ remote_system_verifycert: false
+ remote_system_username: 'user'
+ remote_system_password: '**'
+ destination_pool_name: "Extreme_Perf_tier"
+ replication_state: "enable"
+ state: "present"
+
+ - name: Disable replication for consistency group
+ dellemc.unity.consistencygroup:
+ unispherehost: "{{ unispherehost }}"
+ username: "{{ username }}"
+ password: "{{ password }}"
+ validate_certs: "{{ validate_certs }}"
+ cg_name: "dis_repl_ans_source"
+ replication_state: "disable"
+ state: "present"
+
+ - name: Disable replication for consistency group Idempotency
+ dellemc.unity.consistencygroup:
+ unispherehost: "{{ unispherehost }}"
+ username: "{{ username }}"
+ password: "{{ password }}"
+ validate_certs: "{{ validate_certs }}"
+ cg_name: "dis_repl_ans_source"
+ replication_state: "disable"
+ state: "present"
diff --git a/playbooks/modules/filesystem.yml b/playbooks/modules/filesystem.yml
new file mode 100644
index 0000000..3675710
--- /dev/null
+++ b/playbooks/modules/filesystem.yml
@@ -0,0 +1,294 @@
+---
+- name: FileSystem Operations
+ hosts: localhost
+ connection: local
+ vars:
+ unispherehost: '10.*.*.*'
+ validate_certs: false
+ username: 'user'
+ password: '**'
+ filesystem_name: "FS_Ansible"
+ nas_server_name: "lgla**"
+ size: 10
+ pool_name: "Ansible_Unity_SP_2"
+ cap_gb: "GB"
+ description: "Ansible demo"
+ snap_schedule_name_1: "SS9_empty_DesRet_SS"
+ snap_schedule_name_2: "Ansible_vol_snap_schedule1"
+ pool_id: "pool_2"
+ tiering_policy: "LOWEST"
+ is_thin: true
+ data_reduction: true
+ state_present: "present"
+ state_absent: "absent"
+ state_mapped: "mapped"
+ state_unmapped: "unmapped"
+
+ tasks:
+ - name: Create FileSystem
+ dellemc.unity.filesystem:
+ unispherehost: "{{ unispherehost }}"
+ username: "{{ username }}"
+ password: "{{ password }}"
+ validate_certs: "{{ validate_certs }}"
+ filesystem_name: "{{ filesystem_name }}"
+ nas_server_name: "{{ nas_server_name }}"
+ pool_name: "{{ pool_name }}"
+ size: "{{ size }}"
+ description: "{{ description }}"
+ snap_schedule_name: "{{ snap_schedule_name_2 }}"
+ state: "{{ state_present }}"
+ register: fs_result
+
+ - name: Create FileSystem - idempotency
+ dellemc.unity.filesystem:
+ unispherehost: "{{ unispherehost }}"
+ username: "{{ username }}"
+ password: "{{ password }}"
+ validate_certs: "{{ validate_certs }}"
+ filesystem_name: "{{ filesystem_name }}"
+ nas_server_name: "{{ nas_server_name }}"
+ pool_name: "{{ pool_name }}"
+ size: "{{ size }}"
+ description: "{{ description }}"
+ snap_schedule_name: "{{ snap_schedule_name_2 }}"
+ state: "{{ state_present }}"
+
+ - name: Set filesystem_id
+ ansible.builtin.set_fact:
+ filesystem_id: "{{ fs_result.filesystem_details.id }}"
+
+ - name: Create FileSystem with quota configuration
+ dellemc.unity.filesystem:
+ unispherehost: "{{ unispherehost }}"
+ username: "{{ username }}"
+ password: "{{ password }}"
+ validate_certs: "{{ validate_certs }}"
+ filesystem_name: "SP_FS_test_quota_config_1"
+ nas_server_name: "{{ nas_server_name }}"
+ pool_id: "{{ pool_id }}"
+ size: "{{ size }}"
+ description: "{{ description }}"
+ quota_config:
+ default_hard_limit: 10
+ grace_period_unit: "minutes"
+ is_user_quota_enabled: true
+ grace_period: 100
+ state: "{{ state_present }}"
+
+ - name: Create FileSystem with quota configuration -- Idempotency
+ dellemc.unity.filesystem:
+ unispherehost: "{{ unispherehost }}"
+ username: "{{ username }}"
+ password: "{{ password }}"
+ validate_certs: "{{ validate_certs }}"
+ filesystem_name: "SP_FS_test_quota_config_1"
+ nas_server_name: "{{ nas_server_name }}"
+ pool_id: "{{ pool_id }}"
+ size: "{{ size }}"
+ description: "{{ description }}"
+ quota_config:
+ default_hard_limit: 10
+ grace_period_unit: "minutes"
+ is_user_quota_enabled: true
+ grace_period: 100
+ state: "{{ state_present }}"
+
+ - name: Expand FileSystem Size
+ dellemc.unity.filesystem:
+ unispherehost: "{{ unispherehost }}"
+ username: "{{ username }}"
+ password: "{{ password }}"
+ validate_certs: "{{ validate_certs }}"
+ filesystem_id: "{{ filesystem_id }}"
+ size: 15
+ state: "present"
+
+ - name: Expand FileSystem Size - Idempotency
+ dellemc.unity.filesystem:
+ unispherehost: "{{ unispherehost }}"
+ username: "{{ username }}"
+ password: "{{ password }}"
+ validate_certs: "{{ validate_certs }}"
+ filesystem_id: "{{ filesystem_id }}"
+ size: 15
+ state: "present"
+
+ - name: Modify FileSystem smb_properties
+ dellemc.unity.filesystem:
+ unispherehost: "{{ unispherehost }}"
+ username: "{{ username }}"
+ password: "{{ password }}"
+ validate_certs: "{{ validate_certs }}"
+ filesystem_id: "{{ filesystem_id }}"
+ smb_properties:
+ is_smb_op_locks_enabled: true
+ smb_notify_on_change_dir_depth: 5
+ is_smb_notify_on_access_enabled: true
+ state: "present"
+
+ - name: Modify FileSystem smb_properties - Idempotency
+ dellemc.unity.filesystem:
+ unispherehost: "{{ unispherehost }}"
+ username: "{{ username }}"
+ password: "{{ password }}"
+ validate_certs: "{{ validate_certs }}"
+ filesystem_id: "{{ filesystem_id }}"
+ smb_properties:
+ is_smb_op_locks_enabled: true
+ smb_notify_on_change_dir_depth: 5
+ is_smb_notify_on_access_enabled: true
+ state: "present"
+
+ - name: Modify FileSystem smb_properties - Idempotency
+ dellemc.unity.filesystem:
+ unispherehost: "{{ unispherehost }}"
+ username: "{{ username }}"
+ password: "{{ password }}"
+ validate_certs: "{{ validate_certs }}"
+ filesystem_id: "{{ filesystem_id }}"
+ smb_properties:
+ is_smb_op_locks_enabled: true
+ smb_notify_on_change_dir_depth: 5
+ is_smb_notify_on_access_enabled: true
+ state: "present"
+
+ - name: Modify FileSystem snap schedule
+ dellemc.unity.filesystem:
+ unispherehost: "{{ unispherehost }}"
+ username: "{{ username }}"
+ password: "{{ password }}"
+ validate_certs: "{{ validate_certs }}"
+ filesystem_id: "{{ filesystem_id }}"
+ snap_schedule_name: "{{ snap_schedule_name_1 }}"
+ state: "{{ state_present }}"
+
+ - name: Modify FileSystem snap schedule - Idempotency
+ dellemc.unity.filesystem:
+ unispherehost: "{{ unispherehost }}"
+ username: "{{ username }}"
+ password: "{{ password }}"
+ validate_certs: "{{ validate_certs }}"
+ filesystem_id: "{{ filesystem_id }}"
+ snap_schedule_name: "{{ snap_schedule_name_1 }}"
+ state: "{{ state_present }}"
+
+ - name: Remove snap-schedule from filesystem
+ dellemc.unity.filesystem:
+ unispherehost: "{{ unispherehost }}"
+ username: "{{ username }}"
+ password: "{{ password }}"
+ validate_certs: "{{ validate_certs }}"
+ filesystem_id: "{{ filesystem_id }}"
+ snap_schedule_name: ""
+ state: "{{ state_present }}"
+
+ - name: Get details of FileSystem using id
+ dellemc.unity.filesystem:
+ unispherehost: "{{ unispherehost }}"
+ username: "{{ username }}"
+ password: "{{ password }}"
+ validate_certs: "{{ validate_certs }}"
+ filesystem_id: "{{ filesystem_id }}"
+ state: "present"
+
+ - name: Delete a FileSystem using id
+ dellemc.unity.filesystem:
+ unispherehost: "{{ unispherehost }}"
+ username: "{{ username }}"
+ password: "{{ password }}"
+ validate_certs: "{{ validate_certs }}"
+ filesystem_id: "{{ filesystem_id }}"
+ state: "absent"
+
+ - name: Delete a FileSystem using id -Idempotency
+ dellemc.unity.filesystem:
+ unispherehost: "{{ unispherehost }}"
+ username: "{{ username }}"
+ password: "{{ password }}"
+ validate_certs: "{{ validate_certs }}"
+ filesystem_id: "{{ filesystem_id }}"
+ state: "absent"
+
+ - name: Enable replication for filesystem
+ dellemc.unity.filesystem:
+ unispherehost: "{{ unispherehost }}"
+ username: "{{ username }}"
+ password: "{{ password }}"
+ validate_certs: "{{ validate_certs }}"
+ filesystem_name: "test_fs_rrepl_repl"
+ nas_server_name: "test_nas1"
+ replication_params:
+ replication_name: "local_repl_new"
+ replication_mode: "asynchronous"
+ replication_type: "remote"
+ rpo: 20
+ remote_system:
+ remote_system_host: '10.*.*.*'
+ remote_system_verifycert: false
+ remote_system_username: 'user'
+ remote_system_password: '**'
+ destination_pool_name: "test_pool"
+ replication_state: "enable"
+ state: "present"
+
+ - name: Enable replication for filesystem - Idempotency
+ dellemc.unity.filesystem:
+ unispherehost: "{{ unispherehost }}"
+ username: "{{ username }}"
+ password: "{{ password }}"
+ validate_certs: "{{ validate_certs }}"
+ filesystem_name: "test_fs_rrepl_repl"
+ nas_server_name: "test_nas1"
+ replication_params:
+ replication_name: "local_repl_new"
+ replication_mode: "asynchronous"
+ replication_type: "remote"
+ rpo: 20
+ remote_system:
+ remote_system_host: '10.*.*.*'
+ remote_system_verifycert: false
+ remote_system_username: 'user'
+ remote_system_password: '**'
+ destination_pool_name: "test_pool"
+ replication_state: "enable"
+ state: "present"
+
+ - name: Modify replication for filesystem
+ dellemc.unity.filesystem:
+ unispherehost: "{{ unispherehost }}"
+ username: "{{ username }}"
+ password: "{{ password }}"
+ validate_certs: "{{ validate_certs }}"
+ filesystem_name: "test_fs_rrepl_repl"
+ nas_server_name: "test_nas1"
+ replication_params:
+ replication_name: "local_repl_new"
+ new_replication_name: "local_repl_234"
+ replication_mode: "asynchronous"
+ replication_state: "enable"
+ state: "present"
+
+ - name: Disable replication for filesystem
+ dellemc.unity.filesystem:
+ unispherehost: "{{ unispherehost }}"
+ username: "{{ username }}"
+ password: "{{ password }}"
+ validate_certs: "{{ validate_certs }}"
+ filesystem_name: "test_fs_rrepl_repl"
+ nas_server_name: "test_nas1"
+ replication_params:
+ replication_name: "local_repl_234"
+ replication_state: "disable"
+ state: "present"
+
+ - name: Disable replication for filesystem - Idempotency
+ dellemc.unity.filesystem:
+ unispherehost: "{{ unispherehost }}"
+ username: "{{ username }}"
+ password: "{{ password }}"
+ validate_certs: "{{ validate_certs }}"
+ filesystem_name: "test_fs_rrepl_repl"
+ nas_server_name: "test_nas1"
+ replication_state: "disable"
+ state: "present"
diff --git a/playbooks/modules/filesystem_snapshot.yml b/playbooks/modules/filesystem_snapshot.yml
new file mode 100644
index 0000000..16ce88d
--- /dev/null
+++ b/playbooks/modules/filesystem_snapshot.yml
@@ -0,0 +1,111 @@
+---
+- name: Filesystem Snapshot Module Operations in Unity
+ hosts: localhost
+ connection: local
+ vars:
+ unispherehost: '10.*.*.*'
+ validate_certs: false
+ username: 'user'
+ password: '**'
+ snapshot_name: "11_ansible_test_FS_snap"
+ snapshot_name_1: "11_ansible_test_FS_snap_1"
+ filesystem_name_1: "11_ansible_test_FS"
+ nas_server_name_1: "lgla**"
+ nas_server_name_2: "lgla**"
+ description: "Created using playbook"
+ new_description: "Description updated using playbook"
+ expiry_time: "04/15/2021 2:30"
+ new_expiry_time: "04/15/2021 5:30"
+ fs_access_type_1: "Checkpoint"
+ fs_access_type_2: "Protocol"
+
+ tasks:
+ - name: Create Filesystem Snapshot
+ dellemc.unity.filesystem_snapshot:
+ unispherehost: "{{ unispherehost }}"
+ username: "{{ username }}"
+ password: "{{ password }}"
+ validate_certs: "{{ validate_certs }}"
+ snapshot_name: "{{ snapshot_name_1 }}"
+ filesystem_name: "{{ filesystem_name_1 }}"
+ nas_server_name: "{{ nas_server_name_1 }}"
+ description: "{{ description }}"
+ auto_delete: true
+ fs_access_type: "{{ fs_access_type_1 }}"
+ state: "present"
+ register: result
+
+ - name: Set snapshot_id
+ ansible.builtin.set_fact:
+ snapshot_id: "{{ result.dellemc.unity.filesystem_snapshot_details.id }}"
+
+ - name: Create Filesystem Snapshot - Idempotency
+ dellemc.unity.filesystem_snapshot:
+ unispherehost: "{{ unispherehost }}"
+ username: "{{ username }}"
+ password: "{{ password }}"
+ validate_certs: "{{ validate_certs }}"
+ snapshot_name: "{{ snapshot_name_1 }}"
+ filesystem_name: "{{ filesystem_name_1 }}"
+ nas_server_name: "{{ nas_server_name_1 }}"
+ description: "{{ description }}"
+ auto_delete: true
+ fs_access_type: "{{ fs_access_type_1 }}"
+ state: "present"
+
+ - name: Get Filesystem Snapshot Details using Name
+ dellemc.unity.filesystem_snapshot:
+ unispherehost: "{{ unispherehost }}"
+ username: "{{ username }}"
+ password: "{{ password }}"
+ validate_certs: "{{ validate_certs }}"
+ snapshot_name: "{{ snapshot_name_1 }}"
+ state: "present"
+
+ - name: Get Filesystem Snapshot Details using ID
+ dellemc.unity.filesystem_snapshot:
+ unispherehost: "{{ unispherehost }}"
+ username: "{{ username }}"
+ password: "{{ password }}"
+ validate_certs: "{{ validate_certs }}"
+ snapshot_id: "{{ snapshot_id }}"
+ state: "present"
+
+ - name: Update Filesystem Snapshot attributes
+ dellemc.unity.filesystem_snapshot:
+ unispherehost: "{{ unispherehost }}"
+ username: "{{ username }}"
+ password: "{{ password }}"
+ validate_certs: "{{ validate_certs }}"
+ snapshot_name: "{{ snapshot_name_1 }}"
+ description: "{{ new_description }}"
+ auto_delete: false
+ expiry_time: "{{ new_expiry_time }}"
+ state: "present"
+
+ - name: Get Filesystem Snapshot Details
+ dellemc.unity.filesystem_snapshot:
+ unispherehost: "{{ unispherehost }}"
+ username: "{{ username }}"
+ password: "{{ password }}"
+ validate_certs: "{{ validate_certs }}"
+ snapshot_name: "{{ snapshot_name_1 }}"
+ state: "present"
+
+ - name: Delete Filesystem Snapshot using Name
+ dellemc.unity.filesystem_snapshot:
+ unispherehost: "{{ unispherehost }}"
+ username: "{{ username }}"
+ password: "{{ password }}"
+ validate_certs: "{{ validate_certs }}"
+ snapshot_name: "{{ snapshot_name_1 }}"
+ state: "absent"
+
+ - name: Delete Filesystem Snapshot using ID- Idempotency
+ dellemc.unity.filesystem_snapshot:
+ unispherehost: "{{ unispherehost }}"
+ username: "{{ username }}"
+ password: "{{ password }}"
+ validate_certs: "{{ validate_certs }}"
+ snapshot_id: "{{ snapshot_id }}"
+ state: "absent"
diff --git a/playbooks/modules/host.yml b/playbooks/modules/host.yml
new file mode 100644
index 0000000..04b28c8
--- /dev/null
+++ b/playbooks/modules/host.yml
@@ -0,0 +1,180 @@
+---
+- name: Host Module Operations on Unity
+ hosts: localhost
+ connection: local
+ vars:
+ unispherehost: '10.*.*.*'
+ validate_certs: false
+ username: 'user'
+ password: '**'
+ host_name_1: "ansible-test-host-1"
+ host_name_2: "ansible-test-host-2"
+ host_name_3: "ansible-test-host"
+ new_host_name_1: "ansible-test-host-3"
+ new_host_name_2: "ansible-test-host-4"
+
+ tasks:
+ - name: Create empty Host "{{ host_name_1 }}"
+ register: result
+ dellemc.unity.host:
+ unispherehost: "{{ unispherehost }}"
+ username: "{{ username }}"
+ password: "{{ password }}"
+ validate_certs: "{{ validate_certs }}"
+ host_name: "{{ host_name_1 }}"
+ host_os: "Linux"
+ description: "ansible-test-host-1"
+ state: "present"
+
+ - name: Set host_id
+ ansible.builtin.set_fact:
+ host_id_1: "{{ result.host_details.id }}"
+
+ - name: Create empty Host "{{ host_name_3 }}"
+ dellemc.unity.host:
+ unispherehost: "{{ unispherehost }}"
+ username: "{{ username }}"
+ password: "{{ password }}"
+ validate_certs: "{{ validate_certs }}"
+ host_name: "{{ host_name_3 }}"
+ host_os: "Linux"
+ description: "ansible-test-host"
+ state: "present"
+
+ - name: Create Host with Initiators "{{ host_name_2 }}"
+ register: result
+ dellemc.unity.host:
+ unispherehost: "{{ unispherehost }}"
+ username: "{{ username }}"
+ password: "{{ password }}"
+ validate_certs: "{{ validate_certs }}"
+ host_name: "{{ host_name_2 }}"
+ host_os: "Linux"
+ description: "ansible-test-host-2"
+ initiators:
+ - "20:00:00:90:FA:13:82:34:10:00:00:90:FA:13:82:34"
+ - "20:00:00:90:FA:13:81:8C:10:00:00:90:FA:13:81:8C"
+ initiator_state: "present-in-host"
+ state: "present"
+
+ - name: Set host_id
+ ansible.builtin.set_fact:
+ host_id_2: "{{ result.host_details.id }}"
+
+ - name: Get Host details using host_name.
+ dellemc.unity.host:
+ unispherehost: "{{ unispherehost }}"
+ username: "{{ username }}"
+ password: "{{ password }}"
+ validate_certs: "{{ validate_certs }}"
+ host_name: "{{ host_name_2 }}"
+ state: "present"
+
+ - name: Get Host details using host_id.
+ dellemc.unity.host:
+ unispherehost: "{{ unispherehost }}"
+ username: "{{ username }}"
+ password: "{{ password }}"
+ validate_certs: "{{ validate_certs }}"
+ host_id: "{{ host_id_2 }}"
+ state: "present"
+
+ - name: Modify Host using host_name
+ dellemc.unity.host:
+ unispherehost: "{{ unispherehost }}"
+ username: "{{ username }}"
+ password: "{{ password }}"
+ validate_certs: "{{ validate_certs }}"
+ host_name: "{{ host_name_1 }}"
+ host_os: "Mac OS"
+ description: "ansible-test-host-1"
+ state: "present"
+
+ - name: Modify Host using host_id
+ dellemc.unity.host:
+ unispherehost: "{{ unispherehost }}"
+ username: "{{ username }}"
+ password: "{{ password }}"
+ validate_certs: "{{ validate_certs }}"
+ host_id: "{{ host_id_2 }}"
+ new_host_name: "{{ new_host_name_1 }}"
+ host_os: "Mac OS"
+ description: "ansible-test-host-3"
+ state: "present"
+
+ - name: Add Initiators to Host.
+ dellemc.unity.host:
+ unispherehost: "{{ unispherehost }}"
+ username: "{{ username }}"
+ password: "{{ password }}"
+ validate_certs: "{{ validate_certs }}"
+ host_name: "{{ host_name_1 }}"
+ initiators:
+ - "20:00:00:90:FA:13:82:35:10:00:00:90:FA:13:82:35"
+ - "iqn.11-05.com.test:f14a6cef331b"
+ initiator_state: "present-in-host"
+ state: "present"
+
+ - name: Modify multiple attributes of Host.
+ dellemc.unity.host:
+ unispherehost: "{{ unispherehost }}"
+ username: "{{ username }}"
+ password: "{{ password }}"
+ validate_certs: "{{ validate_certs }}"
+ host_name: "{{ host_name_1 }}"
+ new_host_name: "{{ new_host_name_2 }}"
+ host_os: "Linux"
+ description: "ansible-test-host-4"
+ initiators:
+ - "iqn.11-05.com.test:24514718452e"
+ initiator_state: "present-in-host"
+ state: "present"
+
+ - name: Delete Host. {{ new_host_name_2 }}
+ dellemc.unity.host:
+ unispherehost: "{{ unispherehost }}"
+ username: "{{ username }}"
+ password: "{{ password }}"
+ validate_certs: "{{ validate_certs }}"
+ host_name: "{{ new_host_name_2 }}"
+ state: "absent"
+
+ - name: Delete Host. {{ host_name_3 }}
+ dellemc.unity.host:
+ unispherehost: "{{ unispherehost }}"
+ username: "{{ username }}"
+ password: "{{ password }}"
+ validate_certs: "{{ validate_certs }}"
+ host_name: "{{ host_name_3 }}"
+ state: "absent"
+
+ - name: Delete Host. {{ new_host_name_1 }}
+ dellemc.unity.host:
+ unispherehost: "{{ unispherehost }}"
+ username: "{{ username }}"
+ password: "{{ password }}"
+ validate_certs: "{{ validate_certs }}"
+ host_name: "{{ new_host_name_1 }}"
+ state: "absent"
+
+ - name: Add network address to Host.
+ dellemc.unity.host:
+ unispherehost: "{{ unispherehost }}"
+ username: "{{ username }}"
+ password: "{{ password }}"
+ validate_certs: "{{ validate_certs }}"
+ host_name: "{{ host_name }}"
+ network_address: "192.*.*.*"
+ network_address_state: "present-in-host"
+ state: "present"
+
+ - name: Delete network address from Host.
+ dellemc.unity.host:
+ unispherehost: "{{ unispherehost }}"
+ username: "{{ username }}"
+ password: "{{ password }}"
+ validate_certs: "{{ validate_certs }}"
+ host_name: "{{ host_name }}"
+ network_address: "192.*.*.*"
+ network_address_state: "absent-in-host"
+ state: "present"
diff --git a/playbooks/modules/info.yml b/playbooks/modules/info.yml
new file mode 100644
index 0000000..e2c9b31
--- /dev/null
+++ b/playbooks/modules/info.yml
@@ -0,0 +1,220 @@
+---
+- name: Info Module Operations on Unity
+ hosts: localhost
+ connection: local
+ vars:
+ unispherehost: '10.*.*.*'
+ validate_certs: false
+ username: 'user'
+ password: '**'
+
+ tasks:
+ - name: Get detailed list of Unity entities.
+ dellemc.unity.info:
+ unispherehost: "{{ unispherehost }}"
+ username: "{{ username }}"
+ password: "{{ password }}"
+ validate_certs: "{{ validate_certs }}"
+ gather_subset:
+ - host
+ - fc_initiator
+ - iscsi_initiator
+ - cg
+ - storage_pool
+ - vol
+ - snapshot_schedule
+ - nas_server
+ - file_system
+ - snapshot
+ - nfs_export
+ - smb_share
+ - user_quota
+ - tree_quota
+ - disk_group
+
+ - name: Get information of Unity array.
+ dellemc.unity.info:
+ unispherehost: "{{ unispherehost }}"
+ username: "{{ username }}"
+ password: "{{ password }}"
+ validate_certs: "{{ validate_certs }}"
+
+ - name: Get list of Unity hosts.
+ dellemc.unity.info:
+ unispherehost: "{{ unispherehost }}"
+ username: "{{ username }}"
+ password: "{{ password }}"
+ validate_certs: "{{ validate_certs }}"
+ gather_subset:
+ - host
+
+ - name: Get list of FC initiators on Unity array.
+ dellemc.unity.info:
+ unispherehost: "{{ unispherehost }}"
+ username: "{{ username }}"
+ password: "{{ password }}"
+ validate_certs: "{{ validate_certs }}"
+ gather_subset:
+ - fc_initiator
+
+ - name: Get list of ISCSI initiators on Unity array.
+ dellemc.unity.info:
+ unispherehost: "{{ unispherehost }}"
+ username: "{{ username }}"
+ password: "{{ password }}"
+ validate_certs: "{{ validate_certs }}"
+ gather_subset:
+ - iscsi_initiator
+
+ - name: Get list of consistency groups on Unity array.
+ dellemc.unity.info:
+ unispherehost: "{{ unispherehost }}"
+ username: "{{ username }}"
+ password: "{{ password }}"
+ validate_certs: "{{ validate_certs }}"
+ gather_subset:
+ - cg
+
+ - name: Get list of storage pools on Unity array.
+ dellemc.unity.info:
+ unispherehost: "{{ unispherehost }}"
+ username: "{{ username }}"
+ password: "{{ password }}"
+ validate_certs: "{{ validate_certs }}"
+ gather_subset:
+ - storage_pool
+
+ - name: Get list of volumes on Unity array.
+ dellemc.unity.info:
+ unispherehost: "{{ unispherehost }}"
+ username: "{{ username }}"
+ password: "{{ password }}"
+ validate_certs: "{{ validate_certs }}"
+ gather_subset:
+ - vol
+
+ - name: Get list of snapshot schedules on Unity array.
+ dellemc.unity.info:
+ unispherehost: "{{ unispherehost }}"
+ username: "{{ username }}"
+ password: "{{ password }}"
+ validate_certs: "{{ validate_certs }}"
+ gather_subset:
+ - snapshot_schedule
+
+ - name: Get list of NAS Servers on Unity array.
+ dellemc.unity.info:
+ unispherehost: "{{ unispherehost }}"
+ username: "{{ username }}"
+ password: "{{ password }}"
+ validate_certs: "{{ validate_certs }}"
+ gather_subset:
+ - nas_server
+
+ - name: Get list of File Systems on Unity array.
+ dellemc.unity.info:
+ unispherehost: "{{ unispherehost }}"
+ username: "{{ username }}"
+ password: "{{ password }}"
+ validate_certs: "{{ validate_certs }}"
+ gather_subset:
+ - file_system
+
+ - name: Get list of Snapshots on Unity array.
+ dellemc.unity.info:
+ unispherehost: "{{ unispherehost }}"
+ username: "{{ username }}"
+ password: "{{ password }}"
+ validate_certs: "{{ validate_certs }}"
+ gather_subset:
+ - snapshot
+
+ - name: Get list of NFS exports on Unity array.
+ dellemc.unity.info:
+ unispherehost: "{{ unispherehost }}"
+ username: "{{ username }}"
+ password: "{{ password }}"
+ validate_certs: "{{ validate_certs }}"
+ gather_subset:
+ - nfs_export
+
+ - name: Get list of SMB shares on Unity array.
+ dellemc.unity.info:
+ unispherehost: "{{ unispherehost }}"
+ username: "{{ username }}"
+ password: "{{ password }}"
+ validate_certs: "{{ validate_certs }}"
+ gather_subset:
+ - smb_share
+
+ - name: Get list of user quota on Unity array.
+ dellemc.unity.info:
+ unispherehost: "{{ unispherehost }}"
+ username: "{{ username }}"
+ password: "{{ password }}"
+ validate_certs: "{{ validate_certs }}"
+ gather_subset:
+ - user_quota
+
+ - name: Get list of quota tree on Unity array.
+ dellemc.unity.info:
+ unispherehost: "{{ unispherehost }}"
+ username: "{{ username }}"
+ password: "{{ password }}"
+ validate_certs: "{{ validate_certs }}"
+ gather_subset:
+ - tree_quota
+
+ - name: Get details of Disk Group.
+ dellemc.unity.info:
+ unispherehost: "{{ unispherehost }}"
+ username: "{{ username }}"
+ password: "{{ password }}"
+ validate_certs: "{{ validate_certs }}"
+ gather_subset:
+ - disk_group
+
+ - name: Get list of NFS Servers on Unity array.
+ dellemc.unity.info:
+ unispherehost: "{{ unispherehost }}"
+ username: "{{ username }}"
+ password: "{{ password }}"
+ validate_certs: "{{ validate_certs }}"
+ gather_subset:
+ - nfs_server
+
+ - name: Get list of CIFS Servers on Unity array.
+ dellemc.unity.info:
+ unispherehost: "{{ unispherehost }}"
+ username: "{{ username }}"
+ password: "{{ password }}"
+ validate_certs: "{{ validate_certs }}"
+ gather_subset:
+ - cifs_server
+
+ - name: Get list of ethernet ports on Unity array.
+ dellemc.unity.info:
+ unispherehost: "{{ unispherehost }}"
+ username: "{{ username }}"
+ password: "{{ password }}"
+ validate_certs: "{{ validate_certs }}"
+ gather_subset:
+ - ethernet_port
+
+ - name: Get list of file interfaces on Unity array.
+ dellemc.unity.info:
+ unispherehost: "{{ unispherehost }}"
+ username: "{{ username }}"
+ password: "{{ password }}"
+ validate_certs: "{{ validate_certs }}"
+ gather_subset:
+ - file_interface
+
+ - name: Get list of replication sessions on Unity array.
+ dellemc.unity.info:
+ unispherehost: "{{ unispherehost }}"
+ username: "{{ username }}"
+ password: "{{ password }}"
+ validate_certs: "{{ validate_certs }}"
+ gather_subset:
+ - replication_session
diff --git a/playbooks/modules/interface.yml b/playbooks/modules/interface.yml
new file mode 100644
index 0000000..3095a3e
--- /dev/null
+++ b/playbooks/modules/interface.yml
@@ -0,0 +1,91 @@
+---
+- name: Interface Operations
+ hosts: localhost
+ connection: local
+ gather_facts: false
+ vars:
+ unispherehost: '10.*.*.*'
+ validate_certs: false
+ username: 'user'
+ password: '**'
+
+ tasks:
+ - name: Add Interface as Backup to NAS Server
+ dellemc.unity.interface:
+ unispherehost: "{{ unispherehost }}"
+ username: "{{ username }}"
+ password: "{{ password }}"
+ validate_certs: "{{ validate_certs }}"
+ nas_server_name: "dummy_nas"
+ ethernet_port_name: "SP A 4-Port Card Ethernet Port 0"
+ role: "BACKUP"
+ interface_ip: "xx.xx.xx.xx"
+ netmask: "xx.xx.xx.xx"
+ gateway: "xx.xx.xx.xx"
+ vlan_id: 324
+ state: "present"
+
+ - name: Add Interface as Backup to NAS Server - Idempotency
+ dellemc.unity.interface:
+ unispherehost: "{{ unispherehost }}"
+ username: "{{ username }}"
+ password: "{{ password }}"
+ validate_certs: "{{ validate_certs }}"
+ nas_server_name: "dummy_nas"
+ ethernet_port_name: "SP A 4-Port Card Ethernet Port 0"
+ role: "BACKUP"
+ interface_ip: "xx.xx.xx.xx"
+ netmask: "xx.xx.xx.xx"
+ gateway: "xx.xx.xx.xx"
+ vlan_id: 324
+ state: "present"
+
+ - name: Get Interface details
+ dellemc.unity.interface:
+ unispherehost: "{{ unispherehost }}"
+ username: "{{ username }}"
+ password: "{{ password }}"
+ validate_certs: "{{ validate_certs }}"
+ nas_server_name: "dummy_nas"
+ interface_ip: "xx.xx.xx.xx"
+ state: "present"
+
+ - name: Add Interface as Production to NAS Server
+ dellemc.unity.interface:
+ unispherehost: "{{ unispherehost }}"
+ username: "{{ username }}"
+ password: "{{ password }}"
+ validate_certs: "{{ validate_certs }}"
+ nas_server_name: "dummy_nas"
+ ethernet_port_name: "SP A 4-Port Card Ethernet Port 0"
+ role: "PRODUCTION"
+ interface_ip: "xx.xx.xx.xx"
+ netmask: "xx.xx.xx.xx"
+ gateway: "xx.xx.xx.xx"
+ vlan_id: 324
+ state: "present"
+
+ - name: Add Interface as Production to NAS Server - Idempotency
+ dellemc.unity.interface:
+ unispherehost: "{{ unispherehost }}"
+ username: "{{ username }}"
+ password: "{{ password }}"
+ validate_certs: "{{ validate_certs }}"
+ nas_server_name: "dummy_nas"
+ ethernet_port_name: "SP A 4-Port Card Ethernet Port 0"
+ role: "PRODUCTION"
+ interface_ip: "xx.xx.xx.xx"
+ netmask: "xx.xx.xx.xx"
+ gateway: "xx.xx.xx.xx"
+ vlan_id: 324
+ state: "present"
+
+ - name: Delete Interface
+ dellemc.unity.interface:
+ unispherehost: "{{ unispherehost }}"
+ username: "{{ username }}"
+ password: "{{ password }}"
+ validate_certs: "{{ validate_certs }}"
+ nas_server_name: "dummy_nas"
+ interface_ip: "xx.xx.xx.xx"
+ state: "absent"
diff --git a/playbooks/modules/nasserver.yml b/playbooks/modules/nasserver.yml
new file mode 100644
index 0000000..72f9b7d
--- /dev/null
+++ b/playbooks/modules/nasserver.yml
@@ -0,0 +1,173 @@
+---
+- name: NAS Server Module Operations in Unity
+ hosts: localhost
+ connection: local
+ vars:
+ unispherehost: '10.*.*.*'
+ validate_certs: false
+ username: 'user'
+ password: '**'
+ nas_server_name: "lglad073"
+ nas_server_new_name: "new_lglad073"
+ tasks:
+ - name: Get NAS Server Details using Name
+ dellemc.unity.nasserver:
+ unispherehost: "{{ unispherehost }}"
+ username: "{{ username }}"
+ password: "{{ password }}"
+ validate_certs: "{{ validate_certs }}"
+ nas_server_name: "{{ nas_server_name }}"
+ state: "present"
+
+ - name: Rename NAS Server to new Name
+ dellemc.unity.nasserver:
+ unispherehost: "{{ unispherehost }}"
+ username: "{{ username }}"
+ password: "{{ password }}"
+ validate_certs: "{{ validate_certs }}"
+ nas_server_name: "{{ nas_server_name }}"
+ nas_server_new_name: "{{ nas_server_new_name }}"
+ state: "present"
+
+ - name: Rename NAS Server to Old Name
+ dellemc.unity.nasserver:
+ unispherehost: "{{ unispherehost }}"
+ username: "{{ username }}"
+ password: "{{ password }}"
+ validate_certs: "{{ validate_certs }}"
+ nas_server_name: "{{ nas_server_new_name }}"
+ nas_server_new_name: "{{ nas_server_name }}"
+ state: "present"
+
+ - name: Modify Details of NAS Server
+ dellemc.unity.nasserver:
+ unispherehost: "{{ unispherehost }}"
+ username: "{{ username }}"
+ password: "{{ password }}"
+ validate_certs: "{{ validate_certs }}"
+ nas_server_name: "{{ nas_server_name }}"
+ current_unix_directory_service: "NONE"
+ is_packet_reflect_enabled: true
+ state: "present"
+
+ - name: Enable replication for NAS Server on Local System
+ dellemc.unity.nasserver:
+ unispherehost: "{{ unispherehost }}"
+ username: "{{ username }}"
+ password: "{{ password }}"
+ validate_certs: "{{ validate_certs }}"
+ nas_server_id: "nas_10"
+ replication_reuse_resource: false
+ replication_params:
+ replication_name: "test_replication"
+ destination_nas_server_name: "destination_nas"
+ replication_mode: "asynchronous"
+ rpo: 60
+ replication_type: "local"
+ destination_pool_name: "Pool_Ansible_Neo_DND"
+ destination_sp: "SPA"
+ is_backup: true
+ replication_state: "enable"
+ state: "present"
+
+ - name: Enable replication for NAS Server on Remote System
+ dellemc.unity.nasserver:
+ unispherehost: "{{ unispherehost }}"
+ username: "{{ username }}"
+ password: "{{ password }}"
+ validate_certs: "{{ validate_certs }}"
+ nas_server_name: "dummy_nas"
+ replication_reuse_resource: false
+ replication_params:
+ replication_name: "test_replication"
+ destination_nas_server_name: "destination_nas"
+ replication_mode: "asynchronous"
+ rpo: 60
+ replication_type: "remote"
+ remote_system:
+ remote_system_host: '10.*.*.*'
+ remote_system_verifycert: false
+ remote_system_username: 'test1'
+ remote_system_password: 'test1!'
+ destination_pool_name: "fastVP_pool"
+ destination_sp: "SPA"
+ is_backup: true
+ replication_state: "enable"
+ state: "present"
+
+ - name: Enable replication for NAS Server on Remote System in existing NAS Server
+ dellemc.unity.nasserver:
+ unispherehost: "{{ unispherehost }}"
+ username: "{{ username }}"
+ password: "{{ password }}"
+ validate_certs: "{{ validate_certs }}"
+ nas_server_name: "dummy_nas"
+ replication_reuse_resource: true
+ replication_params:
+ destination_nas_server_name: "destination_nas"
+ replication_mode: "asynchronous"
+ rpo: 60
+ replication_type: "remote"
+ replication_name: "test_replication"
+ remote_system:
+ remote_system_host: '10.*.*.*'
+ remote_system_verifycert: false
+ remote_system_username: 'test1'
+ remote_system_password: 'test1!'
+ destination_pool_name: "fastVP_pool"
+ replication_state: "enable"
+ state: "present"
+
+ - name: Modify replication for NAS Server
+ dellemc.unity.nasserver:
+ unispherehost: "{{ unispherehost }}"
+ username: "{{ username }}"
+ password: "{{ password }}"
+ validate_certs: "{{ validate_certs }}"
+ nas_server_name: "dummy_nas"
+ replication_params:
+ replication_name: "test_repl_rename"
+ new_replication_name: "test_replication"
+ rpo: 20
+ replication_mode: "asynchronous"
+ replication_state: "enable"
+ state: "present"
+
+ - name: Modify replication for NAS Server - Idempotency
+ dellemc.unity.nasserver:
+ unispherehost: "{{ unispherehost }}"
+ username: "{{ username }}"
+ password: "{{ password }}"
+ validate_certs: "{{ validate_certs }}"
+ nas_server_name: "dummy_nas"
+ replication_params:
+ replication_name: "test_replication"
+ new_replication_name: "test_repl_rename"
+ rpo: 20
+ replication_mode: "asynchronous"
+ replication_state: "enable"
+ state: "present"
+
+ - name: Disable replication for NAS Server
+ dellemc.unity.nasserver:
+ unispherehost: "{{ unispherehost }}"
+ username: "{{ username }}"
+ password: "{{ password }}"
+ validate_certs: "{{ validate_certs }}"
+ nas_server_name: "dummy_nas"
+ replication_params:
+ replication_name: "test_replication"
+ replication_state: "disable"
+ state: "present"
+
+ - name: Disable replication for NAS Server - Idempotency
+ dellemc.unity.nasserver:
+ unispherehost: "{{ unispherehost }}"
+ username: "{{ username }}"
+ password: "{{ password }}"
+ validate_certs: "{{ validate_certs }}"
+ nas_server_name: "dummy_nas"
+ replication_params:
+ replication_name: "test_replication"
+ replication_state: "disable"
+ state: "present"
diff --git a/playbooks/modules/nfs.yml b/playbooks/modules/nfs.yml
new file mode 100644
index 0000000..f0bb48b
--- /dev/null
+++ b/playbooks/modules/nfs.yml
@@ -0,0 +1,551 @@
+---
+- name: NFS Share Module Operations on Unity
+ hosts: localhost
+ connection: local
+ vars:
+ unispherehost: '10.*.*.*'
+ validate_certs: false
+ username: 'user'
+ password: '**'
+ nfs_export_name_from_fs: 'ansible_nfs'
+ nfs_export_name_from_snap: 'ansible_snap_nfs'
+ filesystem_id: 'fs_377'
+ filesystem_name: 'ansible_fs'
+ nas_server_id: 'nas_3'
+ nas_server_name: 'lglad071'
+ snapshot_id: '171798692329'
+ snapshot_name: 'ansible_fs_snap'
+ description: 'Ansible Unity Module'
+ anonymous_gid: 4294967290
+ anonymous_uid: 4294967290
+ host_id1: 'Host_12'
+ host_id2: 'Host_14'
+ host_id3: 'Host_31'
+ host_id4: 'Host_63'
+ host_name1: 'testlgl3'
+ host_name2: 'testlgl2'
+ host_name3: 'testlgl1'
+ host_name4: 'test.lss.com'
+ ip_address1: '10.*.*.*/24'
+ ip_address2: 'fdfe:9042:c53d:0:250:56ff:fea2:5143'
+
+ tasks:
+ - name: Create nfs share from filesystem
+ dellemc.unity.nfs:
+ unispherehost: "{{ unispherehost }}"
+ username: "{{ username }}"
+ password: "{{ password }}"
+ validate_certs: "{{ validate_certs }}"
+ nfs_export_name: "{{ nfs_export_name_from_fs }}"
+ path: '/'
+ filesystem_id: "{{ filesystem_id }}"
+ description: "{{ description }}"
+ min_security: "SYS"
+ default_access: "READ_ONLY"
+ state: "present"
+ register: result
+
+ - name: Set nfs share ID created from filesystem
+ ansible.builtin.set_fact:
+ nfs_export_id_from_fs: "{{ result['nfs_share_details']['id'] }}"
+
+ - name: Create nfs share from filesystem - idempotency
+ dellemc.unity.nfs:
+ unispherehost: "{{ unispherehost }}"
+ username: "{{ username }}"
+ password: "{{ password }}"
+ validate_certs: "{{ validate_certs }}"
+ nfs_export_name: "{{ nfs_export_name_from_fs }}"
+ path: '/'
+ filesystem_name: "{{ filesystem_name }}"
+ nas_server_id: "{{ nas_server_id }}"
+ state: "present"
+ register: result
+
+ - name: Modify nfs share(fs)
+ dellemc.unity.nfs:
+ unispherehost: "{{ unispherehost }}"
+ username: "{{ username }}"
+ password: "{{ password }}"
+ validate_certs: "{{ validate_certs }}"
+ nfs_export_name: "{{ nfs_export_name_from_fs }}"
+ filesystem_name: "{{ filesystem_name }}"
+ nas_server_id: "{{ nas_server_id }}"
+ description: ""
+ default_access: "READ_ONLY_ROOT"
+ anonymous_gid: "{{ anonymous_gid }}"
+ anonymous_uid: "{{ anonymous_uid }}"
+ state: "present"
+ register: result
+
+ - name: Modify nfs share(fs) - idempotency
+ dellemc.unity.nfs:
+ unispherehost: "{{ unispherehost }}"
+ username: "{{ username }}"
+ password: "{{ password }}"
+ validate_certs: "{{ validate_certs }}"
+ nfs_export_name: "{{ nfs_export_name_from_fs }}"
+ filesystem_name: "{{ filesystem_name }}"
+ nas_server_id: "{{ nas_server_id }}"
+ description: ""
+ default_access: "READ_ONLY_ROOT"
+ anonymous_gid: "{{ anonymous_gid }}"
+ anonymous_uid: "{{ anonymous_uid }}"
+ state: "present"
+ register: result
+
+ - name: Create nfs share from snapshot
+ dellemc.unity.nfs:
+ unispherehost: "{{ unispherehost }}"
+ username: "{{ username }}"
+ password: "{{ password }}"
+ validate_certs: "{{ validate_certs }}"
+ nfs_export_name: "{{ nfs_export_name_from_snap }}"
+ path: '/'
+ snapshot_name: "{{ snapshot_name }}"
+ description: "{{ description }}"
+ min_security: "SYS"
+ default_access: "READ_ONLY"
+ state: "present"
+ register: result
+
+ - name: Set nfs share ID created from snapshot
+ ansible.builtin.set_fact:
+ nfs_export_id_from_snap: "{{ result['nfs_share_details']['id'] }}"
+
+ - name: Create nfs share from snapshot - idempotency
+ dellemc.unity.nfs:
+ unispherehost: "{{ unispherehost }}"
+ username: "{{ username }}"
+ password: "{{ password }}"
+ validate_certs: "{{ validate_certs }}"
+ nfs_export_name: "{{ nfs_export_name_from_snap }}"
+ path: '/'
+ snapshot_id: "{{ snapshot_id }}"
+ state: "present"
+ register: result
+
+ - name: Modify nfs share(snapshot)
+ dellemc.unity.nfs:
+ unispherehost: "{{ unispherehost }}"
+ username: "{{ username }}"
+ password: "{{ password }}"
+ validate_certs: "{{ validate_certs }}"
+ nfs_export_name: "{{ nfs_export_name_from_snap }}"
+ snapshot_id: "{{ snapshot_id }}"
+ description: ''
+ default_access: "READ_ONLY_ROOT"
+ anonymous_gid: "{{ anonymous_gid }}"
+ anonymous_uid: "{{ anonymous_uid }}"
+ state: "present"
+ register: result
+
+ - name: Modify nfs share(snapshot) - idempotency
+ dellemc.unity.nfs:
+ unispherehost: "{{ unispherehost }}"
+ username: "{{ username }}"
+ password: "{{ password }}"
+ validate_certs: "{{ validate_certs }}"
+ nfs_export_name: "{{ nfs_export_name_from_snap }}"
+ snapshot_id: "{{ snapshot_id }}"
+ description: ''
+ default_access: "READ_ONLY_ROOT"
+ anonymous_gid: "{{ anonymous_gid }}"
+ anonymous_uid: "{{ anonymous_uid }}"
+ state: "present"
+ register: result
+
+ - name: Add host in nfs share(fs)
+ dellemc.unity.nfs:
+ unispherehost: "{{ unispherehost }}"
+ username: "{{ username }}"
+ password: "{{ password }}"
+ validate_certs: "{{ validate_certs }}"
+ nfs_export_name: "{{ nfs_export_name_from_fs }}"
+ filesystem_id: "{{ filesystem_id }}"
+ adv_host_mgmt_enabled: true
+ no_access_hosts:
+ - host_id: "{{ host_id1 }}"
+ read_only_hosts:
+ - host_id: "{{ host_id2 }}"
+ read_only_root_hosts:
+ - host_name: "{{ host_name1 }}"
+ read_write_hosts:
+ - host_name: "{{ host_name1 }}"
+ read_write_root_hosts:
+ - ip_address: "{{ ip_address1 }}"
+ host_state: "present-in-export"
+ state: "present"
+ register: result
+
+ - name: Add host in nfs share(fs) - idempotency
+ dellemc.unity.nfs:
+ unispherehost: "{{ unispherehost }}"
+ username: "{{ username }}"
+ password: "{{ password }}"
+ validate_certs: "{{ validate_certs }}"
+ nfs_export_name: "{{ nfs_export_name_from_fs }}"
+ filesystem_id: "{{ filesystem_id }}"
+ adv_host_mgmt_enabled: true
+ no_access_hosts:
+ - host_id: "{{ host_id1 }}"
+ read_only_hosts:
+ - host_id: "{{ host_id2 }}"
+ read_only_root_hosts:
+ - host_name: "{{ host_name1 }}"
+ read_write_hosts:
+ - host_name: "{{ host_name1 }}"
+ read_write_root_hosts:
+ - ip_address: "{{ ip_address1 }}"
+ host_state: "present-in-export"
+ state: "present"
+ register: result
+
+ - name: Add more host in nfs share(fs)
+ dellemc.unity.nfs:
+ unispherehost: "{{ unispherehost }}"
+ username: "{{ username }}"
+ password: "{{ password }}"
+ validate_certs: "{{ validate_certs }}"
+ nfs_export_name: "{{ nfs_export_name_from_fs }}"
+ filesystem_id: "{{ filesystem_id }}"
+ adv_host_mgmt_enabled: true
+ no_access_hosts:
+ - host_id: "{{ host_id1 }}"
+ - host_name: "{{ host_name1 }}"
+ read_only_hosts:
+ - host_id: "{{ host_id2 }}"
+ - host_id: "{{ host_id3 }}"
+ read_only_root_hosts:
+ - host_name: "{{ host_name2 }}"
+ - host_name: "{{ host_name3 }}"
+ read_write_hosts:
+ - host_name: "{{ host_name4 }}"
+ - host_id: "{{ host_id4 }}"
+ read_write_root_hosts:
+ - ip_address: "{{ ip_address1 }}"
+ - ip_address: "{{ ip_address2 }}"
+ host_state: "present-in-export"
+ state: "present"
+ register: result
+
+ - name: Remove host in nfs share(fs)
+ dellemc.unity.nfs:
+ unispherehost: "{{ unispherehost }}"
+ username: "{{ username }}"
+ password: "{{ password }}"
+ validate_certs: "{{ validate_certs }}"
+ nfs_export_name: "{{ nfs_export_name_from_fs }}"
+ filesystem_id: "{{ filesystem_id }}"
+ adv_host_mgmt_enabled: true
+ no_access_hosts:
+ - host_id: "{{ host_id1 }}"
+ - host_name: "{{ host_name1 }}"
+ read_only_hosts:
+ - host_id: "{{ host_id2 }}"
+ - host_id: "{{ host_id3 }}"
+ read_only_root_hosts:
+ - host_name: "{{ host_name2 }}"
+ - host_name: "{{ host_name3 }}"
+ read_write_hosts:
+ - host_name: "{{ host_name4 }}"
+ - host_id: "{{ host_id4 }}"
+ read_write_root_hosts:
+ - ip_address: "{{ ip_address1 }}"
+ - ip_address: "{{ ip_address2 }}"
+ host_state: "absent-in-export"
+ state: "present"
+ register: result
+
+ - name: Remove host in nfs share(fs) - idempotency
+ dellemc.unity.nfs:
+ unispherehost: "{{ unispherehost }}"
+ username: "{{ username }}"
+ password: "{{ password }}"
+ validate_certs: "{{ validate_certs }}"
+ nfs_export_name: "{{ nfs_export_name_from_fs }}"
+ filesystem_id: "{{ filesystem_id }}"
+ adv_host_mgmt_enabled: true
+ no_access_hosts:
+ - host_id: "{{ host_id1 }}"
+ - host_name: "{{ host_name1 }}"
+ read_only_hosts:
+ - host_id: "{{ host_id2 }}"
+ - host_id: "{{ host_id3 }}"
+ read_only_root_hosts:
+ - host_name: "{{ host_name2 }}"
+ - host_name: "{{ host_name3 }}"
+ read_write_hosts:
+ - host_name: "{{ host_name4 }}"
+ - host_id: "{{ host_id4 }}"
+ read_write_root_hosts:
+ - ip_address: "{{ ip_address1 }}"
+ - ip_address: "{{ ip_address2 }}"
+ host_state: "absent-in-export"
+ state: "present"
+ register: result
+
+ - name: Add host in nfs share(snapshot)
+ dellemc.unity.nfs:
+ unispherehost: "{{ unispherehost }}"
+ username: "{{ username }}"
+ password: "{{ password }}"
+ validate_certs: "{{ validate_certs }}"
+ nfs_export_name: "{{ nfs_export_name_from_snap }}"
+ snapshot_name: "{{ snapshot_name }}"
+ adv_host_mgmt_enabled: true
+ no_access_hosts:
+ - host_id: "{{ host_id1 }}"
+ read_only_hosts:
+ - host_id: "{{ host_id2 }}"
+ read_only_root_hosts:
+ - host_name: "{{ host_name1 }}"
+ read_write_hosts:
+ - host_name: "{{ host_name2 }}"
+ read_write_root_hosts:
+ - ip_address: "{{ ip_address1 }}"
+ host_state: "present-in-export"
+ state: "present"
+ register: result
+
+ - name: Add host in nfs share(snapshot) - idempotency
+ dellemc.unity.nfs:
+ unispherehost: "{{ unispherehost }}"
+ username: "{{ username }}"
+ password: "{{ password }}"
+ validate_certs: "{{ validate_certs }}"
+ nfs_export_name: "{{ nfs_export_name_from_snap }}"
+ snapshot_name: "{{ snapshot_name }}"
+ adv_host_mgmt_enabled: true
+ no_access_hosts:
+ - host_id: "{{ host_id1 }}"
+ read_only_hosts:
+ - host_id: "{{ host_id2 }}"
+ read_only_root_hosts:
+ - host_name: "{{ host_name1 }}"
+ read_write_hosts:
+ - host_name: "{{ host_name2 }}"
+ read_write_root_hosts:
+ - ip_address: "{{ ip_address1 }}"
+ host_state: "present-in-export"
+ state: "present"
+ register: result
+
+ - name: Add more host in nfs share(snapshot)
+ dellemc.unity.nfs:
+ unispherehost: "{{ unispherehost }}"
+ username: "{{ username }}"
+ password: "{{ password }}"
+ validate_certs: "{{ validate_certs }}"
+ nfs_export_name: "{{ nfs_export_name_from_snap }}"
+ snapshot_name: "{{ snapshot_name }}"
+ adv_host_mgmt_enabled: true
+ no_access_hosts:
+ - host_id: "{{ host_id1 }}"
+ - host_name: "{{ host_name1 }}"
+ read_only_hosts:
+ - host_id: "{{ host_id2 }}"
+ - host_id: "{{ host_id3 }}"
+ read_only_root_hosts:
+ - host_name: "{{ host_name2 }}"
+ - host_name: "{{ host_name3 }}"
+ read_write_hosts:
+ - host_name: "{{ host_name4 }}"
+ - host_id: "{{ host_id4 }}"
+ read_write_root_hosts:
+ - ip_address: "{{ ip_address1 }}"
+ - ip_address: "{{ ip_address2 }}"
+ host_state: "present-in-export"
+ state: "present"
+ register: result
+
+ - name: Remove host in nfs share(snapshot)
+ dellemc.unity.nfs:
+ unispherehost: "{{ unispherehost }}"
+ username: "{{ username }}"
+ password: "{{ password }}"
+ validate_certs: "{{ validate_certs }}"
+ nfs_export_name: "{{ nfs_export_name_from_snap }}"
+ snapshot_name: "{{ snapshot_name }}"
+ adv_host_mgmt_enabled: true
+ no_access_hosts:
+ - host_id: "{{ host_id1 }}"
+ - host_name: "{{ host_name1 }}"
+ read_only_hosts:
+ - host_id: "{{ host_id2 }}"
+ - host_id: "{{ host_id3 }}"
+ read_only_root_hosts:
+ - host_name: "{{ host_name2 }}"
+ - host_name: "{{ host_name3 }}"
+ read_write_hosts:
+ - host_name: "{{ host_name4 }}"
+ - host_id: "{{ host_id4 }}"
+ read_write_root_hosts:
+ - ip_address: "{{ ip_address1 }}"
+ - ip_address: "{{ ip_address2 }}"
+ host_state: "absent-in-export"
+ state: "present"
+ register: result
+
+ - name: Remove host in nfs share(snapshot) - idempotency
+ dellemc.unity.nfs:
+ unispherehost: "{{ unispherehost }}"
+ username: "{{ username }}"
+ password: "{{ password }}"
+ validate_certs: "{{ validate_certs }}"
+ nfs_export_name: "{{ nfs_export_name_from_snap }}"
+ snapshot_name: "{{ snapshot_name }}"
+ adv_host_mgmt_enabled: true
+ no_access_hosts:
+ - host_id: "{{ host_id1 }}"
+ - host_name: "{{ host_name1 }}"
+ read_only_hosts:
+ - host_id: "{{ host_id2 }}"
+ - host_id: "{{ host_id3 }}"
+ read_only_root_hosts:
+ - host_name: "{{ host_name2 }}"
+ - host_name: "{{ host_name3 }}"
+ read_write_hosts:
+ - host_name: "{{ host_name4 }}"
+ - host_id: "{{ host_id4 }}"
+ read_write_root_hosts:
+ - ip_address: "{{ ip_address1 }}"
+ - ip_address: "{{ ip_address2 }}"
+ host_state: "absent-in-export"
+ state: "present"
+ register: result
+
+ - name: Get nfs details by nfs ID
+ dellemc.unity.nfs:
+ unispherehost: "{{ unispherehost }}"
+ username: "{{ username }}"
+ password: "{{ password }}"
+ validate_certs: "{{ validate_certs }}"
+ nfs_export_id: "{{ nfs_export_id_from_fs }}"
+ state: "present"
+ register: result
+
+ - name: Get nfs details by nfs name and filesystem ID
+ dellemc.unity.nfs:
+ unispherehost: "{{ unispherehost }}"
+ username: "{{ username }}"
+ password: "{{ password }}"
+ validate_certs: "{{ validate_certs }}"
+ nfs_export_name: "{{ nfs_export_name_from_fs }}"
+ filesystem_id: "{{ filesystem_id }}"
+ state: "present"
+ register: result
+
+ - name: Get nfs details by nfs name, filesystem name & nas server ID
+ dellemc.unity.nfs:
+ unispherehost: "{{ unispherehost }}"
+ username: "{{ username }}"
+ password: "{{ password }}"
+ validate_certs: "{{ validate_certs }}"
+ nfs_export_name: "{{ nfs_export_name_from_fs }}"
+ filesystem_name: "{{ filesystem_name }}"
+ nas_server_id: "{{ nas_server_id }}"
+ state: "present"
+ register: result
+
+ - name: Get nfs details by nfs name, filesystem name & nas server name
+ dellemc.unity.nfs:
+ unispherehost: "{{ unispherehost }}"
+ username: "{{ username }}"
+ password: "{{ password }}"
+ validate_certs: "{{ validate_certs }}"
+ nfs_export_name: "{{ nfs_export_name_from_fs }}"
+ filesystem_name: "{{ filesystem_name }}"
+ nas_server_name: "{{ nas_server_name }}"
+ state: "present"
+ register: result
+
+ - name: Get nfs details by snapshot name
+ dellemc.unity.nfs:
+ unispherehost: "{{ unispherehost }}"
+ username: "{{ username }}"
+ password: "{{ password }}"
+ validate_certs: "{{ validate_certs }}"
+ nfs_export_name: "{{ nfs_export_name_from_snap }}"
+ snapshot_name: "{{ snapshot_name }}"
+ state: "present"
+ register: result
+
+ - name: Get nfs details by snapshot ID
+ dellemc.unity.nfs:
+ unispherehost: "{{ unispherehost }}"
+ username: "{{ username }}"
+ password: "{{ password }}"
+ validate_certs: "{{ validate_certs }}"
+ nfs_export_name: "{{ nfs_export_name_from_snap }}"
+ snapshot_id: "{{ snapshot_id }}"
+ state: "present"
+ register: result
+
+ - name: Delete nfs share by nfs ID
+ dellemc.unity.nfs:
+ unispherehost: "{{ unispherehost }}"
+ username: "{{ username }}"
+ password: "{{ password }}"
+ validate_certs: "{{ validate_certs }}"
+ nfs_export_id: "{{ nfs_export_id_from_snap }}"
+ state: "absent"
+ register: result
+
+ - name: Delete nfs share by nfs name
+ dellemc.unity.nfs:
+ unispherehost: "{{ unispherehost }}"
+ username: "{{ username }}"
+ password: "{{ password }}"
+ validate_certs: "{{ validate_certs }}"
+ nfs_export_name: "{{ nfs_export_name_from_fs }}"
+ filesystem_name: "{{ filesystem_name }}"
+ nas_server_name: "{{ nas_server_name }}"
+ state: "absent"
+ register: result
+
+ - name: Add host in nfs share(fs) with adv_host_mgmt_enabled as false
+ dellemc.unity.nfs:
+ unispherehost: "{{ unispherehost }}"
+ username: "{{ username }}"
+ password: "{{ password }}"
+ validate_certs: "{{ validate_certs }}"
+ nfs_export_name: "csishare-csivol-346b60e518"
+ filesystem_id: "fs_14267"
+ adv_host_mgmt_enabled: false
+ no_access_hosts:
+ - domain: "google.com"
+ read_only_hosts:
+ - netgroup: "netgroup_admin"
+ read_only_root_hosts:
+ - host_name: "host5"
+ read_write_hosts:
+ - subnet: "10.*.*.*/255.255.255.0"
+ read_write_root_hosts:
+ - ip_address: "10.*.*.8"
+ host_state: "present-in-export"
+ state: "present"
+ register: result
+
+ - name: Remove host in nfs share(fs) with adv_host_mgmt_enabled as false
+ dellemc.unity.nfs:
+ unispherehost: "{{ unispherehost }}"
+ username: "{{ username }}"
+ password: "{{ password }}"
+ validate_certs: "{{ validate_certs }}"
+ nfs_export_name: "csishare-csivol-346b60e518"
+ filesystem_id: "fs_14267"
+ adv_host_mgmt_enabled: false
+ no_access_hosts:
+ - domain: "google.com"
+ read_only_hosts:
+ - netgroup: "netgroup_admin"
+ read_only_root_hosts:
+ - host_name: "host5"
+ read_write_hosts:
+ - subnet: "10.*.*.*/255.255.255.0"
+ read_write_root_hosts:
+ - ip_address: "10.*.*.*"
+ host_state: "absent-in-export"
+ state: "present"
+ register: result
diff --git a/playbooks/modules/nfsserver.yml b/playbooks/modules/nfsserver.yml
new file mode 100644
index 0000000..83d0d7b
--- /dev/null
+++ b/playbooks/modules/nfsserver.yml
@@ -0,0 +1,104 @@
+---
+- name: NFS Server Operations
+ hosts: localhost
+ connection: local
+ gather_facts: false
+ vars:
+ unispherehost: '10.*.*.*'
+ validate_certs: false
+ username: 'user'
+ password: '**'
+
+ tasks:
+ - name: Create NFS server with kdctype as Windows
+ dellemc.unity.nfsserver:
+ unispherehost: "{{ unispherehost }}"
+ username: "{{ username }}"
+ password: "{{ password }}"
+ validate_certs: "{{ validate_certs }}"
+ nas_server_name: "dummy_nas"
+ host_name: "dummy_nas23"
+ is_secure_enabled: true
+ kerberos_domain_controller_type: "WINDOWS"
+ kerberos_domain_controller_username: "user"
+ kerberos_domain_controller_password: "**"
+ is_extended_credentials_enabled: true
+ nfs_v4_enabled: true
+ state: "present"
+
+ - name: Create NFS server with kdctype as Windows - Idempotency
+ dellemc.unity.nfsserver:
+ unispherehost: "{{ unispherehost }}"
+ username: "{{ username }}"
+ password: "{{ password }}"
+ validate_certs: "{{ validate_certs }}"
+ nas_server_name: "dummy_nas"
+ host_name: "dummy_nas23"
+ is_secure_enabled: true
+ kerberos_domain_controller_type: "WINDOWS"
+ kerberos_domain_controller_username: "user"
+ kerberos_domain_controller_password: "**"
+ is_extended_credentials_enabled: true
+ nfs_v4_enabled: true
+ state: "present"
+
+ - name: Get NFS server details
+ dellemc.unity.nfsserver:
+ unispherehost: "{{ unispherehost }}"
+ username: "{{ username }}"
+ password: "{{ password }}"
+ validate_certs: "{{ validate_certs }}"
+ nas_server_name: "dummy_nas"
+ state: "present"
+
+ - name: Delete NFS server
+ dellemc.unity.nfsserver:
+ unispherehost: "{{ unispherehost }}"
+ username: "{{ username }}"
+ password: "{{ password }}"
+ validate_certs: "{{ validate_certs }}"
+ nas_server_name: "dummy_nas"
+ kerberos_domain_controller_username: "user"
+ kerberos_domain_controller_password: "**"
+ remove_spn_from_kerberos: true
+ state: "absent"
+
+ - name: Create NFS server with kdctype as Unix
+ dellemc.unity.nfsserver:
+ unispherehost: "{{ unispherehost }}"
+ username: "{{ username }}"
+ password: "{{ password }}"
+ validate_certs: "{{ validate_certs }}"
+ nas_server_name: "dummy_nas"
+ host_name: "dummy_nas23"
+ is_secure_enabled: true
+ kerberos_domain_controller_type: "UNIX"
+ is_extended_credentials_enabled: true
+ nfs_v4_enabled: true
+ state: "present"
+
+ - name: Create NFS server with kdctype as Unix - Idempotency
+ dellemc.unity.nfsserver:
+ unispherehost: "{{ unispherehost }}"
+ username: "{{ username }}"
+ password: "{{ password }}"
+ validate_certs: "{{ validate_certs }}"
+ nas_server_name: "dummy_nas"
+ host_name: "dummy_nas23"
+ is_secure_enabled: true
+ kerberos_domain_controller_type: "UNIX"
+ is_extended_credentials_enabled: true
+ nfs_v4_enabled: true
+ state: "present"
+
+ - name: Delete NFS server
+ dellemc.unity.nfsserver:
+ unispherehost: "{{ unispherehost }}"
+ username: "{{ username }}"
+ password: "{{ password }}"
+ validate_certs: "{{ validate_certs }}"
+ nas_server_name: "dummy_nas"
+ kerberos_domain_controller_username: "user"
+ kerberos_domain_controller_password: "**"
+ remove_spn_from_kerberos: true
+ state: "absent"
diff --git a/playbooks/modules/replication_session.yml b/playbooks/modules/replication_session.yml
new file mode 100644
index 0000000..484e29a
--- /dev/null
+++ b/playbooks/modules/replication_session.yml
@@ -0,0 +1,133 @@
+---
+- name: Replication Session Operations
+ hosts: localhost
+ connection: local
+ vars:
+ unispherehost: '10.*.*.*'
+ validate_certs: false
+ username: 'admin'
+ password: '**'
+ session_id: "103079215195_APM00213404195_0000_103079215215_APM00213404195_0000"
+ session_name: "test-session"
+
+ tasks:
+ - name: Get replication session details
+ dellemc.unity.replication_session:
+ unispherehost: "{{ unispherehost }}"
+ username: "{{ username }}"
+ password: "{{ password }}"
+ validate_certs: "{{ validate_certs }}"
+ session_name: "{{ session_name }}"
+
+ - name: Get replication session details
+ dellemc.unity.replication_session:
+ unispherehost: "{{ unispherehost }}"
+ username: "{{ username }}"
+ password: "{{ password }}"
+ validate_certs: "{{ validate_certs }}"
+ session_id: "{{ session_id }}"
+
+ - name: Pause replication session
+ dellemc.unity.replication_session:
+ unispherehost: "{{ unispherehost }}"
+ username: "{{ username }}"
+ password: "{{ password }}"
+ validate_certs: "{{ validate_certs }}"
+ session_name: "{{ session_name }}"
+ pause: true
+
+ - name: Pause replication session -- Idempotency
+ dellemc.unity.replication_session:
+ unispherehost: "{{ unispherehost }}"
+ username: "{{ username }}"
+ password: "{{ password }}"
+ validate_certs: "{{ validate_certs }}"
+ session_name: "{{ session_name }}"
+ pause: true
+
+ - name: Resume replication session
+ dellemc.unity.replication_session:
+ unispherehost: "{{ unispherehost }}"
+ username: "{{ username }}"
+ password: "{{ password }}"
+ validate_certs: "{{ validate_certs }}"
+ session_name: "{{ session_name }}"
+ force_full_copy: true
+ pause: false
+
+ - name: Resume replication session -- Idempotency
+ dellemc.unity.replication_session:
+ unispherehost: "{{ unispherehost }}"
+ username: "{{ username }}"
+ password: "{{ password }}"
+ validate_certs: "{{ validate_certs }}"
+ session_name: "{{ session_name }}"
+ force_full_copy: true
+ pause: false
+
+ - name: Sync replication session
+ dellemc.unity.replication_session:
+ unispherehost: "{{ unispherehost }}"
+ username: "{{ username }}"
+ password: "{{ password }}"
+ validate_certs: "{{ validate_certs }}"
+ session_id: "{{ session_id }}"
+ sync: true
+
+ - name: Failover replication session
+ dellemc.unity.replication_session:
+ unispherehost: "{{ unispherehost }}"
+ username: "{{ username }}"
+ password: "{{ password }}"
+ validate_certs: "{{ validate_certs }}"
+ session_name: "{{ session_name }}"
+ failover_with_sync: true
+ force: true
+
+ - name: Failover replication session -- Idempotency
+ dellemc.unity.replication_session:
+ unispherehost: "{{ unispherehost }}"
+ username: "{{ username }}"
+ password: "{{ password }}"
+ validate_certs: "{{ validate_certs }}"
+ session_name: "{{ session_name }}"
+ failover_with_sync: true
+ force: true
+
+ - name: Failback replication session
+ dellemc.unity.replication_session:
+ unispherehost: "{{ dest_unispherhost }}"
+ username: "{{ username }}"
+ password: "{{ password }}"
+ validate_certs: "{{ validate_certs }}"
+ session_name: "{{ session_name }}"
+ failback: true
+ force_full_copy: true
+
+ - name: Failback replication session -- Idempotency
+ dellemc.unity.replication_session:
+ unispherehost: "{{ unispherehost }}"
+ username: "{{ username }}"
+ password: "{{ password }}"
+ validate_certs: "{{ validate_certs }}"
+ session_name: "{{ session_name }}"
+ failback: true
+ force_full_copy: true
+
+ - name: Delete replication session
+ dellemc.unity.replication_session:
+ unispherehost: "{{ unispherehost }}"
+ username: "{{ username }}"
+ password: "{{ password }}"
+ validate_certs: "{{ validate_certs }}"
+ session_name: "test123"
+ state: "absent"
+
+ - name: Delete replication session -- Idempotency
+ dellemc.unity.replication_session:
+ unispherehost: "{{ unispherehost }}"
+ username: "{{ username }}"
+ password: "{{ password }}"
+ validate_certs: "{{ validate_certs }}"
+ session_name: "test123"
+ state: "absent"
diff --git a/playbooks/modules/smbshare.yml b/playbooks/modules/smbshare.yml
new file mode 100644
index 0000000..91de71d
--- /dev/null
+++ b/playbooks/modules/smbshare.yml
@@ -0,0 +1,229 @@
+---
+- name: SMB Share Module Operations in Unity
+ hosts: localhost
+ connection: local
+ vars:
+ unispherehost: '10.*.*.*'
+ validate_certs: false
+ username: 'user'
+ password: '**'
+ filesystem_name: "ansible_smb_share_fs"
+ snapshot_name: "ansible_smb_share_snap"
+ nas_server_name: "lglad071"
+ description: "Share is created using playbook"
+ new_description: "modified the description of share using playbook"
+ fs_share_name: "ansible_share_2"
+ snap_share_name: "ansible_share_21"
+ tasks:
+ - name: Create a SMB Share for Filesystem
+ register: smb_result
+ dellemc.unity.smbshare:
+ unispherehost: "{{ unispherehost }}"
+ username: "{{ username }}"
+ password: "{{ password }}"
+ validate_certs: "{{ validate_certs }}"
+ share_name: "{{ fs_share_name }}"
+ path: "/"
+ filesystem_name: "{{ filesystem_name }}"
+ nas_server_name: "{{ nas_server_name }}"
+ umask: "000"
+ description: "Added description of filesystem SMB share during creation"
+ offline_availability: "PROGRAMS"
+ is_abe_enabled: true
+ is_branch_cache_enabled: true
+ is_continuous_availability_enabled: true
+ is_encryption_enabled: true
+ state: "present"
+
+ - name: Set Snapshot SMB Share ID
+ ansible.builtin.set_fact:
+ fs_share_id: "{{ smb_result.smb_share_details.id }}"
+
+ - name: Create a SMB Share for Filesystem Idempotency
+ dellemc.unity.smbshare:
+ unispherehost: "{{ unispherehost }}"
+ username: "{{ username }}"
+ password: "{{ password }}"
+ validate_certs: "{{ validate_certs }}"
+ share_name: "{{ fs_share_name }}"
+ path: "/"
+ filesystem_name: "{{ filesystem_name }}"
+ nas_server_name: "{{ nas_server_name }}"
+ umask: "000"
+ description: "Added description of filesystem SMB share during creation"
+ offline_availability: "PROGRAMS"
+ is_abe_enabled: true
+ is_branch_cache_enabled: true
+ is_continuous_availability_enabled: true
+ is_encryption_enabled: true
+ state: "present"
+
+ - name: Get SMB Share Details using Name
+ dellemc.unity.smbshare:
+ unispherehost: "{{ unispherehost }}"
+ username: "{{ username }}"
+ password: "{{ password }}"
+ validate_certs: "{{ validate_certs }}"
+ share_name: "{{ fs_share_name }}"
+ filesystem_id: "fs_65"
+ state: "present"
+
+ - name: Update the details of the SMB share
+ dellemc.unity.smbshare:
+ unispherehost: "{{ unispherehost }}"
+ username: "{{ username }}"
+ password: "{{ password }}"
+ validate_certs: "{{ validate_certs }}"
+ share_name: "{{ fs_share_name }}"
+ filesystem_id: "fs_65"
+ umask: "777"
+ description: "updated description of filesystem SMB share"
+ offline_availability: "DOCUMENTS"
+ is_abe_enabled: false
+ is_branch_cache_enabled: false
+ is_continuous_availability_enabled: false
+ is_encryption_enabled: false
+ state: "present"
+
+ - name: Update the details of the SMB share Idempotency
+ dellemc.unity.smbshare:
+ unispherehost: "{{ unispherehost }}"
+ username: "{{ username }}"
+ password: "{{ password }}"
+ validate_certs: "{{ validate_certs }}"
+ share_name: "{{ fs_share_name }}"
+ filesystem_id: "fs_65"
+ umask: "777"
+ description: "updated description of filesystem SMB share"
+ offline_availability: "DOCUMENTS"
+ is_abe_enabled: false
+ is_branch_cache_enabled: false
+ is_continuous_availability_enabled: false
+ is_encryption_enabled: false
+ state: "present"
+
+ - name: Delete SMB share for Filesystem
+ dellemc.unity.smbshare:
+ unispherehost: "{{ unispherehost }}"
+ username: "{{ username }}"
+ password: "{{ password }}"
+ validate_certs: "{{ validate_certs }}"
+ share_name: "{{ fs_share_name }}"
+ filesystem_id: "fs_65"
+ state: "absent"
+
+ - name: Delete SMB share for Filesystem Idempotency
+ dellemc.unity.smbshare:
+ unispherehost: "{{ unispherehost }}"
+ username: "{{ username }}"
+ password: "{{ password }}"
+ validate_certs: "{{ validate_certs }}"
+ share_name: "{{ fs_share_name }}"
+ filesystem_id: "fs_65"
+ state: "absent"
+
+ # Snapshot Name and ID both are unique across Unity Array.
+ # Hence, NAS Server is not required for Unique Identification of Snapshot.
+ - name: Create a SMB Share for Snapshot
+ register: smb_result
+ dellemc.unity.smbshare:
+ unispherehost: "{{ unispherehost }}"
+ username: "{{ username }}"
+ password: "{{ password }}"
+ validate_certs: "{{ validate_certs }}"
+ share_name: "{{ snap_share_name }}"
+ path: "/"
+ snapshot_name: "{{ snapshot_name }}"
+ umask: "000"
+ description: "Added description of Snapshot SMB share during creation"
+ offline_availability: "PROGRAMS"
+ is_abe_enabled: true
+ is_branch_cache_enabled: true
+ is_continuous_availability_enabled: true
+ is_encryption_enabled: true
+ state: "present"
+
+ - name: Set Snapshot SMB Share ID
+ ansible.builtin.set_fact:
+ snap_share_id: "{{ smb_result.smb_share_details.id }}"
+
+ - name: Create a SMB Share for Snapshot Idempotency
+ dellemc.unity.smbshare:
+ unispherehost: "{{ unispherehost }}"
+ username: "{{ username }}"
+ password: "{{ password }}"
+ validate_certs: "{{ validate_certs }}"
+ share_name: "{{ snap_share_name }}"
+ path: "/"
+ snapshot_name: "{{ snapshot_name }}"
+ umask: "000"
+ description: "Added description of Snapshot SMB share during creation"
+ offline_availability: "PROGRAMS"
+ is_abe_enabled: true
+ is_branch_cache_enabled: true
+ is_continuous_availability_enabled: true
+ is_encryption_enabled: true
+ state: "present"
+
+ - name: Get SMB Share Details using Name
+ dellemc.unity.smbshare:
+ unispherehost: "{{ unispherehost }}"
+ username: "{{ username }}"
+ password: "{{ password }}"
+ validate_certs: "{{ validate_certs }}"
+ share_name: "{{ snap_share_name }}"
+ snapshot_name: "{{ snapshot_name }}"
+ state: "present"
+
+ - name: Update the details of the SMB share
+ dellemc.unity.smbshare:
+ unispherehost: "{{ unispherehost }}"
+ username: "{{ username }}"
+ password: "{{ password }}"
+ validate_certs: "{{ validate_certs }}"
+ share_name: "{{ snap_share_name }}"
+ snapshot_name: "{{ snapshot_name }}"
+ umask: "777"
+ description: "updated description of snapshot's SMB share"
+ offline_availability: "DOCUMENTS"
+ is_abe_enabled: false
+ is_branch_cache_enabled: false
+ is_continuous_availability_enabled: false
+ is_encryption_enabled: false
+ state: "present"
+
+ - name: Update the details of the SMB share Idempotency
+ dellemc.unity.smbshare:
+ unispherehost: "{{ unispherehost }}"
+ username: "{{ username }}"
+ password: "{{ password }}"
+ validate_certs: "{{ validate_certs }}"
+ share_name: "{{ snap_share_name }}"
+ snapshot_name: "{{ snapshot_name }}"
+ umask: "777"
+ description: "updated description of snapshot's SMB share"
+ offline_availability: "DOCUMENTS"
+ is_abe_enabled: false
+ is_branch_cache_enabled: false
+ is_continuous_availability_enabled: false
+ is_encryption_enabled: false
+ state: "present"
+
+ - name: Delete SMB share for Filesystem Snapshot
+ dellemc.unity.smbshare:
+ unispherehost: "{{ unispherehost }}"
+ username: "{{ username }}"
+ password: "{{ password }}"
+ validate_certs: "{{ validate_certs }}"
+ share_id: "{{ snap_share_id }}"
+ state: "absent"
+
+ - name: Delete SMB share for Filesystem Snapshot Idempotency
+ dellemc.unity.smbshare:
+ unispherehost: "{{ unispherehost }}"
+ username: "{{ username }}"
+ password: "{{ password }}"
+ validate_certs: "{{ validate_certs }}"
+ share_name: "{{ snap_share_name }}"
+ snapshot_name: "{{ snapshot_name }}"
+ state: "absent"
diff --git a/playbooks/modules/snapshot.yml b/playbooks/modules/snapshot.yml
new file mode 100644
index 0000000..164106f
--- /dev/null
+++ b/playbooks/modules/snapshot.yml
@@ -0,0 +1,194 @@
+---
+- name: Snapshot Module Operations in Unity
+ hosts: localhost
+ connection: local
+ vars:
+ unispherehost: '10.*.*.*'
+ validate_certs: false
+ username: 'admin'
+ password: 'Password123!'
+ cg_snapshot_name: "ansible_snap_cg_1_1"
+ vol_snapshot_name: "ansible_snap_lun_4_2"
+ vol_name: "ansible_snap_lun_4"
+ cg_name: "ansible_snap_cg_1"
+ description: "Created using playbook"
+ new_description: "modified description using playbook"
+ host_name: "ansible_snap_host"
+ expiry_time: "04/15/2021 2:30"
+ new_expiry_time: "04/10/2021 2:30"
+ new_snapshot_name: "new_ansible_snap_lun_4_2"
+
+ tasks:
+ - name: Create a Snapshot for a CG
+ register: result
+ dellemc.unity.snapshot:
+ unispherehost: "{{ unispherehost }}"
+ username: "{{ username }}"
+ password: "{{ password }}"
+ validate_certs: "{{ validate_certs }}"
+ port: "{{ port }}"
+ cg_name: "{{ cg_name }}"
+ snapshot_name: "{{ cg_snapshot_name }}"
+ description: "{{ description }}"
+ auto_delete: false
+ state: "present"
+
+ - name: Set snapshot id
+ ansible.builtin.set_fact:
+ cg_snapshot_id: "{{ result.snapshot_details.id }}"
+
+ - name: Create a Snapshot for a CG Idempotency
+ dellemc.unity.snapshot:
+ unispherehost: "{{ unispherehost }}"
+ username: "{{ username }}"
+ password: "{{ password }}"
+ validate_certs: "{{ validate_certs }}"
+ port: "{{ port }}"
+ cg_name: "{{ cg_name }}"
+ snapshot_name: "{{ cg_snapshot_name }}"
+ description: "{{ description }}"
+ auto_delete: false
+ state: "present"
+
+ - name: Create a Snapshot for a LUN with Host attached.
+ register: result
+ dellemc.unity.snapshot:
+ unispherehost: "{{ unispherehost }}"
+ username: "{{ username }}"
+ password: "{{ password }}"
+ validate_certs: "{{ validate_certs }}"
+ port: "{{ port }}"
+ vol_name: "{{ vol_name }}"
+ snapshot_name: "{{ vol_snapshot_name }}"
+ expiry_time: "{{ expiry_time }}"
+ description: "{{ description }}"
+ host_name: "{{ host_name }}"
+ host_state: "mapped"
+ state: "present"
+
+ - name: Set snapshot id
+ ansible.builtin.set_fact:
+ vol_snapshot_id: "{{ result.snapshot_details.id }}"
+
+ - name: Create a Snapshot for a LUN with Host attached Idempotency.
+ dellemc.unity.snapshot:
+ unispherehost: "{{ unispherehost }}"
+ username: "{{ username }}"
+ password: "{{ password }}"
+ validate_certs: "{{ validate_certs }}"
+ port: "{{ port }}"
+ vol_name: "{{ vol_name }}"
+ snapshot_name: "{{ vol_snapshot_name }}"
+ expiry_time: "{{ expiry_time }}"
+ description: "{{ description }}"
+ host_name: "{{ host_name }}"
+ host_state: "mapped"
+ state: "present"
+
+ - name: Unmap a host for a Snapshot using Id
+ dellemc.unity.snapshot:
+ unispherehost: "{{ unispherehost }}"
+ username: "{{ username }}"
+ password: "{{ password }}"
+ validate_certs: "{{ validate_certs }}"
+ port: "{{ port }}"
+ snapshot_id: "{{ vol_snapshot_id }}"
+ host_name: "{{ host_name }}"
+ host_state: "unmapped"
+ state: "present"
+
+ - name: Unmap a host for a Snapshot Idempotency case
+ dellemc.unity.snapshot:
+ unispherehost: "{{ unispherehost }}"
+ username: "{{ username }}"
+ password: "{{ password }}"
+ validate_certs: "{{ validate_certs }}"
+ port: "{{ port }}"
+ snapshot_name: "{{ vol_snapshot_name }}"
+ host_name: "{{ host_name }}"
+ host_state: "unmapped"
+ state: "present"
+
+ - name: Map snapshot to a host using Id
+ dellemc.unity.snapshot:
+ unispherehost: "{{ unispherehost }}"
+ username: "{{ username }}"
+ password: "{{ password }}"
+ validate_certs: "{{ validate_certs }}"
+ port: "{{ port }}"
+ snapshot_id: "{{ vol_snapshot_id }}"
+ host_name: "{{ host_name }}"
+ host_state: "mapped"
+ state: "present"
+
+ - name: Get Snapshot Details using Id
+ dellemc.unity.snapshot:
+ unispherehost: "{{ unispherehost }}"
+ username: "{{ username }}"
+ password: "{{ password }}"
+ validate_certs: "{{ validate_certs }}"
+ snapshot_id: "{{ cg_snapshot_id }}"
+ state: "present"
+
+ - name: Update attributes of a Snapshot for a LUN using Id
+ dellemc.unity.snapshot:
+ unispherehost: "{{ unispherehost }}"
+ username: "{{ username }}"
+ password: "{{ password }}"
+ validate_certs: "{{ validate_certs }}"
+ snapshot_id: "{{ vol_snapshot_id }}"
+ new_snapshot_name: "{{ new_snapshot_name }}"
+ expiry_time: "{{ new_expiry_time }}"
+ description: "{{ new_description }}"
+ host_name: "{{ host_name }}"
+ host_state: "unmapped"
+ state: "present"
+
+ - name: Update attributes of a Snapshot for a LUN Idempotency case
+ dellemc.unity.snapshot:
+ unispherehost: "{{ unispherehost }}"
+ username: "{{ username }}"
+ password: "{{ password }}"
+ validate_certs: "{{ validate_certs }}"
+ snapshot_name: "{{ new_snapshot_name }}"
+ expiry_time: "{{ new_expiry_time }}"
+ description: "{{ new_description }}"
+ host_name: "{{ host_name }}"
+ host_state: "unmapped"
+ state: "present"
+
+ - name: Delete Snapshot of CG.
+ dellemc.unity.snapshot:
+ unispherehost: "{{ unispherehost }}"
+ username: "{{ username }}"
+ password: "{{ password }}"
+ validate_certs: "{{ validate_certs }}"
+ snapshot_name: "{{ cg_snapshot_name }}"
+ state: "absent"
+
+ - name: Delete Snapshot of CG using Id Idempotency case.
+ dellemc.unity.snapshot:
+ unispherehost: "{{ unispherehost }}"
+ username: "{{ username }}"
+ password: "{{ password }}"
+ validate_certs: "{{ validate_certs }}"
+ snapshot_id: "{{ cg_snapshot_id }}"
+ state: "absent"
+
+ - name: Delete Snapshot of volume.
+ dellemc.unity.snapshot:
+ unispherehost: "{{ unispherehost }}"
+ username: "{{ username }}"
+ password: "{{ password }}"
+ validate_certs: "{{ validate_certs }}"
+ snapshot_name: "{{ new_snapshot_name }}"
+ state: "absent"
+
+ - name: Delete Snapshot of volume Idempotency.
+ dellemc.unity.snapshot:
+ unispherehost: "{{ unispherehost }}"
+ username: "{{ username }}"
+ password: "{{ password }}"
+ validate_certs: "{{ validate_certs }}"
+ snapshot_name: "{{ new_snapshot_name }}"
+ state: "absent"
diff --git a/playbooks/modules/snapshotschedule.yml b/playbooks/modules/snapshotschedule.yml
new file mode 100644
index 0000000..f2859a0
--- /dev/null
+++ b/playbooks/modules/snapshotschedule.yml
@@ -0,0 +1,203 @@
+---
+- name: Snapshot schedule operations on Unity
+ hosts: localhost
+ connection: local
+ gather_facts: false
+ vars:
+ unispherehost: '10.*.*.*'
+ validate_certs: false
+ username: 'admin'
+ password: 'Password123!'
+ state_present: 'present'
+ state_absent: 'absent'
+
+ tasks:
+ - name: Create snapshot schedule (Rule Type - every_n_hours)
+ register: result
+ dellemc.unity.snapshotschedule:
+ unispherehost: "{{ unispherehost }}"
+ validate_certs: "{{ validate_certs }}"
+ username: "{{ username }}"
+ password: "{{ password }}"
+ name: "Ansible_Every_N_Hours_Testing"
+ type: "every_n_hours"
+ interval: 6
+ desired_retention: 24
+ state: "{{ state_present }}"
+
+ - name: Set id
+ ansible.builtin.set_fact:
+ id: "{{ result.snapshot_schedule_details.id }}"
+
+ - name: Create snapshot schedule (Rule Type - every_n_hours) - Idempotency
+ dellemc.unity.snapshotschedule:
+ unispherehost: "{{ unispherehost }}"
+ validate_certs: "{{ validate_certs }}"
+ username: "{{ username }}"
+ password: "{{ password }}"
+ name: "Ansible_Every_N_Hours_Testing"
+ type: "every_n_hours"
+ interval: 6
+ desired_retention: 24
+ state: "{{ state_present }}"
+
+ - name: Create snapshot schedule (Rule Type - every_day)
+ dellemc.unity.snapshotschedule:
+ unispherehost: "{{ unispherehost }}"
+ validate_certs: "{{ validate_certs }}"
+ username: "{{ username }}"
+ password: "{{ password }}"
+ name: "Ansible_Every_Day_Testing"
+ type: "every_day"
+ hours_of_day:
+ - 8
+ - 14
+ auto_delete: true
+ state: "{{ state_present }}"
+
+ - name: Create snapshot schedule (Rule Type - every_n_days)
+ dellemc.unity.snapshotschedule:
+ unispherehost: "{{ unispherehost }}"
+ validate_certs: "{{ validate_certs }}"
+ username: "{{ username }}"
+ password: "{{ password }}"
+ name: "Ansible_Every_N_Day_Testing"
+ type: "every_n_days"
+ day_interval: 2
+ desired_retention: 16
+ retention_unit: "days"
+ state: "{{ state_present }}"
+
+ - name: Create snapshot schedule (Rule Type - every_week)
+ dellemc.unity.snapshotschedule:
+ unispherehost: "{{ unispherehost }}"
+ validate_certs: "{{ validate_certs }}"
+ username: "{{ username }}"
+ password: "{{ password }}"
+ name: "Ansible_Every_Week_Testing"
+ type: "every_week"
+ days_of_week:
+ - MONDAY
+ - FRIDAY
+ hour: 12
+ minute: 30
+ desired_retention: 200
+ state: "{{ state_present }}"
+
+ - name: Create snapshot schedule (Rule Type - every_month)
+ dellemc.unity.snapshotschedule:
+ unispherehost: "{{ unispherehost }}"
+ validate_certs: "{{ validate_certs }}"
+ username: "{{ username }}"
+ password: "{{ password }}"
+ name: "Ansible_Every_Month_Testing"
+ type: "every_month"
+ day_of_month: 17
+ auto_delete: true
+ state: "{{ state_present }}"
+
+ - name: Get snapshot schedule details using name
+ dellemc.unity.snapshotschedule:
+ unispherehost: "{{ unispherehost }}"
+ validate_certs: "{{ validate_certs }}"
+ username: "{{ username }}"
+ password: "{{ password }}"
+ name: "Ansible_Every_N_Hours_Testing"
+ state: "{{ state_present }}"
+
+ - name: Get snapshot schedule details using id
+ dellemc.unity.snapshotschedule:
+ unispherehost: "{{ unispherehost }}"
+ validate_certs: "{{ validate_certs }}"
+ username: "{{ username }}"
+ password: "{{ password }}"
+ id: "{{ id }}"
+ state: "{{ state_present }}"
+
+ - name: Modify snapshot schedule details id
+ dellemc.unity.snapshotschedule:
+ unispherehost: "{{ unispherehost }}"
+ validate_certs: "{{ validate_certs }}"
+ username: "{{ username }}"
+ password: "{{ password }}"
+ id: "{{ id }}"
+ type: "every_n_hours"
+ interval: 8
+ state: "{{ state_present }}"
+
+ - name: Modify snapshot schedule details id - Idempotency
+ dellemc.unity.snapshotschedule:
+ unispherehost: "{{ unispherehost }}"
+ validate_certs: "{{ validate_certs }}"
+ username: "{{ username }}"
+ password: "{{ password }}"
+ id: "{{ id }}"
+ type: "every_n_hours"
+ interval: 8
+ state: "{{ state_present }}"
+
+ - name: Modify snapshot schedule using name
+ dellemc.unity.snapshotschedule:
+ unispherehost: "{{ unispherehost }}"
+ validate_certs: "{{ validate_certs }}"
+ username: "{{ username }}"
+ password: "{{ password }}"
+ name: "Ansible_Every_Day_Testing"
+ type: "every_day"
+ desired_retention: 200
+ auto_delete: false
+ state: "{{ state_present }}"
+
+ - name: Delete snapshot schedule using id
+ dellemc.unity.snapshotschedule:
+ unispherehost: "{{ unispherehost }}"
+ validate_certs: "{{ validate_certs }}"
+ username: "{{ username }}"
+ password: "{{ password }}"
+ id: "{{ id }}"
+ state: "{{ state_absent }}"
+
+ - name: Delete snapshot schedule using name
+ dellemc.unity.snapshotschedule:
+ unispherehost: "{{ unispherehost }}"
+ validate_certs: "{{ validate_certs }}"
+ username: "{{ username }}"
+ password: "{{ password }}"
+ name: "Ansible_Every_Day_Testing"
+ state: "{{ state_absent }}"
+
+ - name: Delete snapshot schedule using name
+ dellemc.unity.snapshotschedule:
+ unispherehost: "{{ unispherehost }}"
+ validate_certs: "{{ validate_certs }}"
+ username: "{{ username }}"
+ password: "{{ password }}"
+ name: "Ansible_Every_N_Day_Testing"
+ state: "{{ state_absent }}"
+
+ - name: Delete snapshot schedule using name
+ dellemc.unity.snapshotschedule:
+ unispherehost: "{{ unispherehost }}"
+ validate_certs: "{{ validate_certs }}"
+ username: "{{ username }}"
+ password: "{{ password }}"
+ name: "Ansible_Every_Week_Testing"
+ state: "{{ state_absent }}"
+
+ - name: Delete snapshot schedule using name
+ dellemc.unity.snapshotschedule:
+ unispherehost: "{{ unispherehost }}"
+ validate_certs: "{{ validate_certs }}"
+ username: "{{ username }}"
+ password: "{{ password }}"
+ name: "Ansible_Every_Month_Testing"
+ state: "{{ state_absent }}"
+
+ - name: Delete snapshot schedule using name - Idempotency
+ dellemc.unity.snapshotschedule:
+ unispherehost: "{{ unispherehost }}"
+ validate_certs: "{{ validate_certs }}"
+ username: "{{ username }}"
+ password: "{{ password }}"
+ name: "Ansible_Every_Month_Testing"
+ state: "{{ state_absent }}"
diff --git a/playbooks/modules/storagepool.yml b/playbooks/modules/storagepool.yml
new file mode 100644
index 0000000..a53328e
--- /dev/null
+++ b/playbooks/modules/storagepool.yml
@@ -0,0 +1,185 @@
+---
+- name: Storage pool Module Operations on Unity
+ hosts: localhost
+ connection: local
+ vars:
+ unispherehost: '10.*.*.*'
+ validate_certs: false
+ username: 'user'
+ password: '**'
+ pool_name: "test_DND"
+ new_pool_name: "new_pool2"
+ fast_vp_enabled: "enabled"
+ fast_cache_enabled: "enabled"
+ pool_description: "updated"
+ disk_group_id: "dg_16"
+ disk_num: 2
+ raid_type: "RAID10"
+ stripe_width: "BEST_FIT"
+ alert_threshold: 50
+ is_harvest_enabled: true
+ pool_harvest_high_threshold: 59
+ pool_harvest_low_threshold: 40
+ is_snap_harvest_enabled: true
+ snap_harvest_high_threshold: 80
+ snap_harvest_low_threshold: 60
+ pool_type: "DYNAMIC"
+
+ tasks:
+ - name: Get the details of Storage pool by name
+ dellemc.unity.storagepool:
+ unispherehost: "{{ unispherehost }}"
+ username: "{{ username }}"
+ password: "{{ password }}"
+ validate_certs: "{{ validate_certs }}"
+ pool_name: "Test_Pool"
+ pool_description: "test pool"
+ raid_groups:
+ disk_group_id: "dg_36"
+ disk_num: 3
+ raid_type: "RAID10"
+ stripe_width: "BEST_FIT"
+ alert_threshold: 50
+ is_harvest_enabled: true
+ pool_harvest_high_threshold: 60
+ pool_harvest_low_threshold: 40
+ is_snap_harvest_enabled: true
+ snap_harvest_high_threshold: 70
+ snap_harvest_low_threshold: 50
+ fast_vp: "enabled"
+ fast_cache: "enabled"
+ pool_type: "DYNAMIC"
+ state: "present"
+
+ - name: Get the details of Storage pool by name
+ register: result
+ dellemc.unity.storagepool:
+ unispherehost: "{{ unispherehost }}"
+ username: "{{ username }}"
+ password: "{{ password }}"
+ validate_certs: "{{ validate_certs }}"
+ pool_name: "{{ pool_name }}"
+ state: "present"
+
+ - name: Set storage pool id
+ ansible.builtin.set_fact:
+ pool_id: "{{ result.storage_pool_details.id }}"
+
+ - name: Get the details of Storage pool by pool id
+ dellemc.unity.storagepool:
+ unispherehost: "{{ unispherehost }}"
+ username: "{{ username }}"
+ password: "{{ password }}"
+ validate_certs: "{{ validate_certs }}"
+ pool_id: "{{ pool_id }}"
+ state: "present"
+
+ - name: Rename Storage pool by name
+ dellemc.unity.storagepool:
+ unispherehost: "{{ unispherehost }}"
+ username: "{{ username }}"
+ password: "{{ password }}"
+ validate_certs: "{{ validate_certs }}"
+ pool_name: "{{ pool_name }}"
+ new_pool_name: "{{ new_pool_name }}"
+ state: "present"
+
+ - name: Update Storage pool description
+ dellemc.unity.storagepool:
+ unispherehost: "{{ unispherehost }}"
+ username: "{{ username }}"
+ password: "{{ password }}"
+ validate_certs: "{{ validate_certs }}"
+ pool_name: "{{ new_pool_name }}"
+ pool_description: "{{ pool_description }}"
+ state: "present"
+
+ - name: Update Storage pool description- Idempotent
+ dellemc.unity.storagepool:
+ unispherehost: "{{ unispherehost }}"
+ username: "{{ username }}"
+ password: "{{ password }}"
+ validate_certs: "{{ validate_certs }}"
+ pool_name: "{{ new_pool_name }}"
+ pool_description: "{{ pool_description }}"
+ state: "present"
+
+ - name: Update fast_vp by pool name
+ dellemc.unity.storagepool:
+ unispherehost: "{{ unispherehost }}"
+ username: "{{ username }}"
+ password: "{{ password }}"
+ validate_certs: "{{ validate_certs }}"
+ pool_name: "{{ new_pool_name }}"
+ fast_vp: "{{ fast_vp_enabled }}"
+ state: "present"
+
+ - name: Update fast_cache by pool name
+ dellemc.unity.storagepool:
+ unispherehost: "{{ unispherehost }}"
+ username: "{{ username }}"
+ password: "{{ password }}"
+ validate_certs: "{{ validate_certs }}"
+ pool_name: "{{ new_pool_name }}"
+ fast_cache: "{{ fast_cache_enabled }}"
+ state: "present"
+
+ - name: Rename Storage pool by name
+ dellemc.unity.storagepool:
+ unispherehost: "{{ unispherehost }}"
+ username: "{{ username }}"
+ password: "{{ password }}"
+ validate_certs: "{{ validate_certs }}"
+ pool_name: "{{ new_pool_name }}"
+ new_pool_name: "{{ pool_name }}"
+ state: "present"
+
+ - name: Create a Storage pool
+ dellemc.unity.storagepool:
+ unispherehost: "{{ unispherehost }}"
+ username: "{{ username }}"
+ password: "{{ password }}"
+ validate_certs: "{{ validate_certs }}"
+ pool_name: "test_pool"
+ pool_description: "Unity test pool."
+ raid_groups:
+ disk_group_id: "{{ disk_group_id }}"
+ disk_num: "{{ disk_num }}"
+ raid_type: "{{ raid_type }}"
+ stripe_width: "{{ stripe_width }}"
+ alert_threshold: "{{ alert_threshold }}"
+ is_harvest_enabled: "{{ is_harvest_enabled }}"
+ pool_harvest_high_threshold: "{{ pool_harvest_high_threshold }}"
+ pool_harvest_low_threshold: "{{ pool_harvest_low_threshold }}"
+ is_snap_harvest_enabled: "{{ is_snap_harvest_enabled }}"
+ snap_harvest_high_threshold: "{{ snap_harvest_high_threshold }}"
+ snap_harvest_low_threshold: "{{ snap_harvest_low_threshold }}"
+ fast_vp: "{{ fast_vp_enabled }}"
+ fast_cache: "{{ fast_cache_enabled }}"
+ pool_type: "DYNAMIC"
+ state: "present"
+
+ - name: Create a StoragePool - idempotency
+ dellemc.unity.storagepool:
+ unispherehost: "{{ unispherehost }}"
+ username: "{{ username }}"
+ password: "{{ password }}"
+ validate_certs: "{{ validate_certs }}"
+ pool_name: "test_pool"
+ pool_description: "Unity test pool."
+ raid_groups:
+ disk_group_id: "{{ disk_group_id }}"
+ disk_num: "{{ disk_num }}"
+ raid_type: "{{ raid_type }}"
+ stripe_width: "{{ stripe_width }}"
+ alert_threshold: "{{ alert_threshold }}"
+ is_harvest_enabled: "{{ is_harvest_enabled }}"
+ pool_harvest_high_threshold: "{{ pool_harvest_high_threshold }}"
+ pool_harvest_low_threshold: "{{ pool_harvest_low_threshold }}"
+ is_snap_harvest_enabled: "{{ is_snap_harvest_enabled }}"
+ snap_harvest_high_threshold: "{{ snap_harvest_high_threshold }}"
+ snap_harvest_low_threshold: "{{ snap_harvest_low_threshold }}"
+ fast_vp: "{{ fast_vp_enabled }}"
+ fast_cache: "{{ fast_cache_enabled }}"
+ pool_type: "DYNAMIC"
+ state: "present"
diff --git a/playbooks/modules/tree_quota.yml b/playbooks/modules/tree_quota.yml
new file mode 100644
index 0000000..1665ea1
--- /dev/null
+++ b/playbooks/modules/tree_quota.yml
@@ -0,0 +1,138 @@
+---
+- name: Tree Quota Operations
+ hosts: localhost
+ connection: local
+ vars:
+ unispherehost: '10.*.*.*'
+ validate_certs: false
+ username: 'user'
+ password: '**'
+ filesystem_name: "SP_Filesystem_test"
+ filesystem_id: "fs_2279"
+ nas_server_name: "lglad068"
+ path: "/sample_quota"
+ soft_limit: 2
+ state_present: "present"
+ state_absent: "absent"
+
+ tasks:
+ - name: Create quota tree of filesystem
+ register: result
+ dellemc.unity.tree_quota:
+ unispherehost: "{{ unispherehost }}"
+ username: "{{ username }}"
+ password: "{{ password }}"
+ validate_certs: "{{ validate_certs }}"
+ filesystem_id: "{{ filesystem_id }}"
+ path: "{{ path }}"
+ hard_limit: 2
+ cap_unit: "TB"
+ description: "Sample quota tree"
+ state: "{{ state_present }}"
+
+ - name: Set tree_quota_id
+ ansible.builtin.set_fact:
+ tree_quota_id: "{{ result.get_tree_quota_details.id }}"
+
+ - name: Create quota tree of filesystem -- Idempotency
+ dellemc.unity.tree_quota:
+ unispherehost: "{{ unispherehost }}"
+ username: "{{ username }}"
+ password: "{{ password }}"
+ validate_certs: "{{ validate_certs }}"
+ filesystem_id: "{{ filesystem_id }}"
+ path: "{{ path }}"
+ hard_limit: 2
+ cap_unit: "TB"
+ description: "Sample quota tree"
+ state: "{{ state_present }}"
+
+ - name: Get quota tree details by quota tree path
+ dellemc.unity.tree_quota:
+ unispherehost: "{{ unispherehost }}"
+ username: "{{ username }}"
+ password: "{{ password }}"
+ validate_certs: "{{ validate_certs }}"
+ filesystem_id: "{{ filesystem_id }}"
+ path: "{{ path }}"
+ state: "{{ state_present }}"
+
+ - name: Get quota tree details by quota tree id
+ dellemc.unity.tree_quota:
+ unispherehost: "{{ unispherehost }}"
+ username: "{{ username }}"
+ password: "{{ password }}"
+ validate_certs: "{{ validate_certs }}"
+ filesystem_id: "{{ filesystem_id }}"
+ tree_quota_id: "{{ tree_quota_id }}"
+ state: "{{ state_present }}"
+
+ - name: Modify quota tree of filesystem by quota tree path
+ dellemc.unity.tree_quota:
+ unispherehost: "{{ unispherehost }}"
+ username: "{{ username }}"
+ password: "{{ password }}"
+ validate_certs: "{{ validate_certs }}"
+ filesystem_id: "{{ filesystem_id }}"
+ path: "{{ path }}"
+ soft_limit: "{{ soft_limit }}"
+ cap_unit: "TB"
+ description: "Sample quota tree modified"
+ state: "{{ state_present }}"
+
+ - name: Modify quota tree of filesystem -- Idempotency
+ dellemc.unity.tree_quota:
+ unispherehost: "{{ unispherehost }}"
+ username: "{{ username }}"
+ password: "{{ password }}"
+ validate_certs: "{{ validate_certs }}"
+ filesystem_id: "{{ filesystem_id }}"
+ path: "{{ path }}"
+ soft_limit: "{{ soft_limit }}"
+ cap_unit: "TB"
+ description: "Sample quota tree modified"
+ state: "{{ state_present }}"
+
+ - name: Modify quota tree of filesystem by quota tree id
+ dellemc.unity.tree_quota:
+ unispherehost: "{{ unispherehost }}"
+ username: "{{ username }}"
+ password: "{{ password }}"
+ validate_certs: "{{ validate_certs }}"
+ filesystem_name: "{{ filesystem_name }}"
+ nas_server_name: "{{ nas_server_name }}"
+ tree_quota_id: "{{ tree_quota_id }}"
+ soft_limit: "{{ soft_limit }}"
+ cap_unit: "TB"
+ description: "Sample quota tree modified"
+ state: "{{ state_present }}"
+
+ - name: Delete quota tree of filesystem by quota tree path
+ dellemc.unity.tree_quota:
+ unispherehost: "{{ unispherehost }}"
+ username: "{{ username }}"
+ password: "{{ password }}"
+ validate_certs: "{{ validate_certs }}"
+ filesystem_id: "{{ filesystem_id }}"
+ path: "{{ path }}"
+ state: "{{ state_absent }}"
+
+ - name: Delete quota tree of filesystem -- Idempotency
+ dellemc.unity.tree_quota:
+ unispherehost: "{{ unispherehost }}"
+ username: "{{ username }}"
+ password: "{{ password }}"
+ validate_certs: "{{ validate_certs }}"
+ filesystem_id: "{{ filesystem_id }}"
+ path: "{{ path }}"
+ state: "{{ state_absent }}"
+
+ - name: Delete quota tree of filesystem by quota tree id
+ dellemc.unity.tree_quota:
+ unispherehost: "{{ unispherehost }}"
+ username: "{{ username }}"
+ password: "{{ password }}"
+ validate_certs: "{{ validate_certs }}"
+ filesystem_id: "{{ filesystem_id }}"
+ tree_quota_id: "treequota_171798700679_1"
+ state: "{{ state_absent }}"
diff --git a/playbooks/modules/user_quota.yml b/playbooks/modules/user_quota.yml
new file mode 100644
index 0000000..350cf4f
--- /dev/null
+++ b/playbooks/modules/user_quota.yml
@@ -0,0 +1,255 @@
+---
+- name: User Quota Operations
+ hosts: localhost
+ connection: local
+ vars:
+ unispherehost: '10.*.*.*'
+ validate_certs: false
+ username: 'admin'
+ password: 'Password123!'
+ filesystem_name: "SP_Filesystem_test"
+ filesystem_id: "fs_2279"
+ nas_server_name: "lglad068"
+ user_name: "test2"
+ uid: "2"
+ tree_quota_id: "treequota_171798701972_1"
+ path: "/sample"
+ state_present: "present"
+ state_absent: "absent"
+
+ tasks:
+ - name: Create user quota for a filesystem
+ register: result_user_quota
+ dellemc.unity.user_quota:
+ unispherehost: "{{ unispherehost }}"
+ username: "{{ username }}"
+ password: "{{ password }}"
+ validate_certs: "{{ validate_certs }}"
+ filesystem_name: "{{ filesystem_name }}"
+ nas_server_name: "{{ nas_server_name }}"
+ user_type: "Unix"
+ user_name: "{{ user_name }}"
+ soft_limit: "1"
+ cap_unit: "TB"
+ hard_limit: "2"
+ state: "{{ state_present }}"
+
+ - name: Set user_quota_id
+ ansible.builtin.set_fact:
+ user_quota_id: "{{ result_user_quota.get_user_quota_details.id }}"
+
+ - name: Create user quota for a filesystem -- Idempotency
+ register: result_user_quota
+ dellemc.unity.user_quota:
+ unispherehost: "{{ unispherehost }}"
+ username: "{{ username }}"
+ password: "{{ password }}"
+ validate_certs: "{{ validate_certs }}"
+ filesystem_name: "{{ filesystem_name }}"
+ nas_server_name: "{{ nas_server_name }}"
+ user_type: "Unix"
+ user_name: "{{ user_name }}"
+ soft_limit: "1"
+ cap_unit: "TB"
+ hard_limit: "2"
+ state: "{{ state_present }}"
+
+
+ - name: Get user quota details from user_name
+ dellemc.unity.user_quota:
+ unispherehost: "{{ unispherehost }}"
+ username: "{{ username }}"
+ password: "{{ password }}"
+ validate_certs: "{{ validate_certs }}"
+ filesystem_id: "{{ filesystem_id }}"
+ user_name: "{{ user_name }}"
+ state: "{{ state_present }}"
+
+ - name: Modify user quota through user_quota_id
+ dellemc.unity.user_quota:
+ unispherehost: "{{ unispherehost }}"
+ username: "{{ username }}"
+ password: "{{ password }}"
+ validate_certs: "{{ validate_certs }}"
+ soft_limit: "900"
+ hard_limit: "1000"
+ user_quota_id: "{{ user_quota_id }}"
+ state: "{{ state_present }}"
+
+
+ - name: Modify user quota through user_quota_id -- Idempotency
+ dellemc.unity.user_quota:
+ unispherehost: "{{ unispherehost }}"
+ username: "{{ username }}"
+ password: "{{ password }}"
+ validate_certs: "{{ validate_certs }}"
+ soft_limit: "900"
+ hard_limit: "1000"
+ user_quota_id: "{{ user_quota_id }}"
+ state: "{{ state_present }}"
+
+ - name: Modify user quota details from uid
+ dellemc.unity.user_quota:
+ unispherehost: "{{ unispherehost }}"
+ username: "{{ username }}"
+ password: "{{ password }}"
+ validate_certs: "{{ validate_certs }}"
+ filesystem_id: "{{ filesystem_id }}"
+ uid: "{{ uid }}"
+ soft_limit: "1"
+ cap_unit: "TB"
+ state: "{{ state_present }}"
+
+ - name: Modify user quota details from uid -- Idempotency
+ dellemc.unity.user_quota:
+ unispherehost: "{{ unispherehost }}"
+ username: "{{ username }}"
+ password: "{{ password }}"
+ validate_certs: "{{ validate_certs }}"
+ filesystem_id: "{{ filesystem_id }}"
+ uid: "{{ uid }}"
+ soft_limit: "1"
+ cap_unit: "TB"
+ state: "{{ state_present }}"
+
+ - name: Delete user quota
+ dellemc.unity.user_quota:
+ unispherehost: "{{ unispherehost }}"
+ username: "{{ username }}"
+ password: "{{ password }}"
+ validate_certs: "{{ validate_certs }}"
+ filesystem_id: "{{ filesystem_id }}"
+ user_name: "{{ user_name }}"
+ state: "{{ state_absent }}"
+
+ - name: Delete user quota -- Idempotency
+ dellemc.unity.user_quota:
+ unispherehost: "{{ unispherehost }}"
+ username: "{{ username }}"
+ password: "{{ password }}"
+ validate_certs: "{{ validate_certs }}"
+ filesystem_id: "{{ filesystem_id }}"
+ user_name: "{{ user_name }}"
+ state: "{{ state_absent }}"
+
+ - name: Create user quota for a quota tree
+ register: result_user_quota
+ dellemc.unity.user_quota:
+ unispherehost: "{{ unispherehost }}"
+ username: "{{ username }}"
+ password: "{{ password }}"
+ validate_certs: "{{ validate_certs }}"
+ filesystem_name: "{{ filesystem_name }}"
+ nas_server_name: "{{ nas_server_name }}"
+ path: "{{ path }}"
+ user_type: "Unix"
+ user_name: "{{ user_name }}"
+ soft_limit: "1"
+ cap_unit: "TB"
+ hard_limit: "2"
+ state: "{{ state_present }}"
+
+ - name: Set user_quota_id
+ ansible.builtin.set_fact:
+ user_quota_id: "{{ result_user_quota.get_user_quota_details.id }}"
+
+ - name: Create user quota for a quota tree -- Idempotency
+ dellemc.unity.user_quota:
+ unispherehost: "{{ unispherehost }}"
+ username: "{{ username }}"
+ password: "{{ password }}"
+ validate_certs: "{{ validate_certs }}"
+ filesystem_name: "{{ filesystem_name }}"
+ nas_server_name: "{{ nas_server_name }}"
+ path: "{{ path }}"
+ user_type: "Unix"
+ user_name: "{{ user_name }}"
+ soft_limit: "1"
+ cap_unit: "TB"
+ hard_limit: "2"
+ state: "{{ state_present }}"
+
+ - name: Modify user quota for a quota tree by path
+ dellemc.unity.user_quota:
+ unispherehost: "{{ unispherehost }}"
+ username: "{{ username }}"
+ password: "{{ password }}"
+ validate_certs: "{{ validate_certs }}"
+ filesystem_name: "{{ filesystem_name }}"
+ nas_server_name: "{{ nas_server_name }}"
+ path: "{{ path }}"
+ user_type: "Unix"
+ user_name: "{{ user_name }}"
+ soft_limit: "2"
+ cap_unit: "TB"
+ hard_limit: "2"
+ state: "{{ state_present }}"
+
+ - name: Modify user quota for a quota tree by quota tree id
+ dellemc.unity.user_quota:
+ unispherehost: "{{ unispherehost }}"
+ username: "{{ username }}"
+ password: "{{ password }}"
+ validate_certs: "{{ validate_certs }}"
+ filesystem_name: "{{ filesystem_name }}"
+ nas_server_name: "{{ nas_server_name }}"
+ tree_quota_id: "{{ tree_quota_id }}"
+ user_type: "Unix"
+ user_name: "{{ user_name }}"
+ soft_limit: "800"
+ hard_limit: "900"
+ state: "{{ state_present }}"
+
+ - name: Modify user quota for a quota tree by quota tree id -- Idempotency
+ dellemc.unity.user_quota:
+ unispherehost: "{{ unispherehost }}"
+ username: "{{ username }}"
+ password: "{{ password }}"
+ validate_certs: "{{ validate_certs }}"
+ filesystem_name: "{{ filesystem_name }}"
+ nas_server_name: "{{ nas_server_name }}"
+ tree_quota_id: "{{ tree_quota_id }}"
+ user_type: "Unix"
+ user_name: "{{ user_name }}"
+ soft_limit: "800"
+ hard_limit: "900"
+ state: "{{ state_present }}"
+
+ - name: Delete user quota for a quota tree by quota tree id
+ dellemc.unity.user_quota:
+ unispherehost: "{{ unispherehost }}"
+ username: "{{ username }}"
+ password: "{{ password }}"
+ validate_certs: "{{ validate_certs }}"
+ filesystem_name: "{{ filesystem_name }}"
+ nas_server_name: "{{ nas_server_name }}"
+ tree_quota_id: "{{ tree_quota_id }}"
+ user_type: "Unix"
+ user_name: "{{ user_name }}"
+ state: "{{ state_absent }}"
+
+ - name: Delete user quota for a quota tree by path
+ dellemc.unity.user_quota:
+ unispherehost: "{{ unispherehost }}"
+ username: "{{ username }}"
+ password: "{{ password }}"
+ validate_certs: "{{ validate_certs }}"
+ filesystem_name: "{{ filesystem_name }}"
+ nas_server_name: "{{ nas_server_name }}"
+ path: "{{ path }}"
+ user_type: "Unix"
+ user_name: "{{ user_name }}"
+ state: "{{ state_absent }}"
+
+ - name: Delete user quota for a quota tree by path -- Idempotency
+ dellemc.unity.user_quota:
+ unispherehost: "{{ unispherehost }}"
+ username: "{{ username }}"
+ password: "{{ password }}"
+ validate_certs: "{{ validate_certs }}"
+ filesystem_name: "{{ filesystem_name }}"
+ nas_server_name: "{{ nas_server_name }}"
+ path: "{{ path }}"
+ user_type: "Unix"
+ user_name: "{{ user_name }}"
+ state: "{{ state_absent }}"
diff --git a/playbooks/modules/volume.yml b/playbooks/modules/volume.yml
new file mode 100644
index 0000000..45f62c0
--- /dev/null
+++ b/playbooks/modules/volume.yml
@@ -0,0 +1,241 @@
+---
+- name: Volume Operations
+ hosts: localhost
+ connection: local
+ vars:
+ unispherehost: '10.*.*.*'
+ validate_certs: false
+ username: 'user'
+ password: '**'
+ vol_name: "Ansible_vol1_test"
+ new_vol_name: "New_Ansible_vol1_test"
+ size: 2
+ pool_name: "Ansible_Unity_SP_2"
+ cap_gb: "GB"
+ description: "Ansible demo"
+ snap_schedule: "Ansible_vol_snap_schedule1"
+ io_limit_policy: "Ansible_IO_limit1"
+ tiering_policy: "LOWEST"
+ is_thin: true
+ compression: true
+ sp: "SPA"
+ host_name: "10.*.*.*"
+ host_id: "Host_929"
+ vol_hosts:
+ - host_name: "10.*.*.*"
+ hlu: 1
+ - host_id: "Host_929"
+ hlu: 3
+ hlu: 2
+ state_present: "present"
+ state_absent: "absent"
+ state_mapped: "mapped"
+ state_unmapped: "unmapped"
+
+ tasks:
+ - name: Create Volume
+ dellemc.unity.volume:
+ unispherehost: "{{ unispherehost }}"
+ username: "{{ username }}"
+ password: "{{ password }}"
+ validate_certs: "{{ validate_certs }}"
+ vol_name: "{{ vol_name }}"
+ description: "{{ description }}"
+ pool_name: "{{ pool_name }}"
+ size: "{{ size }}"
+ cap_unit: "{{ cap_gb }}"
+ tiering_policy: "{{ tiering_policy }}"
+ is_thin: true
+ compression: true
+ advanced_dedup: true
+ state: "{{ state_present }}"
+ register: vol_result
+
+ - name: Create Volume - Idempotency
+ dellemc.unity.volume:
+ unispherehost: "{{ unispherehost }}"
+ username: "{{ username }}"
+ password: "{{ password }}"
+ validate_certs: "{{ validate_certs }}"
+ vol_name: "{{ vol_name }}"
+ description: "{{ description }}"
+ pool_name: "{{ pool_name }}"
+ size: "{{ size }}"
+ cap_unit: "{{ cap_gb }}"
+ tiering_policy: "{{ tiering_policy }}"
+ is_thin: true
+ compression: true
+ advanced_dedup: true
+ state: "{{ state_present }}"
+
+ - name: Set vol_id
+ ansible.builtin.set_fact:
+ vol_id: "{{ vol_result.volume_details.id }}"
+
+ - name: Expand Volume by volume id
+ dellemc.unity.volume:
+ unispherehost: "{{ unispherehost }}"
+ username: "{{ username }}"
+ password: "{{ password }}"
+ validate_certs: "{{ validate_certs }}"
+ vol_id: "{{ vol_id }}"
+ size: 5
+ cap_unit: "{{ cap_gb }}"
+ state: "{{ state_present }}"
+
+ - name: Modify Volume attributes
+ dellemc.unity.volume:
+ unispherehost: "{{ unispherehost }}"
+ username: "{{ username }}"
+ password: "{{ password }}"
+ validate_certs: "{{ validate_certs }}"
+ vol_name: "{{ vol_name }}"
+ tiering_policy: "AUTOTIER"
+ snap_schedule: "{{ snap_schedule }}"
+ io_limit_policy: "{{ io_limit_policy }}"
+ is_thin: true
+ compression: true
+ advanced_dedup: true
+ state: "{{ state_present }}"
+
+ - name: Modify Volume attributes - Idempotency
+ dellemc.unity.volume:
+ unispherehost: "{{ unispherehost }}"
+ username: "{{ username }}"
+ password: "{{ password }}"
+ validate_certs: "{{ validate_certs }}"
+ vol_name: "{{ vol_name }}"
+ tiering_policy: "AUTOTIER"
+ snap_schedule: "{{ snap_schedule }}"
+ io_limit_policy: "{{ io_limit_policy }}"
+ is_thin: true
+ compression: true
+ advanced_dedup: true
+ state: "{{ state_present }}"
+
+ - name: Remove snap_schedule from a Volume
+ dellemc.unity.volume:
+ unispherehost: "{{ unispherehost }}"
+ username: "{{ username }}"
+ password: "{{ password }}"
+ validate_certs: "{{ validate_certs }}"
+ vol_name: "{{ vol_name }}"
+ snap_schedule: ""
+ state: "{{ state_present }}"
+
+ - name: Map Host by host_name to Volume
+ dellemc.unity.volume:
+ unispherehost: "{{ unispherehost }}"
+ username: "{{ username }}"
+ password: "{{ password }}"
+ validate_certs: "{{ validate_certs }}"
+ vol_id: "{{ vol_id }}"
+ host_name: "{{ host_name }}"
+ hlu: "{{ hlu }}"
+ mapping_state: "{{ state_mapped }}"
+ state: "{{ state_present }}"
+
+ - name: Map Host by host_name to Volume- Idempotency
+ dellemc.unity.volume:
+ unispherehost: "{{ unispherehost }}"
+ username: "{{ username }}"
+ password: "{{ password }}"
+ validate_certs: "{{ validate_certs }}"
+ vol_id: "{{ vol_id }}"
+ host_name: "{{ host_name }}"
+ hlu: 2
+ mapping_state: "{{ state_mapped }}"
+ state: "{{ state_present }}"
+
+ - name: Unmap Host by host_name from Volume
+ dellemc.unity.volume:
+ unispherehost: "{{ unispherehost }}"
+ username: "{{ username }}"
+ password: "{{ password }}"
+ validate_certs: "{{ validate_certs }}"
+ vol_id: "{{ vol_id }}"
+ host_name: "{{ host_name }}"
+ mapping_state: "{{ state_unmapped }}"
+ state: "{{ state_present }}"
+
+ - name: Unmap Host by host_name from Volume -Idempotency
+ dellemc.unity.volume:
+ unispherehost: "{{ unispherehost }}"
+ username: "{{ username }}"
+ password: "{{ password }}"
+ validate_certs: "{{ validate_certs }}"
+ vol_id: "{{ vol_id }}"
+ host_name: "{{ host_name }}"
+ mapping_state: "{{ state_unmapped }}"
+ state: "{{ state_present }}"
+
+ - name: Map Multiple Hosts to a Volume
+ dellemc.unity.volume:
+ unispherehost: "{{ unispherehost }}"
+ username: "{{ username }}"
+ password: "{{ password }}"
+ validate_certs: "{{ validate_certs }}"
+ vol_id: "{{ vol_id }}"
+ hosts: "{{ vol_hosts }}"
+ mapping_state: "{{ state_mapped }}"
+ state: "{{ state_present }}"
+
+ - name: Map Multiple Hosts to a Volume - Idempotency
+ dellemc.unity.volume:
+ unispherehost: "{{ unispherehost }}"
+ username: "{{ username }}"
+ password: "{{ password }}"
+ validate_certs: "{{ validate_certs }}"
+ vol_id: "{{ vol_id }}"
+ hosts: "{{ vol_hosts }}"
+ mapping_state: "{{ state_mapped }}"
+ state: "{{ state_present }}"
+
+ - name: Unmap Hosts from Volume
+ dellemc.unity.volume:
+ unispherehost: "{{ unispherehost }}"
+ username: "{{ username }}"
+ password: "{{ password }}"
+ validate_certs: "{{ validate_certs }}"
+ vol_id: "{{ vol_id }}"
+ hosts: "{{ vol_hosts }}"
+ mapping_state: "{{ state_unmapped }}"
+ state: "{{ state_present }}"
+
+ - name: Unmap Hosts from Volume - Idempotency
+ dellemc.unity.volume:
+ unispherehost: "{{ unispherehost }}"
+ username: "{{ username }}"
+ password: "{{ password }}"
+ validate_certs: "{{ validate_certs }}"
+ vol_id: "{{ vol_id }}"
+ hosts: "{{ vol_hosts }}"
+ mapping_state: "{{ state_unmapped }}"
+ state: "{{ state_present }}"
+
+ - name: Get details of volume using id
+ dellemc.unity.volume:
+ unispherehost: "{{ unispherehost }}"
+ username: "{{ username }}"
+ password: "{{ password }}"
+ validate_certs: "{{ validate_certs }}"
+ vol_id: "{{ vol_id }}"
+ state: "present"
+
+ - name: Delete a volume using id
+ dellemc.unity.volume:
+ unispherehost: "{{ unispherehost }}"
+ username: "{{ username }}"
+ password: "{{ password }}"
+ validate_certs: "{{ validate_certs }}"
+ vol_id: "{{ vol_id }}"
+ state: "absent"
+
+ - name: Delete a volume using id -Idempotency
+ dellemc.unity.volume:
+ unispherehost: "{{ unispherehost }}"
+ username: "{{ username }}"
+ password: "{{ password }}"
+ validate_certs: "{{ validate_certs }}"
+ vol_id: "{{ vol_id }}"
+ state: "absent"
diff --git a/plugins/doc_fragments/unity.py b/plugins/doc_fragments/unity.py
index 1ebc7f4..0df4685 100644
--- a/plugins/doc_fragments/unity.py
+++ b/plugins/doc_fragments/unity.py
@@ -44,7 +44,7 @@ class ModuleDocFragment(object):
default: 443
requirements:
- A Dell Unity Storage device version 5.1 or later.
- - Ansible-core 2.12 or later.
+ - Ansible-core 2.13 or later.
- Python 3.9, 3.10 or 3.11.
- Storops Python SDK 1.2.11.
notes:
diff --git a/plugins/module_utils/storage/dell/utils.py b/plugins/module_utils/storage/dell/utils.py
index c44b2bc..305b79d 100644
--- a/plugins/module_utils/storage/dell/utils.py
+++ b/plugins/module_utils/storage/dell/utils.py
@@ -25,44 +25,6 @@
try:
from storops import UnitySystem
- from storops.unity.client import UnityClient
- from storops.unity.resource import host, cg, snap_schedule, snap, \
- cifs_share, nas_server
- from storops.unity.resource.lun import UnityLun
- from storops.unity.resource.pool import UnityPool, UnityPoolList, RaidGroupParameter
- from storops.unity.resource.filesystem import UnityFileSystem, \
- UnityFileSystemList
- from storops.unity.resource.nas_server import UnityNasServer
- from storops.unity.resource.nfs_share import UnityNfsShare, \
- UnityNfsShareList
- from storops.unity.resource.snap_schedule import UnitySnapScheduleList, \
- UnitySnapSchedule
- from storops.unity.resource.replication_session import UnityReplicationSession
- from storops.unity.enums import HostInitiatorTypeEnum, \
- TieringPolicyEnum, ScheduleTypeEnum, DayOfWeekEnum, NodeEnum, \
- HostLUNAccessEnum, HostTypeEnum, AccessPolicyEnum, \
- FilesystemTypeEnum, FSSupportedProtocolEnum, FSFormatEnum, \
- NFSTypeEnum, NFSShareDefaultAccessEnum, NFSShareSecurityEnum, \
- FilesystemSnapAccessTypeEnum, FSLockingPolicyEnum, \
- CifsShareOfflineAvailabilityEnum, NasServerUnixDirectoryServiceEnum, \
- KdcTypeEnum, NodeEnum, FileInterfaceRoleEnum
- from storops.exception import UnityResourceNotFoundError, \
- StoropsConnectTimeoutError, UnityNfsShareNameExistedError
- from storops.connection.exceptions import HttpError, HTTPClientError
- from storops.unity.resource.user_quota import UnityUserQuota, \
- UnityUserQuotaList
- from storops.unity.resource.tree_quota import UnityTreeQuota, \
- UnityTreeQuotaList
- from storops.unity.resource.quota_config import UnityQuotaConfig, \
- UnityQuotaConfigList
- from storops.unity.resource.storage_resource import UnityStorageResource
- from storops.unity.enums import QuotaPolicyEnum, RaidTypeEnum, \
- RaidStripeWidthEnum, StoragePoolTypeEnum
- from storops.unity.resource.disk import UnityDisk, \
- UnityDiskList, UnityDiskGroup, UnityDiskGroupList
- from storops.unity.resource.cifs_server import UnityCifsServer
- from storops.unity.resource.nfs_server import UnityNfsServer
- from storops.unity.resource.interface import UnityFileInterface
HAS_UNITY_SDK, STOROPS_IMP_ERR = True, None
except ImportError:
diff --git a/plugins/modules/cifsserver.py b/plugins/modules/cifsserver.py
index d40c4f1..01dcf89 100644
--- a/plugins/modules/cifsserver.py
+++ b/plugins/modules/cifsserver.py
@@ -124,7 +124,7 @@
password: "{{password}}"
validate_certs: "{{validate_certs}}"
cifs_server_id: "cifs_37"
- unjoin_cifs_server_account: True
+ unjoin_cifs_server_account: true
domain_username: "domain_username"
domain_password: "domain_password"
state: "absent"
@@ -277,7 +277,7 @@
LOG = utils.get_logger('cifsserver')
-application_type = "Ansible/1.6.0"
+application_type = "Ansible/1.7.0"
class CIFSServer(object):
diff --git a/plugins/modules/consistencygroup.py b/plugins/modules/consistencygroup.py
index 14e4de5..f9e7ce0 100644
--- a/plugins/modules/consistencygroup.py
+++ b/plugins/modules/consistencygroup.py
@@ -321,7 +321,7 @@
replication_type: "remote"
remote_system:
remote_system_host: '10.1.2.3'
- remote_system_verifycert: False
+ remote_system_verifycert: false
remote_system_username: 'username'
remote_system_password: 'password'
destination_pool_name: "pool_test_1"
@@ -494,7 +494,7 @@
LOG = utils.get_logger('consistencygroup',
log_devel=logging.INFO)
-application_type = "Ansible/1.6.0"
+application_type = "Ansible/1.7.0"
class ConsistencyGroup(object):
diff --git a/plugins/modules/filesystem.py b/plugins/modules/filesystem.py
index b10f853..45407c9 100644
--- a/plugins/modules/filesystem.py
+++ b/plugins/modules/filesystem.py
@@ -330,7 +330,7 @@
grace_period: 8
grace_period_unit: "days"
default_soft_limit: 10
- is_user_quota_enabled: False
+ is_user_quota_enabled: false
state: "present"
- name: Expand FileSystem size
@@ -364,9 +364,9 @@
filesystem_name: "ansible_test_fs"
nas_server_name: "lglap761"
smb_properties:
- is_smb_op_locks_enabled: True
+ is_smb_op_locks_enabled: true
smb_notify_on_change_dir_depth: 5
- is_smb_notify_on_access_enabled: True
+ is_smb_notify_on_access_enabled: true
state: "present"
- name: Modify FileSystem Snap Schedule
@@ -411,7 +411,7 @@
rpo: 60
remote_system:
remote_system_host: '0.1.2.3'
- remote_system_verifycert: False
+ remote_system_verifycert: false
remote_system_username: 'username'
remote_system_password: 'password'
destination_pool_name: "pool_test_1"
@@ -689,7 +689,7 @@
LOG = utils.get_logger('filesystem')
-application_type = "Ansible/1.6.0"
+application_type = "Ansible/1.7.0"
class Filesystem(object):
diff --git a/plugins/modules/filesystem_snapshot.py b/plugins/modules/filesystem_snapshot.py
index 35e536a..083205a 100644
--- a/plugins/modules/filesystem_snapshot.py
+++ b/plugins/modules/filesystem_snapshot.py
@@ -122,7 +122,7 @@
filesystem_name: "ansible_test_FS"
nas_server_name: "lglad069"
description: "Created using playbook"
- auto_delete: True
+ auto_delete: true
fs_access_type: "Protocol"
state: "present"
@@ -166,7 +166,7 @@
validate_certs: "{{validate_certs}}"
snapshot_name: "ansible_test_FS_snap"
description: "Description updated"
- auto_delete: False
+ auto_delete: false
expiry_time: "04/15/2021 5:30"
state: "present"
@@ -304,7 +304,7 @@
LOG = utils.get_logger('filesystem_snapshot')
-application_type = "Ansible/1.6.0"
+application_type = "Ansible/1.7.0"
class FilesystemSnapshot(object):
diff --git a/plugins/modules/host.py b/plugins/modules/host.py
index 21a5fba..e4adfc3 100644
--- a/plugins/modules/host.py
+++ b/plugins/modules/host.py
@@ -347,7 +347,7 @@
LOG = utils.get_logger('host')
-application_type = "Ansible/1.6.0"
+application_type = "Ansible/1.7.0"
class Host(object):
diff --git a/plugins/modules/info.py b/plugins/modules/info.py
index e89d863..409b815 100644
--- a/plugins/modules/info.py
+++ b/plugins/modules/info.py
@@ -38,6 +38,7 @@
Get list of CIFS Servers in Unity array.
Get list of Ethernet ports in Unity array.
Get list of File interfaces used in Unity array.
+ Get list of Replication sessions in Unity array.
extends_documentation_fragment:
- dellemc.unity.unity
@@ -54,7 +55,7 @@
for which information is required.
choices: [host, fc_initiator, iscsi_initiator, cg, storage_pool, vol,
snapshot_schedule, nas_server, file_system, snapshot, nfs_export,
- smb_share, user_quota, tree_quota, disk_group, nfs_server, cifs_server, ethernet_port, file_interface]
+ smb_share, user_quota, tree_quota, disk_group, nfs_server, cifs_server, ethernet_port, file_interface, replication_session]
type: list
elements: str
@@ -89,6 +90,7 @@
- cifs_server
- ethernet_port
- file_interface
+ - replication_session
- name: Get information of Unity array
dellemc.unity.info:
@@ -267,6 +269,15 @@
validate_certs: "{{validate_certs}}"
gather_subset:
- file_interface
+
+ - name: Get list of replication sessions on Unity array
+ dellemc.unity.info:
+ unispherehost: "{{unispherehost}}"
+ username: "{{username}}"
+ password: "{{password}}"
+ validate_certs: "{{validate_certs}}"
+ gather_subset:
+ - replication_session
'''
RETURN = r'''
@@ -1213,9 +1224,77 @@
"name": "3_APMXXXXXXXXXX"
}
]
+Replication_sessions:
+ description: Details of the Replication sessions.
+ returned: When Replication sessions exist.
+ type: list
+ contains:
+ id:
+ description: The ID of the Replication session.
+ type: str
+ name:
+ description: The name of the Replication session.
+ type: str
+ sample: [
+ {
+ "current_transfer_est_remain_time": 0,
+ "daily_snap_replication_policy": null,
+ "dst_resource_id": "nas_8",
+ "dst_spa_interface": {
+ "UnityRemoteInterface": {
+ "hash": 8771253398547,
+ "id": "APM00213404195:if_181"
+ }
+ },
+ "dst_spb_interface": {
+ "UnityRemoteInterface": {
+ "hash": 8771253424144,
+ "id": "APM00213404195:if_180"
+ }
+ },
+ "dst_status": "ReplicationSessionStatusEnum.OK",
+ "existed": true,
+ "hash": 8771259012271,
+ "health": {
+ "UnityHealth": {
+ "hash": 8771253424168
+ }
+ },
+ "hourly_snap_replication_policy": null,
+ "id": "103079215114_APM00213404195_0000_103079215274_APM00213404194_0000",
+ "last_sync_time": "2023-04-18 10:35:25+00:00",
+ "local_role": "ReplicationSessionReplicationRoleEnum.DESTINATION",
+ "max_time_out_of_sync": 0,
+ "members": null,
+ "name": "rep_sess_nas",
+ "network_status": "ReplicationSessionNetworkStatusEnum.OK",
+ "remote_system": {
+ "UnityRemoteSystem": {
+ "hash": 8771253380142
+ }
+ },
+ "replication_resource_type": "ReplicationEndpointResourceTypeEnum.NASSERVER",
+ "src_resource_id": "nas_213",
+ "src_spa_interface": {
+ "UnityRemoteInterface": {
+ "hash": 8771253475010,
+ "id": "APM00213404194:if_195"
+ }
+ },
+ "src_spb_interface": {
+ "UnityRemoteInterface": {
+ "hash": 8771253374169,
+ "id": "APM00213404194:if_194"
+ }
+ },
+ "src_status": "ReplicationSessionStatusEnum.OK",
+ "status": "ReplicationOpStatusEnum.ACTIVE",
+ "sync_progress": 0,
+ "sync_state": "ReplicationSessionSyncStateEnum.IN_SYNC"
+ },
+ ]
'''
-from re import sub
from ansible.module_utils.basic import AnsibleModule
from ansible_collections.dellemc.unity.plugins.module_utils.storage.dell \
import utils
@@ -1223,7 +1302,7 @@
LOG = utils.get_logger('info')
SUCCESSFULL_LISTED_MSG = 'Successfully listed.'
-application_type = "Ansible/1.6.0"
+application_type = "Ansible/1.7.0"
class Info(object):
@@ -1549,6 +1628,20 @@ def get_file_interface_list(self):
LOG.error(msg)
self.module.fail_json(msg=msg)
+ def get_replication_session_list(self):
+ """Get the list of replication sessions on a given Unity storage system"""
+
+ try:
+ LOG.info("Getting replication sessions list")
+ replication_sessions = self.unity.get_replication_session()
+ return result_list(replication_sessions)
+
+ except Exception as e:
+ msg = 'Get replication session list from unity array failed with' \
+ ' error %s' % (str(e))
+ LOG.error(msg)
+ self.module.fail_json(msg=msg)
+
def perform_module_operation(self):
""" Perform different actions on Info based on user parameter
chosen in playbook """
@@ -1575,6 +1668,7 @@ def perform_module_operation(self):
cifs_server = []
ethernet_port = []
file_interface = []
+ replication_session = []
subset = self.module.params['gather_subset']
if subset is not None:
@@ -1616,6 +1710,8 @@ def perform_module_operation(self):
ethernet_port = self.get_ethernet_port_list()
if 'file_interface' in subset:
file_interface = self.get_file_interface_list()
+ if 'replication_session' in subset:
+ replication_session = self.get_replication_session_list()
self.module.exit_json(
Array_Details=array_details,
@@ -1637,7 +1733,8 @@ def perform_module_operation(self):
NFS_Servers=nfs_server,
CIFS_Servers=cifs_server,
Ethernet_ports=ethernet_port,
- File_interfaces=file_interface
+ File_interfaces=file_interface,
+ Replication_sessions=replication_session
)
@@ -1770,7 +1867,7 @@ def get_info_parameters():
'file_system', 'snapshot',
'nfs_export', 'smb_share',
'user_quota', 'tree_quota', 'disk_group', 'nfs_server', 'cifs_server',
- 'ethernet_port', 'file_interface']))
+ 'ethernet_port', 'file_interface', 'replication_session']))
def main():
diff --git a/plugins/modules/interface.py b/plugins/modules/interface.py
index 95ddfd2..21538d3 100644
--- a/plugins/modules/interface.py
+++ b/plugins/modules/interface.py
@@ -227,7 +227,7 @@
LOG = utils.get_logger('interface')
-application_type = "Ansible/1.6.0"
+application_type = "Ansible/1.7.0"
class Interface(object):
diff --git a/plugins/modules/nasserver.py b/plugins/modules/nasserver.py
index 713125c..7f26046 100644
--- a/plugins/modules/nasserver.py
+++ b/plugins/modules/nasserver.py
@@ -225,15 +225,15 @@
validate_certs: "{{validate_certs}}"
nas_server_name: "{{nas_server_name}}"
nas_server_new_name: "updated_sample_nas_server"
- is_replication_destination: False
- is_backup_only: False
- is_multiprotocol_enabled: True
- allow_unmapped_user: True
+ is_replication_destination: false
+ is_backup_only: false
+ is_multiprotocol_enabled: true
+ allow_unmapped_user: true
default_unix_user: "default_unix_sample_user"
default_windows_user: "default_windows_sample_user"
- enable_windows_to_unix_username_mapping: True
+ enable_windows_to_unix_username_mapping: true
current_unix_directory_service: "LDAP"
- is_packet_reflect_enabled: True
+ is_packet_reflect_enabled: true
state: "present"
- name: Enable replication for NAS Server on Local System
@@ -243,7 +243,7 @@
password: "{{password}}"
validate_certs: "{{validate_certs}}"
nas_server_id: "nas_10"
- replication_reuse_resource: False
+ replication_reuse_resource: false
replication_params:
replication_name: "test_replication"
destination_nas_server_name: "destination_nas"
@@ -252,7 +252,7 @@
replication_type: "local"
destination_pool_name: "Pool_Ansible_Neo_DND"
destination_sp: "SPA"
- is_backup: True
+ is_backup: true
replication_state: "enable"
state: "present"
@@ -263,7 +263,7 @@
password: "{{password}}"
validate_certs: "{{validate_certs}}"
nas_server_name: "dummy_nas"
- replication_reuse_resource: False
+ replication_reuse_resource: false
replication_params:
replication_name: "test_replication"
destination_nas_server_name: "destination_nas"
@@ -272,12 +272,12 @@
replication_type: "remote"
remote_system:
remote_system_host: '10.10.10.10'
- remote_system_verifycert: False
+ remote_system_verifycert: false
remote_system_username: 'test1'
remote_system_password: 'test1!'
destination_pool_name: "fastVP_pool"
destination_sp: "SPA"
- is_backup: True
+ is_backup: true
replication_state: "enable"
state: "present"
@@ -288,7 +288,7 @@
password: "{{password}}"
validate_certs: "{{validate_certs}}"
nas_server_name: "dummy_nas"
- replication_reuse_resource: True
+ replication_reuse_resource: true
replication_params:
destination_nas_server_name: "destination_nas"
replication_mode: "asynchronous"
@@ -297,7 +297,7 @@
replication_name: "test_replication"
remote_system:
remote_system_host: '10.10.10.10'
- remote_system_verifycert: False
+ remote_system_verifycert: false
remote_system_username: 'test1'
remote_system_password: 'test1!'
destination_pool_name: "fastVP_pool"
@@ -347,7 +347,7 @@
description: Whether or not the resource has changed.
returned: always
type: bool
- sample: True
+ sample: true
nas_server_details:
description: The NAS server details.
type: dict
@@ -388,7 +388,7 @@
type: bool
is_replication_destination:
description: If the NAS server is a replication destination
- then True.
+ then true.
type: bool
is_windows_to_unix_username_mapping_enabled:
description: Indicates whether a Unix to/from Windows user name
@@ -482,7 +482,7 @@
import utils
LOG = utils.get_logger('nasserver')
-application_type = "Ansible/1.6.0"
+application_type = "Ansible/1.7.0"
class NASServer(object):
diff --git a/plugins/modules/nfs.py b/plugins/modules/nfs.py
index e622306..c27344c 100644
--- a/plugins/modules/nfs.py
+++ b/plugins/modules/nfs.py
@@ -568,7 +568,7 @@
'root_access_hosts': None,
'snap': None,
'type': 'NFSTypeEnum.NFS_SHARE',
- 'existed': True,
+ 'existed': true,
'nas_server': {
'UnityNasServer': {
'id': 'nas_id_1',
@@ -607,7 +607,7 @@
HOST_STATE_LIST = ['present-in-export', 'absent-in-export']
STATE_LIST = ['present', 'absent']
-application_type = "Ansible/1.6.0"
+application_type = "Ansible/1.7.0"
class NFS(object):
diff --git a/plugins/modules/nfsserver.py b/plugins/modules/nfsserver.py
index e492e3a..2ede27d 100644
--- a/plugins/modules/nfsserver.py
+++ b/plugins/modules/nfsserver.py
@@ -92,12 +92,12 @@
validate_certs: "{{validate_certs}}"
nas_server_name: "dummy_nas"
host_name: "dummy_nas23"
- is_secure_enabled: True
+ is_secure_enabled: true
kerberos_domain_controller_type: "WINDOWS"
kerberos_domain_controller_username: "administrator"
kerberos_domain_controller_password: "Password123!"
- is_extended_credentials_enabled: True
- nfs_v4_enabled: True
+ is_extended_credentials_enabled: true
+ nfs_v4_enabled: true
state: "present"
- name: Create NFS server with kdctype as Unix
@@ -108,10 +108,10 @@
validate_certs: "{{validate_certs}}"
nas_server_name: "dummy_nas"
host_name: "dummy_nas23"
- is_secure_enabled: True
+ is_secure_enabled: true
kerberos_domain_controller_type: "UNIX"
- is_extended_credentials_enabled: True
- nfs_v4_enabled: True
+ is_extended_credentials_enabled: true
+ nfs_v4_enabled: true
state: "present"
- name: Get NFS server details
@@ -132,7 +132,7 @@
nas_server_name: "dummy_nas"
kerberos_domain_controller_username: "administrator"
kerberos_domain_controller_password: "Password123!"
- unjoin_server_account: False
+ unjoin_server_account: false
state: "absent"
'''
@@ -209,7 +209,7 @@
LOG = utils.get_logger('nfsserver')
-application_type = "Ansible/1.6.0"
+application_type = "Ansible/1.7.0"
class NFSServer(object):
diff --git a/plugins/modules/replication_session.py b/plugins/modules/replication_session.py
new file mode 100644
index 0000000..20907d5
--- /dev/null
+++ b/plugins/modules/replication_session.py
@@ -0,0 +1,551 @@
+#!/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)
+
+"""Ansible module for managing replication session on Unity"""
+
+from __future__ import absolute_import, division, print_function
+
+__metaclass__ = type
+
+DOCUMENTATION = r"""
+
+module: replication_session
+version_added: '1.7.0'
+short_description: Manage replication session on Unity storage system
+description:
+- Managing replication session on Unity storage system includes getting details, pause,
+ resume, sync, failover, failback and deleting the replication session.
+
+extends_documentation_fragment:
+ - dellemc.unity.unity
+
+author:
+- Jennifer John (@Jennifer-John)
+
+options:
+ session_id:
+ description:
+ - ID of replication session.
+ type: str
+ session_name:
+ description:
+ - Name of replication session.
+ type: str
+ pause:
+ description:
+ - Pause or resume replication session.
+ type: bool
+ sync:
+ description:
+ - Sync a replication session.
+ type: bool
+ failover_with_sync:
+ description:
+ - If C(true), Sync the source and destination resources before failing over the asynchronous
+ replication session or keep them in sync after failing over the synchronous
+ replication session.
+ - If C(false), Failover a replication session.
+ type: bool
+ failback:
+ description:
+ - Failback a replication session.
+ type: bool
+ force_full_copy:
+ description:
+ - Indicates whether to sync back all data from the destination SP to the source
+ SP during the failback session. Needed during resume operation when replication
+ session goes out of sync due to a fault.
+ type: bool
+ force:
+ description:
+ - Skip pre-checks on file system(s) replication sessions of a NAS server when a
+ replication failover is issued from the source NAS server.
+ type: bool
+ state:
+ description:
+ - State variable to determine whether replication session will exist or not.
+ choices: ['absent', 'present']
+ default: present
+ type: str
+
+notes:
+ - The I(check_mode) is supported.
+"""
+
+EXAMPLES = r"""
+- name: Get replication session details
+ dellemc.unity.replication_session:
+ unispherehost: "{{unispherehost}}"
+ username: "{{username}}"
+ password: "{{password}}"
+ validate_certs: "{{validate_certs}}"
+ session_name: "fs_replication"
+
+- name: Get replication session details based on session_id
+ dellemc.unity.replication_session:
+ unispherehost: "{{unispherehost}}"
+ username: "{{username}}"
+ password: "{{password}}"
+ validate_certs: "{{validate_certs}}"
+ session_id: "103079215114_APM00213404195_0000_103079215274_APM00213404194_0000"
+
+- name: Pause a replication session
+ dellemc.unity.replication_session:
+ unispherehost: "{{unispherehost}}"
+ username: "{{username}}"
+ password: "{{password}}"
+ validate_certs: "{{validate_certs}}"
+ session_name: "fs_replication"
+ pause: true
+
+- name: Resume a replication session
+ dellemc.unity.replication_session:
+ unispherehost: "{{unispherehost}}"
+ username: "{{username}}"
+ password: "{{password}}"
+ validate_certs: "{{validate_certs}}"
+ session_name: "fs_replication"
+ pause: false
+ force_full_copy: true
+
+- name: Sync a replication session
+ dellemc.unity.replication_session:
+ unispherehost: "{{unispherehost}}"
+ username: "{{username}}"
+ password: "{{password}}"
+ validate_certs: "{{validate_certs}}"
+ session_name: "fs_replication"
+ sync: true
+
+- name: Failover with sync a replication session
+ dellemc.unity.replication_session:
+ unispherehost: "{{unispherehost}}"
+ username: "{{username}}"
+ password: "{{password}}"
+ validate_certs: "{{validate_certs}}"
+ session_name: "fs_replication"
+ failover_with_sync: true
+ force: true
+
+- name: Failover a replication session
+ dellemc.unity.replication_session:
+ unispherehost: "{{unispherehost}}"
+ username: "{{username}}"
+ password: "{{password}}"
+ validate_certs: "{{validate_certs}}"
+ session_name: "fs_replication"
+ failover_with_sync: false
+
+- name: Failback a replication session
+ dellemc.unity.replication_session:
+ unispherehost: "{{unispherehost}}"
+ username: "{{username}}"
+ password: "{{password}}"
+ validate_certs: "{{validate_certs}}"
+ session_name: "fs_replication"
+ failback: true
+ force_full_copy: true
+
+- name: Delete a replication session
+ dellemc.unity.replication_session:
+ unispherehost: "{{unispherehost}}"
+ username: "{{username}}"
+ password: "{{password}}"
+ validate_certs: "{{validate_certs}}"
+ session_name: "fs_replication"
+ state: "absent"
+"""
+
+RETURN = r'''
+
+changed:
+ description: Whether or not the resource has changed.
+ returned: always
+ type: bool
+ sample: true
+
+replication_session_details:
+ description: Details of the replication session.
+ returned: When replication session exists.
+ type: dict
+ contains:
+ id:
+ description: Unique identifier of the replicationSession instance.
+ type: str
+ name:
+ description: User-specified replication session name.
+ type: str
+ replicationResourceType:
+ description: Replication resource type of replication session endpoints.
+ type: str
+ status:
+ description: Replication status of the replication session.
+ type: str
+ remoteSystem:
+ description: Specifies the remote system to use as the destination for the replication session.
+ type: dict
+ contains:
+ UnityRemoteSystem:
+ description: Information about remote storage system.
+ type: dict
+ contains:
+ id:
+ description: Unique identifier of the remote system instance.
+ type: str
+ serialNumber:
+ description: Serial number of the remote system.
+ type: str
+ maxTimeOutOfSync:
+ description: Maximum time to wait before the system syncs the source and destination resources.
+ type: int
+ srcStatus:
+ description: Status of the source end of the session.
+ type: str
+ networkStatus:
+ description: Status of the network connection used by the replication session.
+ type: str
+ dstStatus:
+ description: Status of the destination end of the replication session.
+ type: str
+ lastSyncTime:
+ description: Date and time of the last replication synchronization.
+ type: str
+ syncState:
+ description: Synchronization state between source and destination resource of the replication session.
+ type: str
+ syncProgress:
+ description: Synchronization completion percentage between source and destination resources of the replication session.
+ type: int
+ dstResourceId:
+ description: Identifier of the destination resource.
+ type: str
+ currentTransferEstRemainTime:
+ description: Estimated time left for the replication synchronization to complete.
+ type: int
+ sample: {
+ "current_transfer_est_remain_time": 0,
+ "daily_snap_replication_policy": null,
+ "dst_resource_id": "nas_8",
+ "dst_spa_interface": {
+ "UnityRemoteInterface": {
+ "hash": 8771253398547,
+ "id": "APM00213404195:if_181"
+ }
+ },
+ "dst_spb_interface": {
+ "UnityRemoteInterface": {
+ "hash": 8771253424144,
+ "id": "APM00213404195:if_180"
+ }
+ },
+ "dst_status": "ReplicationSessionStatusEnum.OK",
+ "existed": true,
+ "hash": 8771259012271,
+ "health": {
+ "UnityHealth": {
+ "hash": 8771253424168
+ }
+ },
+ "hourly_snap_replication_policy": null,
+ "id": "103079215114_APM00213404195_0000_103079215274_APM00213404194_0000",
+ "last_sync_time": "2023-04-18 10:35:25+00:00",
+ "local_role": "ReplicationSessionReplicationRoleEnum.DESTINATION",
+ "max_time_out_of_sync": 0,
+ "members": null,
+ "name": "rep_sess_nas",
+ "network_status": "ReplicationSessionNetworkStatusEnum.OK",
+ "remote_system": {
+ "UnityRemoteSystem": {
+ "hash": 8771253380142
+ }
+ },
+ "replication_resource_type": "ReplicationEndpointResourceTypeEnum.NASSERVER",
+ "src_resource_id": "nas_213",
+ "src_spa_interface": {
+ "UnityRemoteInterface": {
+ "hash": 8771253475010,
+ "id": "APM00213404194:if_195"
+ }
+ },
+ "src_spb_interface": {
+ "UnityRemoteInterface": {
+ "hash": 8771253374169,
+ "id": "APM00213404194:if_194"
+ }
+ },
+ "src_status": "ReplicationSessionStatusEnum.OK",
+ "status": "ReplicationOpStatusEnum.ACTIVE",
+ "sync_progress": 0,
+ "sync_state": "ReplicationSessionSyncStateEnum.IN_SYNC"
+ }
+'''
+
+from ansible.module_utils.basic import AnsibleModule
+from ansible_collections.dellemc.unity.plugins.module_utils.storage.dell \
+ import utils
+
+LOG = utils.get_logger('replication_session')
+
+application_type = "Ansible/1.7.0"
+
+
+class ReplicationSession(object):
+
+ """Class with replication session operations"""
+
+ def __init__(self):
+ """Define all parameters required by this module"""
+ self.module_params = utils.get_unity_management_host_parameters()
+ self.module_params.update(get_replication_session_parameters())
+
+ mutually_exclusive = [['session_id', 'session_name']]
+
+ required_one_of = [['session_id', 'session_name']]
+
+ # initialize the Ansible module
+ self.module = AnsibleModule(
+ argument_spec=self.module_params,
+ supports_check_mode=True,
+ mutually_exclusive=mutually_exclusive,
+ required_one_of=required_one_of)
+ utils.ensure_required_libs(self.module)
+ self.result = dict(
+ changed=False,
+ replication_session_details={}
+ )
+
+ self.unity_conn = utils.get_unity_unisphere_connection(
+ self.module.params, application_type)
+ LOG.info('Check Mode Flag %s', self.module.check_mode)
+
+ def get_replication_session(self, id=None, name=None):
+ """Get the details of a replication session.
+ :param id: The id of the replication session
+ :param name: The name of the replication session
+ :return: instance of the replication session if exist.
+ """
+
+ id_or_name = id if id else name
+ errormsg = f"Retrieving details of replication session {id_or_name} failed with error"
+
+ try:
+ obj_replication_session = self.unity_conn.get_replication_session(name=name, _id=id)
+
+ LOG.info("Successfully retrieved the replication session object %s ", obj_replication_session)
+ if obj_replication_session.existed:
+ return obj_replication_session
+ except utils.HttpError as e:
+ if e.http_status == 401:
+ self.module.fail_json(msg=f"Incorrect username or password {str(e)}")
+ else:
+ msg = f"{errormsg} {str(e)}"
+ self.module.fail_json(msg=msg)
+ except utils.UnityResourceNotFoundError as e:
+ msg = f"{errormsg} {str(e)}"
+ LOG.error(msg)
+ return None
+ except Exception as e:
+ msg = f"{errormsg} {str(e)}"
+ LOG.error(msg)
+ self.module.fail_json(msg=msg)
+
+ def pause(self, session_obj):
+ """Pause the replication session.
+ :param session_obj: Replication session object
+ :return: True if pause is successful.
+ """
+ try:
+ LOG.info("Pause replication session %s", session_obj.name)
+ if session_obj.status.name != utils.ReplicationOpStatusEnum.PAUSED.name:
+ if not self.module.check_mode:
+ session_obj.pause()
+ return True
+ except Exception as e:
+ msg = f"Pause replication session {session_obj.name} failed with error {str(e)}"
+ LOG.error(msg)
+ self.module.fail_json(msg=msg)
+
+ def resume(self, session_obj, force_full_copy):
+ """Resume the replication session.
+ :param session_obj: Replication session object
+ :param force_full_copy: needed when replication session goes out of sync due to a fault.
+ :return: True if resume is successful.
+ """
+ try:
+ LOG.info("Resume replication session %s", session_obj.name)
+ if session_obj.status.name in (utils.ReplicationOpStatusEnum.PAUSED.name,
+ utils.ReplicationOpStatusEnum.FAILED_OVER.name,
+ utils.ReplicationOpStatusEnum.FAILED_OVER_WITH_SYNC.name):
+ if not self.module.check_mode:
+ session_obj.resume(force_full_copy=force_full_copy)
+ return True
+ except Exception as e:
+ msg = f"Resume replication session {session_obj.name} failed with error {str(e)}"
+ LOG.error(msg)
+ self.module.fail_json(msg=msg)
+
+ def sync(self, session_obj):
+ """Sync the replication session.
+ :param session_obj: Replication session object
+ :return: True if sync is successful.
+ """
+ try:
+ LOG.info("Sync replication session %s", session_obj.name)
+ if not self.module.check_mode:
+ session_obj.sync()
+ return True
+ except Exception as e:
+ msg = f"Sync replication session {session_obj.name} failed with error {str(e)}"
+ LOG.error(msg)
+ self.module.fail_json(msg=msg)
+
+ def failover(self, session_obj, sync_failover, force):
+ """Failover the replication session.
+ :param session_obj: Replication session object
+ :param sync_failover: To sync the source and destination resources
+ :param force: Skip pre-checks on file system(s) replication sessions of a NAS server
+ :return: True if failover is successful.
+ """
+ try:
+ LOG.info("Failover replication session %s", session_obj.name)
+ if (sync_failover and session_obj.status.name != utils.ReplicationOpStatusEnum.FAILED_OVER_WITH_SYNC.name) or \
+ (not sync_failover and session_obj.status.name != utils.ReplicationOpStatusEnum.FAILED_OVER.name):
+ if not self.module.check_mode:
+ session_obj.failover(sync=sync_failover, force=force)
+ return True
+ except Exception as e:
+ msg = f"Failover replication session {session_obj.name} failed with error {str(e)}"
+ LOG.error(msg)
+ self.module.fail_json(msg=msg)
+
+ def failback(self, session_obj, force_full_copy):
+ """Failback the replication session.
+ :param session_obj: Replication session object
+ :param force_full_copy: needed when replication session goes out of sync due to a fault.
+ :return: True if failback is successful.
+ """
+ try:
+ LOG.info("Failback replication session %s", session_obj.name)
+ if session_obj.status.name in (utils.ReplicationOpStatusEnum.FAILED_OVER.name,
+ utils.ReplicationOpStatusEnum.FAILED_OVER_WITH_SYNC.name,
+ utils.ReplicationOpStatusEnum.PAUSED.name):
+ if not self.module.check_mode:
+ session_obj.failback(force_full_copy=force_full_copy)
+ return True
+ except Exception as e:
+ msg = f"Failback replication session {session_obj.name} failed with error {str(e)}"
+ LOG.error(msg)
+ self.module.fail_json(msg=msg)
+
+ def delete(self, session_obj):
+ """Delete the replication session.
+ :param session_obj: Replication session object
+ :return: True if delete is successful.
+ """
+ try:
+ LOG.info("Delete replication session %s", session_obj.name)
+ if not self.module.check_mode:
+ session_obj.delete()
+ return True
+ except Exception as e:
+ msg = f"Deleting replication session {session_obj.name} failed with error {str(e)}"
+ LOG.error(msg)
+ self.module.fail_json(msg=msg)
+
+
+def get_replication_session_parameters():
+ """This method provide parameters required for the ansible replication session
+ module on Unity"""
+ return dict(
+ session_id=dict(type='str'), session_name=dict(type='str'),
+ pause=dict(type='bool'), sync=dict(type='bool'),
+ force=dict(type='bool'), failover_with_sync=dict(type='bool'),
+ failback=dict(type='bool'), force_full_copy=dict(type='bool'),
+ state=dict(type='str', choices=['present', 'absent'], default='present')
+ )
+
+
+class ReplicationSessionFailoverHandler():
+ def handle(self, session_object, session_params, replication_session_obj):
+ if replication_session_obj and session_params['state'] == 'present' and session_params['failover_with_sync'] is not None:
+ session_object.result['changed'] = \
+ session_object.failover(replication_session_obj, session_params['failover_with_sync'], session_params['force']) or False
+ if session_object.result['changed']:
+ replication_session_obj = session_object.get_replication_session(session_params['session_id'], session_params['session_name'])
+ ReplicationSessionFailbackHandler().handle(session_object, session_params, replication_session_obj)
+
+
+class ReplicationSessionFailbackHandler():
+ def handle(self, session_object, session_params, replication_session_obj):
+ if replication_session_obj and session_params['state'] == 'present' and session_params['failback']:
+ session_object.result['changed'] = \
+ session_object.failback(replication_session_obj, session_params['force_full_copy']) or False
+ if session_object.result['changed']:
+ replication_session_obj = session_object.get_replication_session(session_params['session_id'], session_params['session_name'])
+ ReplicationSessionDeleteHandler().handle(session_object, session_params, replication_session_obj)
+
+
+class ReplicationSessionSyncHandler():
+ def handle(self, session_object, session_params, replication_session_obj):
+ if replication_session_obj and session_params['state'] == 'present' and session_params['sync']:
+ session_object.result['changed'] = session_object.sync(replication_session_obj)
+ if session_object.result['changed']:
+ replication_session_obj = session_object.get_replication_session(session_params['session_id'], session_params['session_name'])
+ ReplicationSessionFailoverHandler().handle(session_object, session_params, replication_session_obj)
+
+
+class ReplicationSessionDeleteHandler():
+ def handle(self, session_object, session_params, replication_session_obj):
+ if replication_session_obj and session_params['state'] == 'absent':
+ session_object.result['changed'] = session_object.delete(replication_session_obj)
+ if session_object.result['changed']:
+ replication_session_obj = session_object.get_replication_session(session_params['session_id'], session_params['session_name'])
+ ReplicationSessionExitHandler().handle(session_object, replication_session_obj)
+
+
+class ReplicationSessionExitHandler():
+ def handle(self, session_object, replication_session_obj):
+ if replication_session_obj:
+ session_object.result['replication_session_details'] = replication_session_obj._get_properties()
+ session_object.module.exit_json(**session_object.result)
+
+
+class ReplicationSessionResumeHandler():
+ def handle(self, session_object, session_params, replication_session_obj):
+ if replication_session_obj and session_params['state'] == 'present' and session_params['pause'] is False:
+ session_object.result['changed'] = \
+ session_object.resume(replication_session_obj, session_params['force_full_copy']) or False
+ if session_object.result['changed']:
+ replication_session_obj = session_object.get_replication_session(session_params['session_id'], session_params['session_name'])
+ ReplicationSessionSyncHandler().handle(session_object, session_params, replication_session_obj)
+
+
+class ReplicationSessionPauseHandler():
+ def handle(self, session_object, session_params, replication_session_obj):
+ if replication_session_obj and session_params['state'] == 'present' and session_params['pause']:
+ session_object.result['changed'] = \
+ session_object.pause(replication_session_obj) or False
+ if session_object.result['changed']:
+ replication_session_obj = session_object.get_replication_session(session_params['session_id'], session_params['session_name'])
+ ReplicationSessionResumeHandler().handle(session_object, session_params, replication_session_obj)
+
+
+class ReplicationSessionHandler():
+ def handle(self, session_object, session_params):
+ replication_session_obj = session_object.get_replication_session(session_params['session_id'], session_params['session_name'])
+ if session_params['state'] == 'present' and not replication_session_obj:
+ session_object.module.fail_json(msg=f"Replication session {session_params['session_id'] or session_params['session_name']} is invalid.")
+ ReplicationSessionPauseHandler().handle(session_object, session_params, replication_session_obj)
+
+
+def main():
+ """ Create Unity replication session object and perform action on it
+ based on user input from playbook"""
+ obj = ReplicationSession()
+ ReplicationSessionHandler().handle(obj, obj.module.params)
+
+
+if __name__ == '__main__':
+ main()
diff --git a/plugins/modules/smbshare.py b/plugins/modules/smbshare.py
index 58bc8c7..c9467a2 100644
--- a/plugins/modules/smbshare.py
+++ b/plugins/modules/smbshare.py
@@ -150,11 +150,11 @@
nas_server_id: "NAS_11"
path: "/sample_fs"
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
umask: "777"
state: "present"
- name: Modify Attributes of SMB share for a filesystem
@@ -166,11 +166,11 @@
share_name: "sample_smb_share"
nas_server_name: "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
@@ -184,10 +184,10 @@
nas_server_id: "NAS_11"
path: "/sample_snapshot"
description: "Sample SMB share created for snapshot"
- is_abe_enabled: True
- is_branch_cache_enabled: True
- is_continuous_availability_enabled: True
- is_encryption_enabled: True
+ is_abe_enabled: true
+ is_branch_cache_enabled: true
+ is_continuous_availability_enabled: true
+ is_encryption_enabled: true
umask: "777"
state: "present"
- name: Modify Attributes of SMB share for a snapshot
@@ -199,11 +199,11 @@
share_name: "sample_snap_smb_share"
snapshot_name: "sample_snapshot"
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_encryption_enabled: "False"
+ is_continuous_availability_enabled: "false"
+ is_encryption_enabled: "false"
umask: "022"
state: "present"
- name: Get details of SMB share
@@ -229,7 +229,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.
type: dict
@@ -325,7 +325,7 @@
LOG = utils.get_logger('smbshare')
-application_type = "Ansible/1.6.0"
+application_type = "Ansible/1.7.0"
class SMBShare(object):
diff --git a/plugins/modules/snapshot.py b/plugins/modules/snapshot.py
index c8aba18..1f7d71c 100644
--- a/plugins/modules/snapshot.py
+++ b/plugins/modules/snapshot.py
@@ -122,7 +122,7 @@
cg_name: "{{cg_name}}"
snapshot_name: "{{cg_snapshot_name}}"
description: "{{description}}"
- auto_delete: False
+ auto_delete: false
state: "present"
- name: Create a Snapshot for a volume with Host attached
@@ -257,7 +257,6 @@
}
'''
-import logging
from ansible.module_utils.basic import AnsibleModule
from ansible_collections.dellemc.unity.plugins.module_utils.storage.dell \
import utils
@@ -265,7 +264,7 @@
LOG = utils.get_logger('snapshot')
-application_type = "Ansible/1.6.0"
+application_type = "Ansible/1.7.0"
class Snapshot(object):
diff --git a/plugins/modules/snapshotschedule.py b/plugins/modules/snapshotschedule.py
index aba5524..7b1021c 100644
--- a/plugins/modules/snapshotschedule.py
+++ b/plugins/modules/snapshotschedule.py
@@ -144,7 +144,7 @@
hours_of_day:
- 8
- 14
- auto_delete: True
+ auto_delete: true
state: "{{state_present}}"
- name: Create snapshot schedule (Rule Type - every_n_days)
@@ -185,7 +185,7 @@
name: "Ansible_Every_Month_Testing"
type: "every_month"
day_of_month: 17
- auto_delete: True
+ auto_delete: true
state: "{{state_present}}"
- name: Get snapshot schedule details using name
@@ -226,7 +226,7 @@
name: "Ansible_Every_Day_Testing"
type: "every_day"
desired_retention: 200
- auto_delete: False
+ auto_delete: false
state: "{{state_present}}"
- name: Delete snapshot schedule using id
@@ -253,7 +253,7 @@
description: Whether or not the resource has changed.
returned: always
type: bool
- sample: True
+ sample: true
snapshot_schedule_details:
description: Details of the snapshot schedule.
@@ -385,14 +385,13 @@
}
"""
-import logging
from ansible.module_utils.basic import AnsibleModule
from ansible_collections.dellemc.unity.plugins.module_utils.storage.dell \
import utils
LOG = utils.get_logger('snapshotschedule')
-application_type = "Ansible/1.6.0"
+application_type = "Ansible/1.7.0"
class SnapshotSchedule(object):
diff --git a/plugins/modules/storagepool.py b/plugins/modules/storagepool.py
index ddb7eef..b02ab64 100644
--- a/plugins/modules/storagepool.py
+++ b/plugins/modules/storagepool.py
@@ -217,10 +217,10 @@
raid_type : "RAID10"
stripe_width : "BEST_FIT"
alert_threshold : 50
- is_harvest_enabled : True
+ is_harvest_enabled : true
pool_harvest_high_threshold : 60
pool_harvest_low_threshold : 40
- is_snap_harvest_enabled : True
+ is_snap_harvest_enabled : true
snap_harvest_high_threshold : 70
snap_harvest_low_threshold : 50
fast_vp: "enabled"
@@ -235,7 +235,7 @@
description: Whether or not the storage pool has changed.
returned: always
type: bool
- sample: True
+ sample: true
storage_pool_details:
description: The storage pool details.
@@ -464,11 +464,10 @@
from ansible.module_utils.basic import AnsibleModule
from ansible_collections.dellemc.unity.plugins.module_utils.storage.dell \
import utils
-import logging
LOG = utils.get_logger('storagepool')
-application_type = "Ansible/1.6.0"
+application_type = "Ansible/1.7.0"
class StoragePool(object):
@@ -499,7 +498,9 @@ def get_details(self, pool_id=None, pool_name=None):
details = api_response._get_properties()
is_fast_vp_enabled = api_response._get_property_from_raw(
- 'pool_fast_vp').is_schedule_enabled
+ 'pool_fast_vp')
+ if is_fast_vp_enabled:
+ is_fast_vp_enabled = is_fast_vp_enabled.is_schedule_enabled
details['is_fast_vp_enabled'] = is_fast_vp_enabled
details['size_free_with_unit'] = utils.\
diff --git a/plugins/modules/tree_quota.py b/plugins/modules/tree_quota.py
index 063834b..8eabc67 100644
--- a/plugins/modules/tree_quota.py
+++ b/plugins/modules/tree_quota.py
@@ -199,7 +199,7 @@
description: Whether or not the resource has changed.
returned: always
type: bool
- sample: True
+ sample: true
get_tree_quota_details:
description: Details of the quota tree.
@@ -283,7 +283,7 @@
LOG = utils.get_logger('tree_quota')
-application_type = "Ansible/1.6.0"
+application_type = "Ansible/1.7.0"
class QuotaTree(object):
diff --git a/plugins/modules/user_quota.py b/plugins/modules/user_quota.py
index d9116c3..c68947b 100644
--- a/plugins/modules/user_quota.py
+++ b/plugins/modules/user_quota.py
@@ -294,7 +294,7 @@
description: Whether or not the resource has changed.
returned: always
type: bool
- sample: True
+ sample: true
get_user_quota_details:
description: Details of the user quota.
@@ -427,7 +427,7 @@
LOG = utils.get_logger('user_quota')
-application_type = "Ansible/1.6.0"
+application_type = "Ansible/1.7.0"
class UserQuota(object):
diff --git a/plugins/modules/volume.py b/plugins/modules/volume.py
index 82bcb01..9492e36 100644
--- a/plugins/modules/volume.py
+++ b/plugins/modules/volume.py
@@ -177,9 +177,9 @@
pool_name: "{{pool}}"
size: 2
cap_unit: "{{cap_GB}}"
- is_thin: True
- compression: True
- advanced_dedup: True
+ is_thin: true
+ compression: true
+ advanced_dedup: true
state: "{{state_present}}"
- name: Expand Volume by volume id
@@ -240,9 +240,9 @@
vol_name: "{{vol_name}}"
new_vol_name: "{{new_vol_name}}"
tiering_policy: "AUTOTIER"
- compression: True
- is_thin: True
- advanced_dedup: True
+ compression: true
+ is_thin: true
+ advanced_dedup: true
state: "{{state_present}}"
- name: Delete Volume by vol name
@@ -270,7 +270,7 @@
description: Whether or not the resource has changed.
returned: always
type: bool
- sample: True
+ sample: true
volume_details:
description: Details of the volume.
@@ -392,11 +392,10 @@
from ansible.module_utils.basic import AnsibleModule
from ansible_collections.dellemc.unity.plugins.module_utils.storage.dell \
import utils
-import logging
LOG = utils.get_logger('volume')
-application_type = "Ansible/1.6.0"
+application_type = "Ansible/1.7.0"
def is_none_or_empty_string(param):
diff --git a/tests/sanity/ignore-2.13.txt b/tests/sanity/ignore-2.13.txt
index a175e99..a7aa131 100644
--- a/tests/sanity/ignore-2.13.txt
+++ b/tests/sanity/ignore-2.13.txt
@@ -25,3 +25,8 @@ plugins/modules/filesystem.py compile-3.5
plugins/modules/filesystem.py import-2.7
plugins/modules/filesystem.py import-3.5
plugins/modules/interface.py validate-modules:missing-gplv3-license
+plugins/modules/replication_session.py validate-modules:missing-gplv3-license
+plugins/modules/replication_session.py import-2.7
+plugins/modules/replication_session.py import-3.5
+plugins/modules/replication_session.py compile-2.7
+plugins/modules/replication_session.py compile-3.5
diff --git a/tests/sanity/ignore-2.14.txt b/tests/sanity/ignore-2.14.txt
index a175e99..a7aa131 100644
--- a/tests/sanity/ignore-2.14.txt
+++ b/tests/sanity/ignore-2.14.txt
@@ -25,3 +25,8 @@ plugins/modules/filesystem.py compile-3.5
plugins/modules/filesystem.py import-2.7
plugins/modules/filesystem.py import-3.5
plugins/modules/interface.py validate-modules:missing-gplv3-license
+plugins/modules/replication_session.py validate-modules:missing-gplv3-license
+plugins/modules/replication_session.py import-2.7
+plugins/modules/replication_session.py import-3.5
+plugins/modules/replication_session.py compile-2.7
+plugins/modules/replication_session.py compile-3.5
diff --git a/tests/sanity/ignore-2.12.txt b/tests/sanity/ignore-2.15.txt
similarity index 84%
rename from tests/sanity/ignore-2.12.txt
rename to tests/sanity/ignore-2.15.txt
index f78c829..a7aa131 100644
--- a/tests/sanity/ignore-2.12.txt
+++ b/tests/sanity/ignore-2.15.txt
@@ -1,5 +1,3 @@
-plugins/modules/nfs.py compile-2.6
-plugins/modules/nfs.py import-2.6
plugins/modules/consistencygroup.py validate-modules:missing-gplv3-license
plugins/modules/filesystem.py validate-modules:missing-gplv3-license
plugins/modules/filesystem_snapshot.py validate-modules:missing-gplv3-license
@@ -16,18 +14,19 @@ plugins/modules/user_quota.py validate-modules:missing-gplv3-license
plugins/modules/volume.py validate-modules:missing-gplv3-license
plugins/modules/cifsserver.py validate-modules:missing-gplv3-license
plugins/modules/nfsserver.py validate-modules:missing-gplv3-license
-plugins/modules/host.py import-2.6
plugins/modules/host.py import-2.7
-plugins/modules/interface.py import-2.6
plugins/modules/interface.py import-2.7
plugins/modules/nfs.py import-2.7
plugins/modules/nfs.py import-3.5
plugins/modules/nfs.py compile-2.7
plugins/modules/nfs.py compile-3.5
-plugins/modules/filesystem.py import-2.6
-plugins/modules/filesystem.py compile-2.6
plugins/modules/filesystem.py compile-2.7
plugins/modules/filesystem.py compile-3.5
plugins/modules/filesystem.py import-2.7
plugins/modules/filesystem.py import-3.5
-plugins/modules/interface.py validate-modules:missing-gplv3-license
\ No newline at end of file
+plugins/modules/interface.py validate-modules:missing-gplv3-license
+plugins/modules/replication_session.py validate-modules:missing-gplv3-license
+plugins/modules/replication_session.py import-2.7
+plugins/modules/replication_session.py import-3.5
+plugins/modules/replication_session.py compile-2.7
+plugins/modules/replication_session.py compile-3.5
diff --git a/tests/unit/plugins/module_utils/mock_cifsserver_api.py b/tests/unit/plugins/module_utils/mock_cifsserver_api.py
index 427d530..d3f0e90 100644
--- a/tests/unit/plugins/module_utils/mock_cifsserver_api.py
+++ b/tests/unit/plugins/module_utils/mock_cifsserver_api.py
@@ -5,13 +5,9 @@
"""Mock Api response for Unit tests of CIFS server module on Unity"""
from __future__ import (absolute_import, division, print_function)
-from unittest.mock import MagicMock
__metaclass__ = type
-from ansible_collections.dellemc.unity.tests.unit.plugins.module_utils.mock_sdk_response \
- import MockSDKObject
-
class MockCIFSServerApi:
CIFS_SERVER_MODULE_ARGS = {
diff --git a/tests/unit/plugins/module_utils/mock_info_api.py b/tests/unit/plugins/module_utils/mock_info_api.py
new file mode 100644
index 0000000..80ae035
--- /dev/null
+++ b/tests/unit/plugins/module_utils/mock_info_api.py
@@ -0,0 +1,58 @@
+# 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 Info module on Unity"""
+
+from __future__ import (absolute_import, division, print_function)
+from mock.mock import Mock
+__metaclass__ = type
+
+
+class MockInfoApi:
+ @staticmethod
+ def get_replication_sessions_response(status="ReplicationSessionStatusEnum.OK"):
+ return [Mock(**{
+ "current_transfer_est_remain_time": 0,
+ "daily_snap_replication_policy": None,
+ "dst_resource_id": "nas_8",
+ "dst_spa_interface": {
+ "UnityRemoteInterface": {
+ "hash": 8771253398547,
+ "id": "APM00213404195:if_181"
+ }
+ },
+ "dst_status": status,
+ "existed": True,
+ "hash": 8771259012271,
+ "health": {
+ "UnityHealth": {
+ "hash": 8771253424168
+ }
+ },
+ "hourly_snap_replication_policy": None,
+ "id": "103079215114_APM00213404195_0000_103079215274_APM00213404194_0000",
+ "last_sync_time": "2023-04-18 10:35:25+00:00",
+ "local_role": "ReplicationSessionReplicationRoleEnum.DESTINATION",
+ "max_time_out_of_sync": 0,
+ "members": None,
+ "name": "rep_session",
+ "network_status": "ReplicationSessionNetworkStatusEnum.OK",
+ "remote_system": {
+ "UnityRemoteSystem": {
+ "hash": 8771253380142
+ }
+ },
+ "replication_resource_type": "ReplicationEndpointResourceTypeEnum.NASSERVER",
+ "src_resource_id": "nas_213",
+ "src_spa_interface": {
+ "UnityRemoteInterface": {
+ "hash": 8771253475010,
+ "id": "APM00213404194:if_195"
+ }
+ },
+ "src_status": status,
+ "status": status,
+ "sync_progress": 0,
+ "sync_state": "ReplicationSessionSyncStateEnum.IN_SYNC"}
+ )]
diff --git a/tests/unit/plugins/module_utils/mock_interface_api.py b/tests/unit/plugins/module_utils/mock_interface_api.py
index 6bd53ea..046ff2c 100644
--- a/tests/unit/plugins/module_utils/mock_interface_api.py
+++ b/tests/unit/plugins/module_utils/mock_interface_api.py
@@ -5,7 +5,6 @@
"""Mock Api response for Unit tests of interface on Unity"""
from __future__ import (absolute_import, division, print_function)
-from unittest.mock import MagicMock
__metaclass__ = type
diff --git a/tests/unit/plugins/module_utils/mock_nfsserver_api.py b/tests/unit/plugins/module_utils/mock_nfsserver_api.py
index 1254f00..9c4eadc 100644
--- a/tests/unit/plugins/module_utils/mock_nfsserver_api.py
+++ b/tests/unit/plugins/module_utils/mock_nfsserver_api.py
@@ -5,7 +5,6 @@
"""Mock Api response for Unit tests of NFS server module on Unity"""
from __future__ import (absolute_import, division, print_function)
-from unittest.mock import MagicMock
__metaclass__ = type
diff --git a/tests/unit/plugins/module_utils/mock_replication_session_api.py b/tests/unit/plugins/module_utils/mock_replication_session_api.py
new file mode 100644
index 0000000..0500843
--- /dev/null
+++ b/tests/unit/plugins/module_utils/mock_replication_session_api.py
@@ -0,0 +1,112 @@
+# 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 Replication session module on Unity"""
+
+from __future__ import (absolute_import, division, print_function)
+from ansible_collections.dellemc.unity.tests.unit.plugins.module_utils.mock_sdk_response \
+ import MockSDKObject
+
+__metaclass__ = type
+
+
+class MockReplicationSessionApi:
+ MODULE_ARGS = {
+ 'session_id': None,
+ 'session_name': None,
+ 'pause': None,
+ 'failback': None,
+ 'sync': None,
+ 'failover_with_sync': None,
+ 'force_full_copy': None,
+ 'force': None,
+ 'state': 'present'
+ }
+
+ @staticmethod
+ def get_replication_session_details(status="ACTIVE"):
+ return {
+ "current_transfer_est_remain_time": 0,
+ "daily_snap_replication_policy": None,
+ "dst_resource_id": "nas_8",
+ "dst_spa_interface": {
+ "UnityRemoteInterface": {
+ "hash": 8771253398547,
+ "id": "APM00213404195:if_181"
+ }
+ },
+ "dst_status": "ReplicationSessionStatusEnum.OK",
+ "existed": True,
+ "hash": 8771259012271,
+ "health": {
+ "UnityHealth": {
+ "hash": 8771253424168
+ }
+ },
+ "hourly_snap_replication_policy": None,
+ "id": "103079215114_APM00213404195_0000_103079215274_APM00213404194_0000",
+ "last_sync_time": "2023-04-18 10:35:25+00:00",
+ "local_role": "ReplicationSessionReplicationRoleEnum.DESTINATION",
+ "max_time_out_of_sync": 0,
+ "members": None,
+ "name": "rep_session",
+ "network_status": "ReplicationSessionNetworkStatusEnum.OK",
+ "remote_system": {
+ "UnityRemoteSystem": {
+ "hash": 8771253380142
+ }
+ },
+ "replication_resource_type": "ReplicationEndpointResourceTypeEnum.NASSERVER",
+ "src_resource_id": "nas_213",
+ "src_spa_interface": {
+ "UnityRemoteInterface": {
+ "hash": 8771253475010,
+ "id": "APM00213404194:if_195"
+ }
+ },
+ "src_spb_interface": {
+ "UnityRemoteInterface": {
+ "hash": 8771253374169,
+ "id": "APM00213404194:if_194"
+ }
+ },
+ "src_status": "ReplicationSessionStatusEnum.OK",
+ "status": Status(status),
+ "sync_progress": 0,
+ "sync_state": "ReplicationSessionSyncStateEnum.IN_SYNC"
+ }
+
+
+class Status:
+ name = "ACTIVE"
+
+ def __init__(self, status):
+ self.name = status
+
+
+class MockReplicationSessionObject(MockSDKObject):
+ pause_session = False
+ resume_session = False
+ failover_session = False
+ failback_session = False
+ sync_session = False
+ delete_session = False
+
+ def pause(self):
+ self.pause_session = True
+
+ def resume(self, force_full_copy=None):
+ self.resume_session = True
+
+ def failover(self, sync=None, force=None):
+ self.failover_session = True
+
+ def failback(self, force_full_copy=None):
+ self.failback_session = True
+
+ def sync(self):
+ self.sync_session = True
+
+ def delete(self):
+ self.delete_session = True
diff --git a/tests/unit/plugins/module_utils/mock_volume_api.py b/tests/unit/plugins/module_utils/mock_volume_api.py
index 82097a3..ddf5c40 100644
--- a/tests/unit/plugins/module_utils/mock_volume_api.py
+++ b/tests/unit/plugins/module_utils/mock_volume_api.py
@@ -8,8 +8,6 @@
__metaclass__ = type
-from ansible_collections.dellemc.unity.tests.unit.plugins.module_utils.mock_sdk_response import MockSDKObject
-
class MockVolumeApi:
diff --git a/tests/unit/plugins/modules/test_cifsserver.py b/tests/unit/plugins/modules/test_cifsserver.py
index e28c2e9..a1143a7 100644
--- a/tests/unit/plugins/modules/test_cifsserver.py
+++ b/tests/unit/plugins/modules/test_cifsserver.py
@@ -14,8 +14,6 @@
import MockCIFSServerApi
from ansible_collections.dellemc.unity.tests.unit.plugins.module_utils.mock_sdk_response \
import MockSDKObject
-from ansible_collections.dellemc.unity.tests.unit.plugins.module_utils.mock_api_exception \
- import HttpError as http_error, MockApiException
from ansible_collections.dellemc.unity.plugins.module_utils.storage.dell import utils
utils.get_logger = MagicMock()
diff --git a/tests/unit/plugins/modules/test_host.py b/tests/unit/plugins/modules/test_host.py
index de94c38..028a2fa 100644
--- a/tests/unit/plugins/modules/test_host.py
+++ b/tests/unit/plugins/modules/test_host.py
@@ -15,7 +15,7 @@
from ansible_collections.dellemc.unity.tests.unit.plugins.module_utils.mock_sdk_response \
import MockSDKObject
from ansible_collections.dellemc.unity.tests.unit.plugins.module_utils.mock_api_exception \
- import HttpError as http_error, MockApiException
+ import HttpError as http_error
from ansible_collections.dellemc.unity.plugins.module_utils.storage.dell \
import utils
diff --git a/tests/unit/plugins/modules/test_info.py b/tests/unit/plugins/modules/test_info.py
new file mode 100644
index 0000000..a365676
--- /dev/null
+++ b/tests/unit/plugins/modules/test_info.py
@@ -0,0 +1,54 @@
+# 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 Info module on Unity"""
+
+from __future__ import (absolute_import, division, print_function)
+
+__metaclass__ = type
+
+import pytest
+from mock.mock import MagicMock
+from ansible_collections.dellemc.unity.tests.unit.plugins.module_utils.mock_info_api \
+ import MockInfoApi
+from ansible_collections.dellemc.unity.tests.unit.plugins.module_utils.mock_api_exception \
+ import HttpError as http_error
+from ansible_collections.dellemc.unity.plugins.module_utils.storage.dell import utils
+
+utils.get_logger = MagicMock()
+utils.get_unity_management_host_parameters = MagicMock()
+utils.ensure_required_libs = MagicMock()
+utils.get_unity_unisphere_connection = MagicMock()
+from ansible.module_utils import basic
+basic.AnsibleModule = MagicMock()
+from ansible_collections.dellemc.unity.plugins.modules.info import Info
+
+
+class TestInfo():
+
+ get_module_args = {"gather_subset": None, "state": "present"}
+
+ @pytest.fixture
+ def info_module_mock(self):
+ info_module_mock = Info()
+ info_module_mock.unity = MagicMock()
+ return info_module_mock
+
+ def test_get_replication_session_details(self, info_module_mock):
+ self.get_module_args.update({'gather_subset': 'replication_session'})
+ info_module_mock.module.params = self.get_module_args
+ info_module_mock.unity.get_replication_session = \
+ MagicMock(return_value=MockInfoApi.get_replication_sessions_response())
+ info_module_mock.perform_module_operation()
+ assert info_module_mock.module.exit_json.call_args[1]['Replication_sessions'] is not None
+
+ def test_get_replication_session_details_throws_exception(self, info_module_mock):
+ self.get_module_args.update({'gather_subset': 'replication_session'})
+ info_module_mock.module.params = self.get_module_args
+ utils.HttpError = http_error
+ info_module_mock.unity.get_replication_session = \
+ MagicMock(side_effect=http_error)
+ info_module_mock.perform_module_operation()
+ assert "Get replication session list from unity array failed with error" in \
+ info_module_mock.module.fail_json.call_args[1]['msg']
diff --git a/tests/unit/plugins/modules/test_nfsserver.py b/tests/unit/plugins/modules/test_nfsserver.py
index c2a6804..f7900ee 100644
--- a/tests/unit/plugins/modules/test_nfsserver.py
+++ b/tests/unit/plugins/modules/test_nfsserver.py
@@ -12,8 +12,6 @@
from mock.mock import MagicMock
from ansible_collections.dellemc.unity.tests.unit.plugins.module_utils.mock_nfsserver_api \
import MockNFSServerApi
-from ansible_collections.dellemc.unity.tests.unit.plugins.module_utils.mock_sdk_response \
- import MockSDKObject
from ansible_collections.dellemc.unity.tests.unit.plugins.module_utils.mock_api_exception \
import HttpError as http_error, MockApiException
from ansible_collections.dellemc.unity.plugins.module_utils.storage.dell import utils
diff --git a/tests/unit/plugins/modules/test_replication_session.py b/tests/unit/plugins/modules/test_replication_session.py
new file mode 100644
index 0000000..9af1800
--- /dev/null
+++ b/tests/unit/plugins/modules/test_replication_session.py
@@ -0,0 +1,178 @@
+# 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 Replication session module on Unity"""
+
+from __future__ import (absolute_import, division, print_function)
+
+__metaclass__ = type
+
+import pytest
+from mock.mock import MagicMock
+from enum import Enum
+from ansible_collections.dellemc.unity.tests.unit.plugins.module_utils.mock_replication_session_api \
+ import MockReplicationSessionApi, MockReplicationSessionObject
+from ansible_collections.dellemc.unity.tests.unit.plugins.module_utils.mock_api_exception \
+ import HttpError as http_error
+from ansible_collections.dellemc.unity.plugins.module_utils.storage.dell import utils
+
+utils.get_logger = MagicMock()
+utils.get_unity_management_host_parameters = MagicMock()
+utils.ensure_required_libs = MagicMock()
+utils.get_unity_unisphere_connection = MagicMock()
+from ansible.module_utils import basic
+basic.AnsibleModule = MagicMock()
+from ansible_collections.dellemc.unity.plugins.modules.replication_session import ReplicationSession, ReplicationSessionHandler
+
+
+class ReplicationOpStatusEnum(Enum):
+ FAILED_OVER_WITH_SYNC = (0x8400, 'Failed_Over_with_Sync')
+ FAILED_OVER = (0x8401, 'Failed_Over')
+ PAUSED = (0x8403, 'Paused')
+
+
+class TestReplicationSession():
+
+ get_module_args = MockReplicationSessionApi.MODULE_ARGS
+ session_name = "rep_session"
+ FAILED_WITH_ERROR = " failed with error"
+ replication_session_obj = MockReplicationSessionObject(MockReplicationSessionApi.get_replication_session_details())
+
+ @pytest.fixture
+ def replication_session_module_mock(self):
+ setattr(utils, 'ReplicationOpStatusEnum', ReplicationOpStatusEnum)
+ replication_session_module_mock = ReplicationSession()
+ replication_session_module_mock.unity_conn = MagicMock()
+ replication_session_module_mock.module.check_mode = False
+ return replication_session_module_mock
+
+ def test_get_replication_session_details(self, replication_session_module_mock):
+ self.get_module_args.update({'session_name': 'session1'})
+ replication_session_module_mock.module.params = self.get_module_args
+ replication_session_module_mock.unity_conn.get_replication_session = \
+ MagicMock(return_value=self.replication_session_obj)
+ ReplicationSessionHandler().handle(replication_session_module_mock, replication_session_module_mock.module.params)
+ assert replication_session_module_mock.module.exit_json.call_args[1]['changed'] is False
+
+ def test_get_replication_session_details_throws_exception(self, replication_session_module_mock):
+ self.get_module_args.update({'session_name': 'session1'})
+ replication_session_module_mock.module.params = self.get_module_args
+ utils.HttpError = http_error
+ replication_session_module_mock.unity_conn.get_replication_session = \
+ MagicMock(side_effect=http_error)
+ ReplicationSessionHandler().handle(replication_session_module_mock, replication_session_module_mock.module.params)
+ assert "is invalid" in \
+ replication_session_module_mock.module.fail_json.call_args[1]['msg']
+
+ def test_pause_replication_session(self, replication_session_module_mock):
+ self.get_module_args.update({'session_name': 'session1', 'pause': True})
+ replication_session_module_mock.module.params = self.get_module_args
+ replication_session_module_mock.unity_conn.get_replication_session = \
+ MagicMock(return_value=self.replication_session_obj)
+ ReplicationSessionHandler().handle(replication_session_module_mock, replication_session_module_mock.module.params)
+ assert self.replication_session_obj.pause_session is True
+
+ def test_pause_replication_session_throws_exception(self, replication_session_module_mock):
+ self.get_module_args.update({'session_name': 'session1', 'pause': True})
+ replication_session_module_mock.module.params = self.get_module_args
+ replication_session_module_mock.unity_conn.get_replication_session = \
+ MagicMock(return_value=self.replication_session_obj)
+ self.replication_session_obj.pause = MagicMock(side_effect=Exception)
+ ReplicationSessionHandler().handle(replication_session_module_mock, replication_session_module_mock.module.params)
+ assert "Pause replication session " + self.session_name + self.FAILED_WITH_ERROR in \
+ replication_session_module_mock.module.fail_json.call_args[1]['msg']
+
+ def test_resume_replication_session(self, replication_session_module_mock):
+ self.get_module_args.update({'session_name': 'session1', 'pause': False})
+ replication_session_module_mock.module.params = self.get_module_args
+ replication_session_obj = MockReplicationSessionObject(MockReplicationSessionApi.get_replication_session_details("PAUSED"))
+ replication_session_module_mock.unity_conn.get_replication_session = \
+ MagicMock(return_value=replication_session_obj)
+ ReplicationSessionHandler().handle(replication_session_module_mock, replication_session_module_mock.module.params)
+ assert replication_session_obj.resume_session is True
+
+ def test_resume_replication_session_throws_exception(self, replication_session_module_mock):
+ self.get_module_args.update({'session_name': 'session1', 'pause': False})
+ replication_session_module_mock.module.params = self.get_module_args
+ replication_session_obj = MockReplicationSessionObject(MockReplicationSessionApi.get_replication_session_details("PAUSED"))
+ replication_session_module_mock.unity_conn.get_replication_session = \
+ MagicMock(return_value=replication_session_obj)
+ replication_session_obj.resume = MagicMock(side_effect=Exception)
+ ReplicationSessionHandler().handle(replication_session_module_mock, replication_session_module_mock.module.params)
+ assert "Resume replication session " + self.session_name + self.FAILED_WITH_ERROR in \
+ replication_session_module_mock.module.fail_json.call_args[1]['msg']
+
+ def test_failover_replication_session(self, replication_session_module_mock):
+ self.get_module_args.update({'session_name': 'session1', 'failover_with_sync': True, 'force': True})
+ replication_session_module_mock.module.params = self.get_module_args
+ replication_session_module_mock.unity_conn.get_replication_session = \
+ MagicMock(return_value=self.replication_session_obj)
+ ReplicationSessionHandler().handle(replication_session_module_mock, replication_session_module_mock.module.params)
+ assert self.replication_session_obj.failover_session is True
+
+ def test_failover_replication_session_throws_exception(self, replication_session_module_mock):
+ self.get_module_args.update({'session_name': 'session1', 'failover_with_sync': True, 'force': True})
+ replication_session_module_mock.module.params = self.get_module_args
+ replication_session_module_mock.unity_conn.get_replication_session = \
+ MagicMock(return_value=self.replication_session_obj)
+ self.replication_session_obj.failover = MagicMock(side_effect=Exception)
+ ReplicationSessionHandler().handle(replication_session_module_mock, replication_session_module_mock.module.params)
+ assert "Failover replication session " + self.session_name + self.FAILED_WITH_ERROR in \
+ replication_session_module_mock.module.fail_json.call_args[1]['msg']
+
+ def test_failback_replication_session_details(self, replication_session_module_mock):
+ self.get_module_args.update({'session_name': 'session1', 'failback': True, 'force_full_copy': True})
+ replication_session_module_mock.module.params = self.get_module_args
+ replication_session_obj = MockReplicationSessionObject(MockReplicationSessionApi.get_replication_session_details("FAILED_OVER"))
+ replication_session_module_mock.unity_conn.get_replication_session = \
+ MagicMock(return_value=replication_session_obj)
+ ReplicationSessionHandler().handle(replication_session_module_mock, replication_session_module_mock.module.params)
+ assert replication_session_obj.failback_session is True
+
+ def test_failback_replication_session_throws_exception(self, replication_session_module_mock):
+ self.get_module_args.update({'session_name': 'session1', 'failback': True, 'force_full_copy': True})
+ replication_session_module_mock.module.params = self.get_module_args
+ replication_session_obj = MockReplicationSessionObject(MockReplicationSessionApi.get_replication_session_details("FAILED_OVER"))
+ replication_session_module_mock.unity_conn.get_replication_session = \
+ MagicMock(return_value=replication_session_obj)
+ replication_session_obj.failback = MagicMock(side_effect=Exception)
+ ReplicationSessionHandler().handle(replication_session_module_mock, replication_session_module_mock.module.params)
+ assert "Failback replication session " + self.session_name + self.FAILED_WITH_ERROR in \
+ replication_session_module_mock.module.fail_json.call_args[1]['msg']
+
+ def test_sync_replication_session(self, replication_session_module_mock):
+ self.get_module_args.update({'session_name': 'session1', 'sync': True})
+ replication_session_module_mock.module.params = self.get_module_args
+ replication_session_module_mock.unity_conn.get_replication_session = \
+ MagicMock(return_value=self.replication_session_obj)
+ ReplicationSessionHandler().handle(replication_session_module_mock, replication_session_module_mock.module.params)
+ assert self.replication_session_obj.sync_session is True
+
+ def test_sync_replication_session_throws_exception(self, replication_session_module_mock):
+ self.get_module_args.update({'session_name': 'session1', 'sync': True})
+ replication_session_module_mock.module.params = self.get_module_args
+ replication_session_module_mock.unity_conn.get_replication_session = \
+ MagicMock(return_value=self.replication_session_obj)
+ self.replication_session_obj.sync = MagicMock(side_effect=Exception)
+ ReplicationSessionHandler().handle(replication_session_module_mock, replication_session_module_mock.module.params)
+ assert "Sync replication session " + self.session_name + self.FAILED_WITH_ERROR in \
+ replication_session_module_mock.module.fail_json.call_args[1]['msg']
+
+ def test_delete_replication_session(self, replication_session_module_mock):
+ self.get_module_args.update({'session_name': 'session1', 'state': 'absent'})
+ replication_session_module_mock.module.params = self.get_module_args
+ replication_session_module_mock.unity_conn.get_replication_session = \
+ MagicMock(return_value=self.replication_session_obj)
+ ReplicationSessionHandler().handle(replication_session_module_mock, replication_session_module_mock.module.params)
+ assert self.replication_session_obj.delete_session is True
+
+ def test_delete_replication_session_throws_exception(self, replication_session_module_mock):
+ self.get_module_args.update({'session_name': 'session1', 'state': 'absent'})
+ replication_session_module_mock.module.params = self.get_module_args
+ replication_session_module_mock.unity_conn.get_replication_session = \
+ MagicMock(return_value=self.replication_session_obj)
+ self.replication_session_obj.delete = MagicMock(side_effect=Exception)
+ ReplicationSessionHandler().handle(replication_session_module_mock, replication_session_module_mock.module.params)
+ assert "Deleting replication session " + self.session_name + self.FAILED_WITH_ERROR in \
+ replication_session_module_mock.module.fail_json.call_args[1]['msg']