diff options
Diffstat (limited to 'ansible_collections/dellemc/unity')
87 files changed, 5607 insertions, 769 deletions
diff --git a/ansible_collections/dellemc/unity/.ansible-lint b/ansible_collections/dellemc/unity/.ansible-lint new file mode 100644 index 000000000..4a9971a19 --- /dev/null +++ b/ansible_collections/dellemc/unity/.ansible-lint @@ -0,0 +1,4 @@ +exclude_paths: + - changelogs/ + - .github/ + - meta/ diff --git a/ansible_collections/dellemc/unity/.github/workflows/ansible-test.yml b/ansible_collections/dellemc/unity/.github/workflows/ansible-test.yml index d9fb5cf04..58d3ea030 100644 --- a/ansible_collections/dellemc/unity/.github/workflows/ansible-test.yml +++ b/ansible_collections/dellemc/unity/.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,12 +50,10 @@ 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 steps: @@ -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/ansible_collections/dellemc/unity/CHANGELOG.rst b/ansible_collections/dellemc/unity/CHANGELOG.rst index 55eb73ca8..cf231b653 100644 --- a/ansible_collections/dellemc/unity/CHANGELOG.rst +++ b/ansible_collections/dellemc/unity/CHANGELOG.rst @@ -5,15 +5,38 @@ Dellemc.Unity Change Log .. contents:: Topics +v1.7.1 +====== + +Minor Changes +------------- + +- Patch update to fix import errors in utils file. + +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/ansible_collections/dellemc/unity/FILES.json b/ansible_collections/dellemc/unity/FILES.json index 74f5f6106..24ae1cf93 100644 --- a/ansible_collections/dellemc/unity/FILES.json +++ b/ansible_collections/dellemc/unity/FILES.json @@ -8,6 +8,13 @@ "format": 1 }, { + "name": ".ansible-lint", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "f15456e7e2d28634ccb97ea4f73cd6165ce5b6a974a088330b05f5d730b7f674", + "format": 1 + }, + { "name": ".github", "ftype": "dir", "chksum_type": null, @@ -81,14 +88,14 @@ "name": ".github/workflows/ansible-test.yml", "ftype": "file", "chksum_type": "sha256", - "chksum_sha256": "36061bc14911cf2e9f7a4bd7c15771f40cc19c6153de788a79b02fe39d776684", + "chksum_sha256": "d648c6b2038a891200af1f6ae981928a37427a14b230e0b7b6ba030cae29a37a", "format": 1 }, { "name": "CHANGELOG.rst", "ftype": "file", "chksum_type": "sha256", - "chksum_sha256": "1de2b419f19d4fc6298d49bcc811ead97876e67da345da4569ae7d68c5ec2e72", + "chksum_sha256": "0f7304d22c291fa4120f7f01ce4db2d000c00d422fd5fb2a4b2cc771e49c43f6", "format": 1 }, { @@ -109,7 +116,7 @@ "name": "README.md", "ftype": "file", "chksum_type": "sha256", - "chksum_sha256": "a787189adc44f92c54d358fc05673e8a96815159f8b8296e5eed187171089bc5", + "chksum_sha256": "e9dda8bf38a7da066fc2fbfff79d3945479c31549df311b3d18229fb2e3634ed", "format": 1 }, { @@ -123,14 +130,14 @@ "name": "changelogs/.plugin-cache.yaml", "ftype": "file", "chksum_type": "sha256", - "chksum_sha256": "1bf36094cdc0a4661da6b69615073ece39cece910d58dbdd889c4e99070fbbd0", + "chksum_sha256": "4869399d305f2a50f7f0abe8a42823ecd1ca153957ed55d8b913bfda4b9dbfae", "format": 1 }, { "name": "changelogs/changelog.yaml", "ftype": "file", "chksum_type": "sha256", - "chksum_sha256": "b7fd9dd55038169d69b139a961a0501c0805bc1a86a046750c76f4a94b366c19", + "chksum_sha256": "0c48d1c2f86f067385dfee3d1c7e4355b42325860936dd4395ecde150b7d894d", "format": 1 }, { @@ -179,21 +186,21 @@ "name": "docs/CONTRIBUTING.md", "ftype": "file", "chksum_type": "sha256", - "chksum_sha256": "598e9bdfdfb5fcbcba74e866d2680c80e75e8c3e9567c4706df9de36660b1490", + "chksum_sha256": "4cf604f9b0b86445fa475876590076d016fa422d2b062e4242e6c4060e3b6738", "format": 1 }, { "name": "docs/INSTALLATION.md", "ftype": "file", "chksum_type": "sha256", - "chksum_sha256": "a6fb197119f7cb5a83d6079ea4abe69c8c44a29f1686909ed08cc0bf05b67f2d", + "chksum_sha256": "eb198be51142a91a0196541ff636aabbb68f17e34de329213a41c83ad3059923", "format": 1 }, { "name": "docs/ISSUE_TRIAGE.md", "ftype": "file", "chksum_type": "sha256", - "chksum_sha256": "846a696c85036bd2e65dc8517932ec8dbf88c305726a230fdcc4a75e989a2d53", + "chksum_sha256": "c5a6b4bd9e4875696f16454844a45f7b2cf95102f1960c1a25cf5e2dafff3e14", "format": 1 }, { @@ -207,21 +214,21 @@ "name": "docs/MAINTAINER_GUIDE.md", "ftype": "file", "chksum_type": "sha256", - "chksum_sha256": "e1e926f5ecbcb3c016e8394fd386a22d0a9235cd6e049b84a9dce42990c60fa8", + "chksum_sha256": "9c3558b79f0913255880f5d2066b98dd2ca5e1e51bce28ccb3bf6cac390a23d7", "format": 1 }, { "name": "docs/Release Notes.md", "ftype": "file", "chksum_type": "sha256", - "chksum_sha256": "25fc0f22b54c1ecc5fb94cf6f0546600aa444416f79a57c8d367adbd83c1e565", + "chksum_sha256": "3d01761e2b3a2260eeb24e776c773a89a37389156e7e4d43b9c77d24d0506afa", "format": 1 }, { "name": "docs/SECURITY.md", "ftype": "file", "chksum_type": "sha256", - "chksum_sha256": "b80e365d12066e0f6c0cf7dce905b1530fc827b4c8111f6533910982ab196174", + "chksum_sha256": "11f2d0c94f6b4e19e25a683d25d7dda948f9c4c05bd23fc5e40eeaf23f84cf00", "format": 1 }, { @@ -242,119 +249,126 @@ "name": "docs/modules/cifsserver.rst", "ftype": "file", "chksum_type": "sha256", - "chksum_sha256": "ade3ef8ba26c63eeff0dd582a8f9b8a2616d96cb7066bc84410e6ed4c0c02fc5", + "chksum_sha256": "accb0fec62fb6b7e828d5c86fb8b31f386409b85155c4071d5f059f1e451b270", "format": 1 }, { "name": "docs/modules/consistencygroup.rst", "ftype": "file", "chksum_type": "sha256", - "chksum_sha256": "4a0ac0e3028289436bc9dcc07e14821fab118552e56e28558541346628b73fab", + "chksum_sha256": "59b142a37b5afd529f65101b06f20e0ec06617a98939867cbb5dae4d18db9f1d", "format": 1 }, { "name": "docs/modules/filesystem.rst", "ftype": "file", "chksum_type": "sha256", - "chksum_sha256": "f93698d8d35931abff7bb6262ac10e3603aa300878248001d3566d1ec39c0ee2", + "chksum_sha256": "5d51a857e4b4a0fe2eae41f598751a7a53e6e7bea2c7543d415c4f0797b42e00", "format": 1 }, { "name": "docs/modules/filesystem_snapshot.rst", "ftype": "file", "chksum_type": "sha256", - "chksum_sha256": "0974b3beba09ff4a44a6977be12764377213f960a0a0c08e2be3fc4a025b4583", + "chksum_sha256": "da7a239d93ee37c1c897029df2d5e984f1c261bdba9027aa518a59c7bf369f6b", "format": 1 }, { "name": "docs/modules/host.rst", "ftype": "file", "chksum_type": "sha256", - "chksum_sha256": "b78755a1bdbec795874457f3ee5e63a49d60fb21653617fb58fbefe6f8144282", + "chksum_sha256": "d87b955b1e69506eef89d51a5fd7af09ebb1ce02f96a153bf3dd79c0c60d79b5", "format": 1 }, { "name": "docs/modules/info.rst", "ftype": "file", "chksum_type": "sha256", - "chksum_sha256": "19af0ad15ef490c6520d3001657e49b31c386e745d7cf61ac88898bf363ea50d", + "chksum_sha256": "e6da035d8419e140759ff270af8e190a3c832710e8e6499948fc23923511c407", "format": 1 }, { "name": "docs/modules/interface.rst", "ftype": "file", "chksum_type": "sha256", - "chksum_sha256": "14bec74112975514f622216f2b2f272197b96f0cb6f99e41ade9491af5bda29e", + "chksum_sha256": "15cd4e252987b1cc2a0e887eaf2a6e30c23d0a3c1c1fe779446ad8e0ea8d575d", "format": 1 }, { "name": "docs/modules/nasserver.rst", "ftype": "file", "chksum_type": "sha256", - "chksum_sha256": "0433167e81af69381b7bb7e5350d1414ba6a86de1b66ef82b964d180a9d17229", + "chksum_sha256": "938cda5e8fb9200084ad3fb7fc64b60b0e9734103e83dadc3af44af697c8bb86", "format": 1 }, { "name": "docs/modules/nfs.rst", "ftype": "file", "chksum_type": "sha256", - "chksum_sha256": "5a1471c26c1b8144f2c159069276b4a7e0d2eb34ab5fb82def30ac9a0c224ef9", + "chksum_sha256": "78f10ffebfbf31ccd595bc185ea66b709964edad32503820e11af3d92796503d", "format": 1 }, { "name": "docs/modules/nfsserver.rst", "ftype": "file", "chksum_type": "sha256", - "chksum_sha256": "95005625b57eeb149e047a58cc5f8cd395d48bdf4ac533ab37af7c92ef6c0b01", + "chksum_sha256": "83c13d27190e3ff69dd2e9e8e028d0aaee59df327e61c30f4ed65b96d45872e3", + "format": 1 + }, + { + "name": "docs/modules/replication_session.rst", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "e36e6472bca3364b80e33e912db31f3cc68da02b978904042273382cdb87ea14", "format": 1 }, { "name": "docs/modules/smbshare.rst", "ftype": "file", "chksum_type": "sha256", - "chksum_sha256": "8ae4d6ac050fe829100c4844d6663de2c60f68bd16a18942466c4fa879aaffb5", + "chksum_sha256": "779f2cb17655c0bd6b2be3b3612e18d8cb807d3176ec9f07791b94cfe370a9b4", "format": 1 }, { "name": "docs/modules/snapshot.rst", "ftype": "file", "chksum_type": "sha256", - "chksum_sha256": "f92f063ad273c68ddc443dc638d4d9bbef928796f8be56ff8ba3257edf222fee", + "chksum_sha256": "66e4b15d3bb4d331318d985436989cf2337883cecd55ab752890ab6d56e14143", "format": 1 }, { "name": "docs/modules/snapshotschedule.rst", "ftype": "file", "chksum_type": "sha256", - "chksum_sha256": "bef45c4ee0716258b1afd49736cd566ee6f0f7332e533c2d8e438ede0a70fd55", + "chksum_sha256": "bc752ed982fdc709585a8edfaaec05c4061e630414a542b0e5574bbcc61fac4a", "format": 1 }, { "name": "docs/modules/storagepool.rst", "ftype": "file", "chksum_type": "sha256", - "chksum_sha256": "eb19a36818f64d71bf2ba8836568d36dce82b2d4a112f7d516e4b7a9d7e46b18", + "chksum_sha256": "1eba8fd13dc00e5f3a8a49411058ac33165c4fb8a3e321b12a0a8e014a3fd3a8", "format": 1 }, { "name": "docs/modules/tree_quota.rst", "ftype": "file", "chksum_type": "sha256", - "chksum_sha256": "68e0ed5f7d7fd816a58711b36faef61aed44c23b67624d0c669e04a058329cf2", + "chksum_sha256": "f48926868635b9727ecc8dda8dd50da310f74cc248cc26299b5662564bfc3f7d", "format": 1 }, { "name": "docs/modules/user_quota.rst", "ftype": "file", "chksum_type": "sha256", - "chksum_sha256": "1e973112cf06e41e27c465d0e375045e6f0bfc6954a5b12325ff189c92885b9b", + "chksum_sha256": "7fe15a1a03c4d750d6197c665ebf3fe8ebf48ff1e85294b91404968bcf3bded9", "format": 1 }, { "name": "docs/modules/volume.rst", "ftype": "file", "chksum_type": "sha256", - "chksum_sha256": "206b027c28b5a0e7c4e40d6402ca45e0c6cc67c8623821c3077bf3b00a54dd13", + "chksum_sha256": "ab54ce3a682cb69c1466f1fb19e2e61f324d6675bbf8d2f2eaa771f744158fbc", "format": 1 }, { @@ -375,7 +389,147 @@ "name": "meta/runtime.yml", "ftype": "file", "chksum_type": "sha256", - "chksum_sha256": "1ad0fa1a5cceaac69ea46df66d57fe6f290544c8efa6fabd2a2982296e428536", + "chksum_sha256": "0d8f17122fc4d22811162d2eb588ef6ffdc292b62b1df6beea44e5f5fedad1d6", + "format": 1 + }, + { + "name": "playbooks", + "ftype": "dir", + "chksum_type": null, + "chksum_sha256": null, + "format": 1 + }, + { + "name": "playbooks/modules", + "ftype": "dir", + "chksum_type": null, + "chksum_sha256": null, + "format": 1 + }, + { + "name": "playbooks/modules/cifsserver.yml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "3809d62736eaf513a337ee8c371485d67798a2c4eb2398e6621d6b4b07316092", + "format": 1 + }, + { + "name": "playbooks/modules/consistencygroup.yml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "b8ff33fa32b01c77624dd935df4a32294d1760a0bd01cba923db39e0b45f69b0", + "format": 1 + }, + { + "name": "playbooks/modules/filesystem.yml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "2fd065d78705cefe3e4cce4b329c2ba318692121888f127166b25c19c9c39f5f", + "format": 1 + }, + { + "name": "playbooks/modules/filesystem_snapshot.yml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "a47f477b7afda91e280a98002e37a111a34a6d91b72fc94db1e9a377dcb223de", + "format": 1 + }, + { + "name": "playbooks/modules/host.yml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "5e87d766849fea821f0064fef19e1a76c42ac1cb2eea1bd50bc2654fe0ccd28c", + "format": 1 + }, + { + "name": "playbooks/modules/info.yml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "1d4fa965c1079707a27dea201226ea1800285476f2588bbbc6b557c1cd8f6eb0", + "format": 1 + }, + { + "name": "playbooks/modules/interface.yml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "b8447c7c2f1c6f51d9ed08ab2355e1077c92adf7de4b66560f77bb7c0b131553", + "format": 1 + }, + { + "name": "playbooks/modules/nasserver.yml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "00295ef54f3655da2e574a4c459f87a118e996604a663f707df559221630252f", + "format": 1 + }, + { + "name": "playbooks/modules/nfs.yml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "dd72bea470d6420b86418e6929a94f2eff3f8c73a028366117796db735446918", + "format": 1 + }, + { + "name": "playbooks/modules/nfsserver.yml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "6e24eff50673e48210528f515d975ceaa34dffe9ad672e22ace52736c149c704", + "format": 1 + }, + { + "name": "playbooks/modules/replication_session.yml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "ebaebacea07bbc0d7dd30df303b7b72037b64f5a83397e0a34b0911f42dc1cff", + "format": 1 + }, + { + "name": "playbooks/modules/smbshare.yml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "39553eb9b04df2a67b33c4b33a6352aedab15d998b3cb5fc598e65014d47b3ea", + "format": 1 + }, + { + "name": "playbooks/modules/snapshot.yml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "2f7eedc620a64747d90d9db4823561c992c5f2bb8a398e1b818bd0cac44cf0f0", + "format": 1 + }, + { + "name": "playbooks/modules/snapshotschedule.yml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "6fa79b8d9d454b3443a4e98b265ed62ac18b56c4b1c491a73d016fe57061da64", + "format": 1 + }, + { + "name": "playbooks/modules/storagepool.yml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "1739a3232e6aaab563dd17bd96c3e8c3b38c495b0c5d6ca010247c282b9e9d18", + "format": 1 + }, + { + "name": "playbooks/modules/tree_quota.yml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "b3dfe0414f050dfc19b12749b93c02283b43db31a6095c8937d4528a90c34e4b", + "format": 1 + }, + { + "name": "playbooks/modules/user_quota.yml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "3ba8ee6e4b62f7d5946aa2f37b8c433aa6e4f8d35a1d868f42f0d2391286eb0f", + "format": 1 + }, + { + "name": "playbooks/modules/volume.yml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "a1a67ee35bf654a58d3a554e4d714743faa1bafd6f5a8e8a912c086827f59718", "format": 1 }, { @@ -396,7 +550,7 @@ "name": "plugins/doc_fragments/unity.py", "ftype": "file", "chksum_type": "sha256", - "chksum_sha256": "59baa9afd0063cf6ccc64d0be2f93bcdac944d2d53d9a9808654d5715173eab2", + "chksum_sha256": "cf04d65ed0cf78f3979951670bace9f5930ede590cafc562bc7db97ce16238d9", "format": 1 }, { @@ -438,7 +592,7 @@ "name": "plugins/module_utils/storage/dell/utils.py", "ftype": "file", "chksum_type": "sha256", - "chksum_sha256": "7fec20103cba14b247e99885a64d5f447876743d1a2c1aabfa41344fa3b5811a", + "chksum_sha256": "b85cdbfe3e6b2212fb53f5e1586853164ece1bb2124fa31875180c0b997e24db", "format": 1 }, { @@ -452,126 +606,133 @@ "name": "plugins/modules/cifsserver.py", "ftype": "file", "chksum_type": "sha256", - "chksum_sha256": "ad663a0af0d1f0dc86ea15772d49cb79813e5970abeadc5fa88ff0fbb798f1c9", + "chksum_sha256": "725164681ca1d8e611b4c51a45881c42f9fb4255e07146d24db04c40f6aa4f2e", "format": 1 }, { "name": "plugins/modules/consistencygroup.py", "ftype": "file", "chksum_type": "sha256", - "chksum_sha256": "84a261b6260c02d87c16108a949a7a9861c837d8b90630059d159418986a2167", + "chksum_sha256": "4db39611403cf3c3acd0290d26f7de37bf680a50d51b86106b1658060f9e3af3", "format": 1 }, { "name": "plugins/modules/filesystem.py", "ftype": "file", "chksum_type": "sha256", - "chksum_sha256": "ea31747f729d9e933d6f10ceee77c69a8fe924a9b8b55ea52eabd65a4c48e69c", + "chksum_sha256": "c3f3ff2fd8bb07a600a25cecaf00caa533dd8d242903cdd24dc8c25381953d63", "format": 1 }, { "name": "plugins/modules/filesystem_snapshot.py", "ftype": "file", "chksum_type": "sha256", - "chksum_sha256": "6d01454f787b460865970a4a0607590874a8ac974b03e10fc4a336ae9ed97522", + "chksum_sha256": "c9c6eb9dbf17604409652740babf1bac714c487d56f78dae4fd5dbab88037cb2", "format": 1 }, { "name": "plugins/modules/host.py", "ftype": "file", "chksum_type": "sha256", - "chksum_sha256": "c84b7702c1aa417739ac3a3e6e5102ee5a0489b71f481bd5b33d80d73ed01ba0", + "chksum_sha256": "94913be39ce75c16165eeb84e46ab8396322d14205c21d8046d53732fa1921e4", "format": 1 }, { "name": "plugins/modules/info.py", "ftype": "file", "chksum_type": "sha256", - "chksum_sha256": "4f19b0105b22885b546964e9f8316c837cc0ddb0a91d94a07f84317a9358eedd", + "chksum_sha256": "9653d4b095f23e5b1dfd53c5485611457bffe6807643f898635d4bc41c74630e", "format": 1 }, { "name": "plugins/modules/interface.py", "ftype": "file", "chksum_type": "sha256", - "chksum_sha256": "492628928153228d7934856ec4861b169540aa2cba74c89d493705ce243b3661", + "chksum_sha256": "ed2d921df52b3a54e41f5279240402f290c9f4d5a7c36c4ccb442fb0b7bc0f02", "format": 1 }, { "name": "plugins/modules/nasserver.py", "ftype": "file", "chksum_type": "sha256", - "chksum_sha256": "fe7701ebc60a48151cc72b7463cf8bf3c73c31adb1dded7e487ab49054f95112", + "chksum_sha256": "c9909cc77062b9e43e54f2b62b3407412cc68915b5e7bc8f0b3726bec091b381", "format": 1 }, { "name": "plugins/modules/nfs.py", "ftype": "file", "chksum_type": "sha256", - "chksum_sha256": "93f0a525a5f4a4da9e3d51526e97539a7d2929baf68d4f3b048ec1ea63b79528", + "chksum_sha256": "72d5eb3a6bed5969eb5e656bdf1965bce77a790c7e0f6909019ab493dd7cb08e", "format": 1 }, { "name": "plugins/modules/nfsserver.py", "ftype": "file", "chksum_type": "sha256", - "chksum_sha256": "40554df77af25ca89f7cc4757fd45d8493a269d136e1818f5c2fc3584372de1b", + "chksum_sha256": "4629fa9ca28f77bd3de962fe5ee226a814153bdce75d3d8c6089210217a4c3e2", + "format": 1 + }, + { + "name": "plugins/modules/replication_session.py", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "6a558a66364e9bfbd0bca35999951ef0eacc3e629ba6139f00612a9522460d1f", "format": 1 }, { "name": "plugins/modules/smbshare.py", "ftype": "file", "chksum_type": "sha256", - "chksum_sha256": "7b40e8869df87faefa535902c72a32c68f650ae77f5a0ad9941d12e2c97dbbb1", + "chksum_sha256": "6812eafdad4de20ea4105921fc3f06c9e1082df13e71035100bfeb374e4a7067", "format": 1 }, { "name": "plugins/modules/snapshot.py", "ftype": "file", "chksum_type": "sha256", - "chksum_sha256": "8029c7c788f29e0079f78b3c5ded6194aab6fa32e8e63491c43415a543cfecc5", + "chksum_sha256": "05f8a7b43e33347e1a71283c87f1af24a696836b52ffb271e96c601ca74d6ba4", "format": 1 }, { "name": "plugins/modules/snapshotschedule.py", "ftype": "file", "chksum_type": "sha256", - "chksum_sha256": "046673dba8971fc40b4ccdce39de288b6e9ba7f1a18963f3cd486ab0d24e9dd6", + "chksum_sha256": "6214c681ce55b24a89c8307e55d56f770665227d40929e918d906c20570a0c2d", "format": 1 }, { "name": "plugins/modules/storagepool.py", "ftype": "file", "chksum_type": "sha256", - "chksum_sha256": "59696ca229b897b7f546c4e332143d4591aaf4eea3df2d3e808cbff0204f1d7c", + "chksum_sha256": "da90ecfe49e95add45dd9b936905d5d8e3076ad3aab4416ec9823583ad1c4cd3", "format": 1 }, { "name": "plugins/modules/tree_quota.py", "ftype": "file", "chksum_type": "sha256", - "chksum_sha256": "ada935019e3b1e4fc61cae3c4134fbf1481058fb8245be836000850ad56e7009", + "chksum_sha256": "494320b0e7cc55515bb85d9a39e20f4c01a8dfbafae9b3855e46ec3a3c98898b", "format": 1 }, { "name": "plugins/modules/user_quota.py", "ftype": "file", "chksum_type": "sha256", - "chksum_sha256": "228c82f62dca70b8c4ab613c6c935ed022a44c014b2d3752e9cd2856e876707b", + "chksum_sha256": "bd9b8bc4f0b76cea3e13d0ccf7ec7ac1f41ab3d73609d732c07720aac1df99b1", "format": 1 }, { "name": "plugins/modules/volume.py", "ftype": "file", "chksum_type": "sha256", - "chksum_sha256": "8d4064bc0a20e43ba0c45110563315f481220d485af3a2289fc8a4786f8b3814", + "chksum_sha256": "d93a6b6a055cbe33647c1386b2e9efdc86465c286a5a79b02e0370497a8b4b2b", "format": 1 }, { "name": "requirements.txt", "ftype": "file", "chksum_type": "sha256", - "chksum_sha256": "ea96c62d419724d448e0ed0b2099f5242e6a9cc26abca64844f1ed99c082e844", + "chksum_sha256": "5d35d3ccd9770146a1eedb946a9207317ae60ff9f09f074fcaacbe2750e083d4", "format": 1 }, { @@ -603,24 +764,24 @@ "format": 1 }, { - "name": "tests/sanity/ignore-2.12.txt", + "name": "tests/sanity/ignore-2.13.txt", "ftype": "file", "chksum_type": "sha256", - "chksum_sha256": "2e85c8aca7d338809e87300cf372956e1b4850ece6bc475f6fa4c66ca405812a", + "chksum_sha256": "8286d2f238aa5a2835bdd8a9ff38663a0e70b416a2b4a2971a54d75d76a349e7", "format": 1 }, { - "name": "tests/sanity/ignore-2.13.txt", + "name": "tests/sanity/ignore-2.14.txt", "ftype": "file", "chksum_type": "sha256", - "chksum_sha256": "bb03c71bf8838c2b75394a5100397d843b8741a8d3814446f928c7ddaa265ffd", + "chksum_sha256": "8286d2f238aa5a2835bdd8a9ff38663a0e70b416a2b4a2971a54d75d76a349e7", "format": 1 }, { - "name": "tests/sanity/ignore-2.14.txt", + "name": "tests/sanity/ignore-2.15.txt", "ftype": "file", "chksum_type": "sha256", - "chksum_sha256": "bb03c71bf8838c2b75394a5100397d843b8741a8d3814446f928c7ddaa265ffd", + "chksum_sha256": "8286d2f238aa5a2835bdd8a9ff38663a0e70b416a2b4a2971a54d75d76a349e7", "format": 1 }, { @@ -655,7 +816,7 @@ "name": "tests/unit/plugins/module_utils/mock_cifsserver_api.py", "ftype": "file", "chksum_type": "sha256", - "chksum_sha256": "b864ceef5c5db21f3282a76094c8d9226186dadebf9851432fff4fb57e59cfad", + "chksum_sha256": "4b0f47afe54a544f0aa9cabed74a5511c1e798ae12daee78ddd85e1bbf76d456", "format": 1 }, { @@ -680,10 +841,17 @@ "format": 1 }, { + "name": "tests/unit/plugins/module_utils/mock_info_api.py", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "d8237dc997fb5915a7aad313a11010f651d4d46ff53a6b0edca3811d0f71ca5b", + "format": 1 + }, + { "name": "tests/unit/plugins/module_utils/mock_interface_api.py", "ftype": "file", "chksum_type": "sha256", - "chksum_sha256": "6c8de82b6b7311a2ec191fc510d0bc06cde5e0627f74e83711de69c629e826fc", + "chksum_sha256": "0195681753eabd889203311a381397c9bbf483438b9a1dcb520f20b8c11d3d22", "format": 1 }, { @@ -704,7 +872,14 @@ "name": "tests/unit/plugins/module_utils/mock_nfsserver_api.py", "ftype": "file", "chksum_type": "sha256", - "chksum_sha256": "03b34a46b5c55696c4741dbd3749b1a654cf401e29e79443908145ef87ff5994", + "chksum_sha256": "90bf4f60e96b65e52328c269520c444094c897a4c58f5415045ee5d403f8b100", + "format": 1 + }, + { + "name": "tests/unit/plugins/module_utils/mock_replication_session_api.py", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "3f11b929be0bde059e7c8cb26d389c978fbe296a4d456a9a5427988aab3fb392", "format": 1 }, { @@ -725,7 +900,7 @@ "name": "tests/unit/plugins/module_utils/mock_volume_api.py", "ftype": "file", "chksum_type": "sha256", - "chksum_sha256": "80d7788c208356919f39c49c924745263eb96806ca95ce60a1030822455ed48e", + "chksum_sha256": "c033edbccc18e2c37683259706cbbdd90565e252bd63520ac87987a0ada87924", "format": 1 }, { @@ -739,7 +914,7 @@ "name": "tests/unit/plugins/modules/test_cifsserver.py", "ftype": "file", "chksum_type": "sha256", - "chksum_sha256": "7031be0fee19af368f61e6f07404c941ec64139f066514eeca48a5f3c9224749", + "chksum_sha256": "8db360d0a119fbd207a12efb73c170bcaa4a2b680484c927759dc5fb84ca5db7", "format": 1 }, { @@ -760,7 +935,14 @@ "name": "tests/unit/plugins/modules/test_host.py", "ftype": "file", "chksum_type": "sha256", - "chksum_sha256": "cbc6464fdcbc66df43da1ef26cbf64d86b77406f28ded032dc7c7c4da6034cd0", + "chksum_sha256": "e8432a8d9d6b6b55ded117818178ed7f7d5fc5c99dfadcdb524fb650c1a68244", + "format": 1 + }, + { + "name": "tests/unit/plugins/modules/test_info.py", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "86e434e614ac38382a05373df79f20ad2343be0167e5cb826f7ac6b374e76100", "format": 1 }, { @@ -788,28 +970,28 @@ "name": "tests/unit/plugins/modules/test_nfsserver.py", "ftype": "file", "chksum_type": "sha256", - "chksum_sha256": "72726040ab5aff9e023872018e3abd192dba24acc41be7137d3f98ae7712c444", + "chksum_sha256": "0050135f054b1c8ef45f8bf5fda2627bf7f59ff898934d59db2f513c15ca1a0e", "format": 1 }, { - "name": "tests/unit/plugins/modules/test_storagepool.py", + "name": "tests/unit/plugins/modules/test_replication_session.py", "ftype": "file", "chksum_type": "sha256", - "chksum_sha256": "63dafda1a4e630b23a637affabacfefd5c14a3231a0fae02d3886b0bf7656525", + "chksum_sha256": "882ae8076ac1acabf1bb187da4a2fc2ef70155b23fd733e4e9f1f4530ad4b7a9", "format": 1 }, { - "name": "tests/unit/plugins/modules/test_volume.py", + "name": "tests/unit/plugins/modules/test_storagepool.py", "ftype": "file", "chksum_type": "sha256", - "chksum_sha256": "5bc48d2969cfaa5670ab538ba51cef532e1c3177004e2a2d6dbbd2cd7b4e7714", + "chksum_sha256": "63dafda1a4e630b23a637affabacfefd5c14a3231a0fae02d3886b0bf7656525", "format": 1 }, { - "name": "ansible.cfg", + "name": "tests/unit/plugins/modules/test_volume.py", "ftype": "file", "chksum_type": "sha256", - "chksum_sha256": "5360ab997ea2c7ed8a6efc7e8324e7b6ec7479af057fe15ff23fe885f05b58b2", + "chksum_sha256": "5bc48d2969cfaa5670ab538ba51cef532e1c3177004e2a2d6dbbd2cd7b4e7714", "format": 1 } ], diff --git a/ansible_collections/dellemc/unity/MANIFEST.json b/ansible_collections/dellemc/unity/MANIFEST.json index bff7c8f2f..fbd2511d5 100644 --- a/ansible_collections/dellemc/unity/MANIFEST.json +++ b/ansible_collections/dellemc/unity/MANIFEST.json @@ -2,7 +2,7 @@ "collection_info": { "namespace": "dellemc", "name": "unity", - "version": "1.6.0", + "version": "1.7.1", "authors": [ "Akash Shendge <ansible.team@dell.com>", "Ambuj Dubey <ansible.team@dell.com>", @@ -25,16 +25,16 @@ ], "license_file": null, "dependencies": {}, - "repository": "https://github.com/dell/ansible-unity/tree/1.6.0", - "documentation": "https://github.com/dell/ansible-unity/tree/1.6.0/docs", - "homepage": "https://github.com/dell/ansible-unity/tree/1.6.0", + "repository": "https://github.com/dell/ansible-unity/tree/1.7.1", + "documentation": "https://github.com/dell/ansible-unity/tree/1.7.1/docs", + "homepage": "https://github.com/dell/ansible-unity/tree/1.7.1", "issues": "https://www.dell.com/community/Automation/bd-p/Automation" }, "file_manifest_file": { "name": "FILES.json", "ftype": "file", "chksum_type": "sha256", - "chksum_sha256": "de87855f156b345c7d278a09b66679818c6ddcf5544a868ec8bd68dc4c2d5162", + "chksum_sha256": "3a6859700a30b9a90ae32f32e2e99b09a7289bf793832b1657a943ecdb8604d8", "format": 1 }, "format": 1 diff --git a/ansible_collections/dellemc/unity/README.md b/ansible_collections/dellemc/unity/README.md index 58dbb9539..a50754721 100644 --- a/ansible_collections/dellemc/unity/README.md +++ b/ansible_collections/dellemc/unity/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.1/docs/CODE_OF_CONDUCT.md) +* [Maintainer guide](https://github.com/dell/ansible-unity/blob/1.7.1/docs/MAINTAINER_GUIDE.md) +* [Committer guide](https://github.com/dell/ansible-unity/blob/1.7.1/docs/COMMITTER_GUIDE.md) +* [Contributing guide](https://github.com/dell/ansible-unity/blob/1.7.1/docs/CONTRIBUTING.md) +* [Branching strategy](https://github.com/dell/ansible-unity/blob/1.7.1/docs/BRANCHING.md) +* [List of adopters](https://github.com/dell/ansible-unity/blob/1.7.1/docs/ADOPTERS.md) +* [Maintainers](https://github.com/dell/ansible-unity/blob/1.7.1/docs/MAINTAINERS.md) +* [Support](https://github.com/dell/ansible-unity/blob/1.7.1/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.1/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.1/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.1/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 <br> 3.10 <br> 3.11 | 1.2.11 | 2.12 <br> 2.13 <br> 2.14| +| v1.7.1 | 3.9 <br> 3.10 <br> 3.11 | 1.2.11 | 2.13 <br> 2.14 <br> 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.1/docs/modules/consistencygroup.rst) + * [Filesystem module](https://github.com/dell/ansible-unity/blob/1.7.1/docs/modules/filesystem.rst) + * [Filesystem snapshot module](https://github.com/dell/ansible-unity/blob/1.7.1/docs/modules/filesystem_snapshot.rst) + * [Info module](https://github.com/dell/ansible-unity/blob/1.7.1/docs/modules/info.rst) + * [Host module](https://github.com/dell/ansible-unity/blob/1.7.1/docs/modules/host.rst) + * [CIFS server module](https://github.com/dell/ansible-unity/blob/1.7.1/docs/modules/cifsserver.rst) + * [NAS server module](https://github.com/dell/ansible-unity/blob/1.7.1/docs/modules/nasserver.rst) + * [NFS server module](https://github.com/dell/ansible-unity/blob/1.7.1/docs/modules/nfsserver.rst) + * [NFS export module](https://github.com/dell/ansible-unity/blob/1.7.1/docs/modules/nfs.rst) + * [SMB share module](https://github.com/dell/ansible-unity/blob/1.7.1/docs/modules/smbshare.rst) + * [Interface module](https://github.com/dell/ansible-unity/blob/1.7.1/docs/modules/interface.rst) + * [Snapshot module](https://github.com/dell/ansible-unity/blob/1.7.1/docs/modules/snapshot.rst) + * [Snapshot schedule module](https://github.com/dell/ansible-unity/blob/1.7.1/docs/modules/snapshotschedule.rst) + * [Storage pool module](https://github.com/dell/ansible-unity/blob/1.7.1/docs/modules/storagepool.rst) + * [User quota module](https://github.com/dell/ansible-unity/blob/1.7.1/docs/modules/user_quota.rste) + * [Quota tree module ](https://github.com/dell/ansible-unity/blob/1.7.1/docs/modules/tree_quota.rst) + * [Volume module](https://github.com/dell/ansible-unity/blob/1.7.1/docs/modules/volume.rst) + * [Replication session module](https://github.com/dell/ansible-unity/blob/1.7.1/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.1/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.1/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/ansible_collections/dellemc/unity/ansible.cfg b/ansible_collections/dellemc/unity/ansible.cfg deleted file mode 100644 index c10d1da22..000000000 --- a/ansible_collections/dellemc/unity/ansible.cfg +++ /dev/null @@ -1,484 +0,0 @@ -# config file for ansible -- https://ansible.com/ -# =============================================== - -# nearly all parameters can be overridden in ansible-playbook -# or with command line flags. ansible will read ANSIBLE_CONFIG, -# ansible.cfg in the current working directory, .ansible.cfg in -# the home directory or /etc/ansible/ansible.cfg, whichever it -# finds first - -[defaults] - -# some basic default values... - -#inventory = /etc/ansible/hosts -#library = /usr/share/my_modules/ -#module_utils = /usr/share/my_module_utils/ -#remote_tmp = ~/.ansible/tmp -#local_tmp = ~/.ansible/tmp -#plugin_filters_cfg = /etc/ansible/plugin_filters.yml -#forks = 5 -#poll_interval = 15 -#sudo_user = root -#ask_sudo_pass = True -#ask_pass = True -#transport = smart -#remote_port = 22 -#module_lang = C -#module_set_locale = False - -# plays will gather facts by default, which contain information about -# the remote system. -# -# smart - gather by default, but don't regather if already gathered -# implicit - gather by default, turn off with gather_facts: False -# explicit - do not gather by default, must say gather_facts: True -#gathering = implicit - -# This only affects the gathering done by a play's gather_facts directive, -# by default gathering retrieves all facts subsets -# all - gather all subsets -# network - gather min and network facts -# hardware - gather hardware facts (longest facts to retrieve) -# virtual - gather min and virtual facts -# facter - import facts from facter -# ohai - import facts from ohai -# You can combine them using comma (ex: network,virtual) -# You can negate them using ! (ex: !hardware,!facter,!ohai) -# A minimal set of facts is always gathered. -#gather_subset = all - -# some hardware related facts are collected -# with a maximum timeout of 10 seconds. This -# option lets you increase or decrease that -# timeout to something more suitable for the -# environment. -# gather_timeout = 10 - -# additional paths to search for roles in, colon separated -#roles_path = /etc/ansible/roles - -# uncomment this to disable SSH key host checking -#host_key_checking = False - -# change the default callback, you can only have one 'stdout' type enabled at a time. -#stdout_callback = skippy - - -## Ansible ships with some plugins that require whitelisting, -## this is done to avoid running all of a type by default. -## These setting lists those that you want enabled for your system. -## Custom plugins should not need this unless plugin author specifies it. - -# enable callback plugins, they can output to stdout but cannot be 'stdout' type. -#callback_whitelist = timer, mail - -# Determine whether includes in tasks and handlers are "static" by -# default. As of 2.0, includes are dynamic by default. Setting these -# values to True will make includes behave more like they did in the -# 1.x versions. -#task_includes_static = False -#handler_includes_static = False - -# Controls if a missing handler for a notification event is an error or a warning -#error_on_missing_handler = True - -# change this for alternative sudo implementations -#sudo_exe = sudo - -# What flags to pass to sudo -# WARNING: leaving out the defaults might create unexpected behaviours -#sudo_flags = -H -S -n - -# SSH timeout -#timeout = 10 - -# default user to use for playbooks if user is not specified -# (/usr/bin/ansible will use current user as default) -#remote_user = root - -# logging is off by default unless this path is defined -# if so defined, consider logrotate -#log_path = /var/log/ansible.log - -# default module name for /usr/bin/ansible -#module_name = command - -# use this shell for commands executed under sudo -# you may need to change this to bin/bash in rare instances -# if sudo is constrained -#executable = /bin/sh - -# if inventory variables overlap, does the higher precedence one win -# or are hash values merged together? The default is 'replace' but -# this can also be set to 'merge'. -#hash_behaviour = replace - -# by default, variables from roles will be visible in the global variable -# scope. To prevent this, the following option can be enabled, and only -# tasks and handlers within the role will see the variables there -#private_role_vars = yes - -# list any Jinja2 extensions to enable here: -#jinja2_extensions = jinja2.ext.do,jinja2.ext.i18n - -# if set, always use this private key file for authentication, same as -# if passing --private-key to ansible or ansible-playbook -#private_key_file = /path/to/file - -# If set, configures the path to the Vault password file as an alternative to -# specifying --vault-password-file on the command line. -#vault_password_file = /path/to/vault_password_file - -# format of string {{ ansible_managed }} available within Jinja2 -# templates indicates to users editing templates files will be replaced. -# replacing {file}, {host} and {uid} and strftime codes with proper values. -#ansible_managed = Ansible managed: {file} modified on %Y-%m-%d %H:%M:%S by {uid} on {host} -# {file}, {host}, {uid}, and the timestamp can all interfere with idempotence -# in some situations so the default is a static string: -#ansible_managed = Ansible managed - -# by default, ansible-playbook will display "Skipping [host]" if it determines a task -# should not be run on a host. Set this to "False" if you don't want to see these "Skipping" -# messages. NOTE: the task header will still be shown regardless of whether or not the -# task is skipped. -#display_skipped_hosts = True - -# by default, if a task in a playbook does not include a name: field then -# ansible-playbook will construct a header that includes the task's action but -# not the task's args. This is a security feature because ansible cannot know -# if the *module* considers an argument to be no_log at the time that the -# header is printed. If your environment doesn't have a problem securing -# stdout from ansible-playbook (or you have manually specified no_log in your -# playbook on all of the tasks where you have secret information) then you can -# safely set this to True to get more informative messages. -#display_args_to_stdout = False - -# by default (as of 1.3), Ansible will raise errors when attempting to dereference -# Jinja2 variables that are not set in templates or action lines. Uncomment this line -# to revert the behavior to pre-1.3. -#error_on_undefined_vars = False - -# by default (as of 1.6), Ansible may display warnings based on the configuration of the -# system running ansible itself. This may include warnings about 3rd party packages or -# other conditions that should be resolved if possible. -# to disable these warnings, set the following value to False: -#system_warnings = True - -# by default (as of 1.4), Ansible may display deprecation warnings for language -# features that should no longer be used and will be removed in future versions. -# to disable these warnings, set the following value to False: -#deprecation_warnings = True - -# (as of 1.8), Ansible can optionally warn when usage of the shell and -# command module appear to be simplified by using a default Ansible module -# instead. These warnings can be silenced by adjusting the following -# setting or adding warn=yes or warn=no to the end of the command line -# parameter string. This will for example suggest using the git module -# instead of shelling out to the git command. -# command_warnings = False - - -# set plugin path directories here, separate with colons -#action_plugins = /usr/share/ansible/plugins/action -#cache_plugins = /usr/share/ansible/plugins/cache -#callback_plugins = /usr/share/ansible/plugins/callback -#connection_plugins = /usr/share/ansible/plugins/connection -#lookup_plugins = /usr/share/ansible/plugins/lookup -#inventory_plugins = /usr/share/ansible/plugins/inventory -#vars_plugins = /usr/share/ansible/plugins/vars -#filter_plugins = /usr/share/ansible/plugins/filter -#test_plugins = /usr/share/ansible/plugins/test -#terminal_plugins = /usr/share/ansible/plugins/terminal -#strategy_plugins = /usr/share/ansible/plugins/strategy - - -# by default, ansible will use the 'linear' strategy but you may want to try -# another one -#strategy = free - -# by default callbacks are not loaded for /bin/ansible, enable this if you -# want, for example, a notification or logging callback to also apply to -# /bin/ansible runs -#bin_ansible_callbacks = False - - -# don't like cows? that's unfortunate. -# set to 1 if you don't want cowsay support or export ANSIBLE_NOCOWS=1 -#nocows = 1 - -# set which cowsay stencil you'd like to use by default. When set to 'random', -# a random stencil will be selected for each task. The selection will be filtered -# against the `cow_whitelist` option below. -#cow_selection = default -#cow_selection = random - -# when using the 'random' option for cowsay, stencils will be restricted to this list. -# it should be formatted as a comma-separated list with no spaces between names. -# NOTE: line continuations here are for formatting purposes only, as the INI parser -# in python does not support them. -#cow_whitelist=bud-frogs,bunny,cheese,daemon,default,dragon,elephant-in-snake,elephant,eyes,\ -# hellokitty,kitty,luke-koala,meow,milk,moofasa,moose,ren,sheep,small,stegosaurus,\ -# stimpy,supermilker,three-eyes,turkey,turtle,tux,udder,vader-koala,vader,www - -# don't like colors either? -# set to 1 if you don't want colors, or export ANSIBLE_NOCOLOR=1 -#nocolor = 1 - -# if set to a persistent type (not 'memory', for example 'redis') fact values -# from previous runs in Ansible will be stored. This may be useful when -# wanting to use, for example, IP information from one group of servers -# without having to talk to them in the same playbook run to get their -# current IP information. -#fact_caching = memory - - -# retry files -# When a playbook fails by default a .retry file will be created in ~/ -# You can disable this feature by setting retry_files_enabled to False -# and you can change the location of the files by setting retry_files_save_path - -#retry_files_enabled = False -#retry_files_save_path = ~/.ansible-retry - -# squash actions -# Ansible can optimise actions that call modules with list parameters -# when looping. Instead of calling the module once per with_ item, the -# module is called once with all items at once. Currently this only works -# under limited circumstances, and only with parameters named 'name'. -#squash_actions = apk,apt,dnf,homebrew,pacman,pkgng,yum,zypper - -# prevents logging of task data, off by default -#no_log = False - -# prevents logging of tasks, but only on the targets, data is still logged on the master/controller -#no_target_syslog = False - -# controls whether Ansible will raise an error or warning if a task has no -# choice but to create world readable temporary files to execute a module on -# the remote machine. This option is False by default for security. Users may -# turn this on to have behaviour more like Ansible prior to 2.1.x. See -# https://docs.ansible.com/ansible/become.html#becoming-an-unprivileged-user -# for more secure ways to fix this than enabling this option. -#allow_world_readable_tmpfiles = False - -# controls the compression level of variables sent to -# worker processes. At the default of 0, no compression -# is used. This value must be an integer from 0 to 9. -#var_compression_level = 9 - -# controls what compression method is used for new-style ansible modules when -# they are sent to the remote system. The compression types depend on having -# support compiled into both the controller's python and the client's python. -# The names should match with the python Zipfile compression types: -# * ZIP_STORED (no compression. available everywhere) -# * ZIP_DEFLATED (uses zlib, the default) -# These values may be set per host via the ansible_module_compression inventory -# variable -#module_compression = 'ZIP_DEFLATED' - -# This controls the cutoff point (in bytes) on --diff for files -# set to 0 for unlimited (RAM may suffer!). -#max_diff_size = 1048576 - -# This controls how ansible handles multiple --tags and --skip-tags arguments -# on the CLI. If this is True then multiple arguments are merged together. If -# it is False, then the last specified argument is used and the others are ignored. -# This option will be removed in 2.8. -#merge_multiple_cli_flags = True - -# Controls showing custom stats at the end, off by default -#show_custom_stats = True - -# Controls which files to ignore when using a directory as inventory with -# possibly multiple sources (both static and dynamic) -#inventory_ignore_extensions = ~, .orig, .bak, .ini, .cfg, .retry, .pyc, .pyo - -# This family of modules use an alternative execution path optimized for network appliances -# only update this setting if you know how this works, otherwise it can break module execution -#network_group_modules=eos, nxos, ios, iosxr, junos, vyos - -# When enabled, this option allows lookups (via variables like {{lookup('foo')}} or when used as -# a loop with `with_foo`) to return data that is not marked "unsafe". This means the data may contain -# jinja2 templating language which will be run through the templating engine. -# ENABLING THIS COULD BE A SECURITY RISK -#allow_unsafe_lookups = False - -# set default errors for all plays -#any_errors_fatal = False - -[inventory] -# enable inventory plugins, default: 'host_list', 'script', 'yaml', 'ini' -#enable_plugins = host_list, virtualbox, yaml, constructed - -# ignore these extensions when parsing a directory as inventory source -#ignore_extensions = .pyc, .pyo, .swp, .bak, ~, .rpm, .md, .txt, ~, .orig, .ini, .cfg, .retry - -# ignore files matching these patterns when parsing a directory as inventory source -#ignore_patterns= - -# If 'true' unparsed inventory sources become fatal errors, they are warnings otherwise. -#unparsed_is_failed=False - -[privilege_escalation] -#become=True -#become_method=sudo -#become_user=root -#become_ask_pass=False - -[paramiko_connection] - -# uncomment this line to cause the paramiko connection plugin to not record new host -# keys encountered. Increases performance on new host additions. Setting works independently of the -# host key checking setting above. -#record_host_keys=False - -# by default, Ansible requests a pseudo-terminal for commands executed under sudo. Uncomment this -# line to disable this behaviour. -#pty=False - -# paramiko will default to looking for SSH keys initially when trying to -# authenticate to remote devices. This is a problem for some network devices -# that close the connection after a key failure. Uncomment this line to -# disable the Paramiko look for keys function -#look_for_keys = False - -# When using persistent connections with Paramiko, the connection runs in a -# background process. If the host doesn't already have a valid SSH key, by -# default Ansible will prompt to add the host key. This will cause connections -# running in background processes to fail. Uncomment this line to have -# Paramiko automatically add host keys. -#host_key_auto_add = True - -[ssh_connection] - -# ssh arguments to use -# Leaving off ControlPersist will result in poor performance, so use -# paramiko on older platforms rather than removing it, -C controls compression use -#ssh_args = -C -o ControlMaster=auto -o ControlPersist=60s - -# The base directory for the ControlPath sockets. -# This is the "%(directory)s" in the control_path option -# -# Example: -# control_path_dir = /tmp/.ansible/cp -#control_path_dir = ~/.ansible/cp - -# The path to use for the ControlPath sockets. This defaults to a hashed string of the hostname, -# port and username (empty string in the config). The hash mitigates a common problem users -# found with long hostames and the conventional %(directory)s/ansible-ssh-%%h-%%p-%%r format. -# In those cases, a "too long for Unix domain socket" ssh error would occur. -# -# Example: -# control_path = %(directory)s/%%h-%%r -#control_path = - -# Enabling pipelining reduces the number of SSH operations required to -# execute a module on the remote server. This can result in a significant -# performance improvement when enabled, however when using "sudo:" you must -# first disable 'requiretty' in /etc/sudoers -# -# By default, this option is disabled to preserve compatibility with -# sudoers configurations that have requiretty (the default on many distros). -# -#pipelining = False - -# Control the mechanism for transferring files (old) -# * smart = try sftp and then try scp [default] -# * True = use scp only -# * False = use sftp only -#scp_if_ssh = smart - -# Control the mechanism for transferring files (new) -# If set, this will override the scp_if_ssh option -# * sftp = use sftp to transfer files -# * scp = use scp to transfer files -# * piped = use 'dd' over SSH to transfer files -# * smart = try sftp, scp, and piped, in that order [default] -#transfer_method = smart - -# if False, sftp will not use batch mode to transfer files. This may cause some -# types of file transfer failures impossible to catch however, and should -# only be disabled if your sftp version has problems with batch mode -#sftp_batch_mode = False - -# The -tt argument is passed to ssh when pipelining is not enabled because sudo -# requires a tty by default. -#use_tty = True - -[persistent_connection] - -# Configures the persistent connection timeout value in seconds. This value is -# how long the persistent connection will remain idle before it is destroyed. -# If the connection doesn't receive a request before the timeout value -# expires, the connection is shutdown. The default value is 30 seconds. -#connect_timeout = 30 - -# Configures the persistent connection retry timeout. This value configures the -# the retry timeout that ansible-connection will wait to connect -# to the local domain socket. This value must be larger than the -# ssh timeout (timeout) and less than persistent connection idle timeout (connect_timeout). -# The default value is 15 seconds. -#connect_retry_timeout = 15 - -# The command timeout value defines the amount of time to wait for a command -# or RPC call before timing out. The value for the command timeout must -# be less than the value of the persistent connection idle timeout (connect_timeout) -# The default value is 10 second. -#command_timeout = 10 - -[accelerate] -#accelerate_port = 5099 -#accelerate_timeout = 30 -#accelerate_connect_timeout = 5.0 - -# The daemon timeout is measured in minutes. This time is measured -# from the last activity to the accelerate daemon. -#accelerate_daemon_timeout = 30 - -# If set to yes, accelerate_multi_key will allow multiple -# private keys to be uploaded to it, though each user must -# have access to the system via SSH to add a new key. The default -# is "no". -#accelerate_multi_key = yes - -[selinux] -# file systems that require special treatment when dealing with security context -# the default behaviour that copies the existing context or uses the user default -# needs to be changed to use the file system dependent context. -#special_context_filesystems=nfs,vboxsf,fuse,ramfs,9p - -# Set this to yes to allow libvirt_lxc connections to work without SELinux. -#libvirt_lxc_noseclabel = yes - -[colors] -#highlight = white -#verbose = blue -#warn = bright purple -#error = red -#debug = dark gray -#deprecate = purple -#skip = cyan -#unreachable = red -#ok = green -#changed = yellow -#diff_add = green -#diff_remove = red -#diff_lines = cyan - - -[diff] -# Always print diff when running ( same as always running with -D/--diff ) -# always = no - -# Set how many context lines to show in diff -# context = 3 - -[galaxy] -server_list = automation_hub - -[galaxy_server.automation_hub] -url=https://cloud.redhat.com/api/automation-hub/ -auth_url=https://sso.redhat.com/auth/realms/redhat-external/protocol/openid-connect/token/ - -token=eyJhbGciOiJIUzI1NiIsInR5cCIgOiAiSldUIiwia2lkIiA6ICJhZDUyMjdhMy1iY2ZkLTRjZjAtYTdiNi0zOTk4MzVhMDg1NjYifQ.eyJpYXQiOjE2NzkzMDkyMTcsImp0aSI6IjJmZTdjZjA1LTAxZDQtNDMwMi1iMWNlLTgzNjlhNWJmNjViMyIsImlzcyI6Imh0dHBzOi8vc3NvLnJlZGhhdC5jb20vYXV0aC9yZWFsbXMvcmVkaGF0LWV4dGVybmFsIiwiYXVkIjoiaHR0cHM6Ly9zc28ucmVkaGF0LmNvbS9hdXRoL3JlYWxtcy9yZWRoYXQtZXh0ZXJuYWwiLCJzdWIiOiJmOjUyOGQ3NmZmLWY3MDgtNDNlZC04Y2Q1LWZlMTZmNGZlMGNlNjpqZW5uaWZlcl9qb2huIiwidHlwIjoiT2ZmbGluZSIsImF6cCI6ImNsb3VkLXNlcnZpY2VzIiwibm9uY2UiOiJmZTY2MGYxMS1kODFjLTQ2YWItYTkzNS1hZTAxZmY2MjA2OTciLCJzZXNzaW9uX3N0YXRlIjoiMzI3ZDlhNjgtZTkxMi00N2NiLWI3NDctNWE5YmQzZTJlZjlmIiwic2NvcGUiOiJvcGVuaWQgYXBpLmlhbS5zZXJ2aWNlX2FjY291bnRzIGFwaS5pYW0ub3JnYW5pemF0aW9uIG9mZmxpbmVfYWNjZXNzIiwic2lkIjoiMzI3ZDlhNjgtZTkxMi00N2NiLWI3NDctNWE5YmQzZTJlZjlmIn0.iGbseoF6AXetWNa0sFsfzbmzvizwaBcY0rd14YFJqcU
\ No newline at end of file diff --git a/ansible_collections/dellemc/unity/changelogs/.plugin-cache.yaml b/ansible_collections/dellemc/unity/changelogs/.plugin-cache.yaml index 40d737b5f..5e4c94e39 100644 --- a/ansible_collections/dellemc/unity/changelogs/.plugin-cache.yaml +++ b/ansible_collections/dellemc/unity/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.1 diff --git a/ansible_collections/dellemc/unity/changelogs/changelog.yaml b/ansible_collections/dellemc/unity/changelogs/changelog.yaml index ee13691d9..6ab226ac6 100644 --- a/ansible_collections/dellemc/unity/changelogs/changelog.yaml +++ b/ansible_collections/dellemc/unity/changelogs/changelog.yaml @@ -153,7 +153,24 @@ 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' + 1.7.1: + changes: + minor_changes: + - Patch update to fix import errors in utils file. + release_date: '2023-07-31' diff --git a/ansible_collections/dellemc/unity/docs/CONTRIBUTING.md b/ansible_collections/dellemc/unity/docs/CONTRIBUTING.md index 1cf25a511..f26c1cd08 100644 --- a/ansible_collections/dellemc/unity/docs/CONTRIBUTING.md +++ b/ansible_collections/dellemc/unity/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.1/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.1/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.1/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.1/docs/SUPPORT.md). #### Code sanitization diff --git a/ansible_collections/dellemc/unity/docs/INSTALLATION.md b/ansible_collections/dellemc/unity/docs/INSTALLATION.md index 01f2856b0..e361588f1 100644 --- a/ansible_collections/dellemc/unity/docs/INSTALLATION.md +++ b/ansible_collections/dellemc/unity/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 <install_path> + ansible-galaxy collection install dellemc-unity-1.7.1.tar.gz -p <install_path> * 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.1/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/ansible_collections/dellemc/unity/docs/ISSUE_TRIAGE.md b/ansible_collections/dellemc/unity/docs/ISSUE_TRIAGE.md index d3e443494..2e25b256a 100644 --- a/ansible_collections/dellemc/unity/docs/ISSUE_TRIAGE.md +++ b/ansible_collections/dellemc/unity/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.1] - Unity SDK version: [e.g. Unity 1.2.11] - Any other additional information... diff --git a/ansible_collections/dellemc/unity/docs/MAINTAINER_GUIDE.md b/ansible_collections/dellemc/unity/docs/MAINTAINER_GUIDE.md index 78d13dd1d..a46a3d37d 100644 --- a/ansible_collections/dellemc/unity/docs/MAINTAINER_GUIDE.md +++ b/ansible_collections/dellemc/unity/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.1/docs/CODE_OF_CONDUCT.md) and the guidelines in the [Contributing](https://github.com/dell/ansible-unity/blob/1.7.1/docs/CONTRIBUTING.md) and [Committer](https://github.com/dell/ansible-unity/blob/1.7.1/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/ansible_collections/dellemc/unity/docs/Release Notes.md b/ansible_collections/dellemc/unity/docs/Release Notes.md index 47d3fa3a5..4243667c1 100644 --- a/ansible_collections/dellemc/unity/docs/Release Notes.md +++ b/ansible_collections/dellemc/unity/docs/Release Notes.md @@ -1,6 +1,6 @@ **Ansible Modules for Dell Technologies Unity** ========================================= -### Release Notes 1.6.0 +### Release Notes 1.7.1 > © 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 | July 2023 | Current release of Ansible Modules for Dell Unity 1.7.1 | 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.1/docs) page. It includes the following: - README - Release Notes (this document) -- Product Guide diff --git a/ansible_collections/dellemc/unity/docs/SECURITY.md b/ansible_collections/dellemc/unity/docs/SECURITY.md index 16e1acf79..f77239eac 100644 --- a/ansible_collections/dellemc/unity/docs/SECURITY.md +++ b/ansible_collections/dellemc/unity/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.1/docs/CONTRIBUTING.md#Pull-requests) for more information. ## Reporting a vulnerability diff --git a/ansible_collections/dellemc/unity/docs/modules/cifsserver.rst b/ansible_collections/dellemc/unity/docs/modules/cifsserver.rst index 71b7527f2..2c3c9286e 100644 --- a/ansible_collections/dellemc/unity/docs/modules/cifsserver.rst +++ b/ansible_collections/dellemc/unity/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/ansible_collections/dellemc/unity/docs/modules/consistencygroup.rst b/ansible_collections/dellemc/unity/docs/modules/consistencygroup.rst index ac5727cfd..4f6060c9f 100644 --- a/ansible_collections/dellemc/unity/docs/modules/consistencygroup.rst +++ b/ansible_collections/dellemc/unity/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/ansible_collections/dellemc/unity/docs/modules/filesystem.rst b/ansible_collections/dellemc/unity/docs/modules/filesystem.rst index 81881dfbb..05ff4ebb9 100644 --- a/ansible_collections/dellemc/unity/docs/modules/filesystem.rst +++ b/ansible_collections/dellemc/unity/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/ansible_collections/dellemc/unity/docs/modules/filesystem_snapshot.rst b/ansible_collections/dellemc/unity/docs/modules/filesystem_snapshot.rst index c75f81611..02fa2a6de 100644 --- a/ansible_collections/dellemc/unity/docs/modules/filesystem_snapshot.rst +++ b/ansible_collections/dellemc/unity/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/ansible_collections/dellemc/unity/docs/modules/host.rst b/ansible_collections/dellemc/unity/docs/modules/host.rst index b0afe55b9..d2e48dd18 100644 --- a/ansible_collections/dellemc/unity/docs/modules/host.rst +++ b/ansible_collections/dellemc/unity/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/ansible_collections/dellemc/unity/docs/modules/info.rst b/ansible_collections/dellemc/unity/docs/modules/info.rst index 7b1ef111c..6b2a9d8ad 100644 --- a/ansible_collections/dellemc/unity/docs/modules/info.rst +++ b/ansible_collections/dellemc/unity/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/ansible_collections/dellemc/unity/docs/modules/interface.rst b/ansible_collections/dellemc/unity/docs/modules/interface.rst index aad1c02e8..cc33254f5 100644 --- a/ansible_collections/dellemc/unity/docs/modules/interface.rst +++ b/ansible_collections/dellemc/unity/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/ansible_collections/dellemc/unity/docs/modules/nasserver.rst b/ansible_collections/dellemc/unity/docs/modules/nasserver.rst index 284f37326..97d298b9c 100644 --- a/ansible_collections/dellemc/unity/docs/modules/nasserver.rst +++ b/ansible_collections/dellemc/unity/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/ansible_collections/dellemc/unity/docs/modules/nfs.rst b/ansible_collections/dellemc/unity/docs/modules/nfs.rst index cce2058f5..c64c8983a 100644 --- a/ansible_collections/dellemc/unity/docs/modules/nfs.rst +++ b/ansible_collections/dellemc/unity/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/ansible_collections/dellemc/unity/docs/modules/nfsserver.rst b/ansible_collections/dellemc/unity/docs/modules/nfsserver.rst index 0836bb63c..15d786d58 100644 --- a/ansible_collections/dellemc/unity/docs/modules/nfsserver.rst +++ b/ansible_collections/dellemc/unity/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/ansible_collections/dellemc/unity/docs/modules/replication_session.rst b/ansible_collections/dellemc/unity/docs/modules/replication_session.rst new file mode 100644 index 000000000..b401c403d --- /dev/null +++ b/ansible_collections/dellemc/unity/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) <ansible.team@dell.com> + diff --git a/ansible_collections/dellemc/unity/docs/modules/smbshare.rst b/ansible_collections/dellemc/unity/docs/modules/smbshare.rst index 697bda3ff..027fcee25 100644 --- a/ansible_collections/dellemc/unity/docs/modules/smbshare.rst +++ b/ansible_collections/dellemc/unity/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/ansible_collections/dellemc/unity/docs/modules/snapshot.rst b/ansible_collections/dellemc/unity/docs/modules/snapshot.rst index 46b2aa997..5ef582114 100644 --- a/ansible_collections/dellemc/unity/docs/modules/snapshot.rst +++ b/ansible_collections/dellemc/unity/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/ansible_collections/dellemc/unity/docs/modules/snapshotschedule.rst b/ansible_collections/dellemc/unity/docs/modules/snapshotschedule.rst index 4e9a37de2..2ee511e8c 100644 --- a/ansible_collections/dellemc/unity/docs/modules/snapshotschedule.rst +++ b/ansible_collections/dellemc/unity/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/ansible_collections/dellemc/unity/docs/modules/storagepool.rst b/ansible_collections/dellemc/unity/docs/modules/storagepool.rst index 764f2a812..48875898f 100644 --- a/ansible_collections/dellemc/unity/docs/modules/storagepool.rst +++ b/ansible_collections/dellemc/unity/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/ansible_collections/dellemc/unity/docs/modules/tree_quota.rst b/ansible_collections/dellemc/unity/docs/modules/tree_quota.rst index 285ab9d79..68afe348f 100644 --- a/ansible_collections/dellemc/unity/docs/modules/tree_quota.rst +++ b/ansible_collections/dellemc/unity/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/ansible_collections/dellemc/unity/docs/modules/user_quota.rst b/ansible_collections/dellemc/unity/docs/modules/user_quota.rst index 7d0bbb808..1f7be59b2 100644 --- a/ansible_collections/dellemc/unity/docs/modules/user_quota.rst +++ b/ansible_collections/dellemc/unity/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/ansible_collections/dellemc/unity/docs/modules/volume.rst b/ansible_collections/dellemc/unity/docs/modules/volume.rst index ed4c5f202..bcb767f65 100644 --- a/ansible_collections/dellemc/unity/docs/modules/volume.rst +++ b/ansible_collections/dellemc/unity/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/ansible_collections/dellemc/unity/meta/runtime.yml b/ansible_collections/dellemc/unity/meta/runtime.yml index 31f912445..82e44c7f7 100644 --- a/ansible_collections/dellemc/unity/meta/runtime.yml +++ b/ansible_collections/dellemc/unity/meta/runtime.yml @@ -1,5 +1,5 @@ --- -requires_ansible: ">=2.12" +requires_ansible: ">=2.13" plugin_routing: modules: dellemc_unity_info: diff --git a/ansible_collections/dellemc/unity/playbooks/modules/cifsserver.yml b/ansible_collections/dellemc/unity/playbooks/modules/cifsserver.yml new file mode 100644 index 000000000..ee2f980f8 --- /dev/null +++ b/ansible_collections/dellemc/unity/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/ansible_collections/dellemc/unity/playbooks/modules/consistencygroup.yml b/ansible_collections/dellemc/unity/playbooks/modules/consistencygroup.yml new file mode 100644 index 000000000..f183304ba --- /dev/null +++ b/ansible_collections/dellemc/unity/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/ansible_collections/dellemc/unity/playbooks/modules/filesystem.yml b/ansible_collections/dellemc/unity/playbooks/modules/filesystem.yml new file mode 100644 index 000000000..36757103f --- /dev/null +++ b/ansible_collections/dellemc/unity/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/ansible_collections/dellemc/unity/playbooks/modules/filesystem_snapshot.yml b/ansible_collections/dellemc/unity/playbooks/modules/filesystem_snapshot.yml new file mode 100644 index 000000000..16ce88db2 --- /dev/null +++ b/ansible_collections/dellemc/unity/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/ansible_collections/dellemc/unity/playbooks/modules/host.yml b/ansible_collections/dellemc/unity/playbooks/modules/host.yml new file mode 100644 index 000000000..04b28c8e5 --- /dev/null +++ b/ansible_collections/dellemc/unity/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/ansible_collections/dellemc/unity/playbooks/modules/info.yml b/ansible_collections/dellemc/unity/playbooks/modules/info.yml new file mode 100644 index 000000000..e2c9b3162 --- /dev/null +++ b/ansible_collections/dellemc/unity/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/ansible_collections/dellemc/unity/playbooks/modules/interface.yml b/ansible_collections/dellemc/unity/playbooks/modules/interface.yml new file mode 100644 index 000000000..3095a3edc --- /dev/null +++ b/ansible_collections/dellemc/unity/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/ansible_collections/dellemc/unity/playbooks/modules/nasserver.yml b/ansible_collections/dellemc/unity/playbooks/modules/nasserver.yml new file mode 100644 index 000000000..72f9b7daf --- /dev/null +++ b/ansible_collections/dellemc/unity/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/ansible_collections/dellemc/unity/playbooks/modules/nfs.yml b/ansible_collections/dellemc/unity/playbooks/modules/nfs.yml new file mode 100644 index 000000000..f0bb48b11 --- /dev/null +++ b/ansible_collections/dellemc/unity/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/ansible_collections/dellemc/unity/playbooks/modules/nfsserver.yml b/ansible_collections/dellemc/unity/playbooks/modules/nfsserver.yml new file mode 100644 index 000000000..83d0d7b32 --- /dev/null +++ b/ansible_collections/dellemc/unity/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/ansible_collections/dellemc/unity/playbooks/modules/replication_session.yml b/ansible_collections/dellemc/unity/playbooks/modules/replication_session.yml new file mode 100644 index 000000000..484e29a90 --- /dev/null +++ b/ansible_collections/dellemc/unity/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/ansible_collections/dellemc/unity/playbooks/modules/smbshare.yml b/ansible_collections/dellemc/unity/playbooks/modules/smbshare.yml new file mode 100644 index 000000000..91de71d0c --- /dev/null +++ b/ansible_collections/dellemc/unity/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/ansible_collections/dellemc/unity/playbooks/modules/snapshot.yml b/ansible_collections/dellemc/unity/playbooks/modules/snapshot.yml new file mode 100644 index 000000000..164106f7f --- /dev/null +++ b/ansible_collections/dellemc/unity/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/ansible_collections/dellemc/unity/playbooks/modules/snapshotschedule.yml b/ansible_collections/dellemc/unity/playbooks/modules/snapshotschedule.yml new file mode 100644 index 000000000..f2859a06a --- /dev/null +++ b/ansible_collections/dellemc/unity/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/ansible_collections/dellemc/unity/playbooks/modules/storagepool.yml b/ansible_collections/dellemc/unity/playbooks/modules/storagepool.yml new file mode 100644 index 000000000..a53328edc --- /dev/null +++ b/ansible_collections/dellemc/unity/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/ansible_collections/dellemc/unity/playbooks/modules/tree_quota.yml b/ansible_collections/dellemc/unity/playbooks/modules/tree_quota.yml new file mode 100644 index 000000000..1665ea118 --- /dev/null +++ b/ansible_collections/dellemc/unity/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/ansible_collections/dellemc/unity/playbooks/modules/user_quota.yml b/ansible_collections/dellemc/unity/playbooks/modules/user_quota.yml new file mode 100644 index 000000000..350cf4f62 --- /dev/null +++ b/ansible_collections/dellemc/unity/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/ansible_collections/dellemc/unity/playbooks/modules/volume.yml b/ansible_collections/dellemc/unity/playbooks/modules/volume.yml new file mode 100644 index 000000000..45f62c01f --- /dev/null +++ b/ansible_collections/dellemc/unity/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/ansible_collections/dellemc/unity/plugins/doc_fragments/unity.py b/ansible_collections/dellemc/unity/plugins/doc_fragments/unity.py index 1ebc7f40f..0df468567 100644 --- a/ansible_collections/dellemc/unity/plugins/doc_fragments/unity.py +++ b/ansible_collections/dellemc/unity/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/ansible_collections/dellemc/unity/plugins/module_utils/storage/dell/utils.py b/ansible_collections/dellemc/unity/plugins/module_utils/storage/dell/utils.py index c44b2bcee..e8fa0374c 100644 --- a/ansible_collections/dellemc/unity/plugins/module_utils/storage/dell/utils.py +++ b/ansible_collections/dellemc/unity/plugins/module_utils/storage/dell/utils.py @@ -25,44 +25,44 @@ except ImportError: try: from storops import UnitySystem - from storops.unity.client import UnityClient + from storops.unity.client import UnityClient # noqa # pylint: disable=unused-import 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 + cifs_share, nas_server # noqa # pylint: disable=unused-import + from storops.unity.resource.lun import UnityLun # noqa # pylint: disable=unused-import + from storops.unity.resource.pool import UnityPool, UnityPoolList, RaidGroupParameter # noqa # pylint: disable=unused-import from storops.unity.resource.filesystem import UnityFileSystem, \ - UnityFileSystemList - from storops.unity.resource.nas_server import UnityNasServer + UnityFileSystemList # noqa # pylint: disable=unused-import + from storops.unity.resource.nas_server import UnityNasServer # noqa # pylint: disable=unused-import from storops.unity.resource.nfs_share import UnityNfsShare, \ - UnityNfsShareList + UnityNfsShareList # noqa # pylint: disable=unused-import from storops.unity.resource.snap_schedule import UnitySnapScheduleList, \ - UnitySnapSchedule - from storops.unity.resource.replication_session import UnityReplicationSession + UnitySnapSchedule # noqa # pylint: disable=unused-import + from storops.unity.resource.replication_session import UnityReplicationSession # noqa # pylint: disable=unused-import 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 + TieringPolicyEnum, ScheduleTypeEnum, DayOfWeekEnum, NodeEnum # noqa # pylint: disable=unused-import + from storops.unity.enums import HostLUNAccessEnum, HostTypeEnum, AccessPolicyEnum, \ + FilesystemTypeEnum, FSSupportedProtocolEnum, FSFormatEnum # noqa # pylint: disable=unused-import + from storops.unity.enums import NFSTypeEnum, NFSShareDefaultAccessEnum, NFSShareSecurityEnum, \ + FilesystemSnapAccessTypeEnum, FSLockingPolicyEnum # noqa # pylint: disable=unused-import + from storops.unity.enums import CifsShareOfflineAvailabilityEnum, NasServerUnixDirectoryServiceEnum, \ + KdcTypeEnum, NodeEnum, FileInterfaceRoleEnum, ReplicationOpStatusEnum # noqa # pylint: disable=unused-import from storops.exception import UnityResourceNotFoundError, \ - StoropsConnectTimeoutError, UnityNfsShareNameExistedError - from storops.connection.exceptions import HttpError, HTTPClientError + StoropsConnectTimeoutError, UnityNfsShareNameExistedError # noqa # pylint: disable=unused-import + from storops.connection.exceptions import HttpError, HTTPClientError # noqa # pylint: disable=unused-import from storops.unity.resource.user_quota import UnityUserQuota, \ - UnityUserQuotaList + UnityUserQuotaList # noqa # pylint: disable=unused-import from storops.unity.resource.tree_quota import UnityTreeQuota, \ - UnityTreeQuotaList + UnityTreeQuotaList # noqa # pylint: disable=unused-import from storops.unity.resource.quota_config import UnityQuotaConfig, \ - UnityQuotaConfigList - from storops.unity.resource.storage_resource import UnityStorageResource + UnityQuotaConfigList # noqa # pylint: disable=unused-import + from storops.unity.resource.storage_resource import UnityStorageResource # noqa # pylint: disable=unused-import from storops.unity.enums import QuotaPolicyEnum, RaidTypeEnum, \ - RaidStripeWidthEnum, StoragePoolTypeEnum + RaidStripeWidthEnum, StoragePoolTypeEnum # noqa # pylint: disable=unused-import 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 + UnityDiskList, UnityDiskGroup, UnityDiskGroupList # noqa # pylint: disable=unused-import + from storops.unity.resource.cifs_server import UnityCifsServer # noqa # pylint: disable=unused-import + from storops.unity.resource.nfs_server import UnityNfsServer # noqa # pylint: disable=unused-import + from storops.unity.resource.interface import UnityFileInterface # noqa # pylint: disable=unused-import HAS_UNITY_SDK, STOROPS_IMP_ERR = True, None except ImportError: diff --git a/ansible_collections/dellemc/unity/plugins/modules/cifsserver.py b/ansible_collections/dellemc/unity/plugins/modules/cifsserver.py index d40c4f11d..0225eb381 100644 --- a/ansible_collections/dellemc/unity/plugins/modules/cifsserver.py +++ b/ansible_collections/dellemc/unity/plugins/modules/cifsserver.py @@ -124,7 +124,7 @@ EXAMPLES = r''' 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 @@ from ansible_collections.dellemc.unity.plugins.module_utils.storage.dell import LOG = utils.get_logger('cifsserver') -application_type = "Ansible/1.6.0" +application_type = "Ansible/1.7.1" class CIFSServer(object): diff --git a/ansible_collections/dellemc/unity/plugins/modules/consistencygroup.py b/ansible_collections/dellemc/unity/plugins/modules/consistencygroup.py index 14e4de506..e0d6a6c06 100644 --- a/ansible_collections/dellemc/unity/plugins/modules/consistencygroup.py +++ b/ansible_collections/dellemc/unity/plugins/modules/consistencygroup.py @@ -321,7 +321,7 @@ EXAMPLES = r""" 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 @@ from ansible_collections.dellemc.unity.plugins.module_utils.storage.dell \ LOG = utils.get_logger('consistencygroup', log_devel=logging.INFO) -application_type = "Ansible/1.6.0" +application_type = "Ansible/1.7.1" class ConsistencyGroup(object): diff --git a/ansible_collections/dellemc/unity/plugins/modules/filesystem.py b/ansible_collections/dellemc/unity/plugins/modules/filesystem.py index b10f85386..95cffeec6 100644 --- a/ansible_collections/dellemc/unity/plugins/modules/filesystem.py +++ b/ansible_collections/dellemc/unity/plugins/modules/filesystem.py @@ -330,7 +330,7 @@ EXAMPLES = r""" 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 @@ EXAMPLES = r""" 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 @@ EXAMPLES = r""" 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 @@ from ansible_collections.dellemc.unity.plugins.module_utils.storage.dell \ LOG = utils.get_logger('filesystem') -application_type = "Ansible/1.6.0" +application_type = "Ansible/1.7.1" class Filesystem(object): diff --git a/ansible_collections/dellemc/unity/plugins/modules/filesystem_snapshot.py b/ansible_collections/dellemc/unity/plugins/modules/filesystem_snapshot.py index 35e536a47..a82fbe89b 100644 --- a/ansible_collections/dellemc/unity/plugins/modules/filesystem_snapshot.py +++ b/ansible_collections/dellemc/unity/plugins/modules/filesystem_snapshot.py @@ -122,7 +122,7 @@ EXAMPLES = r''' 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 @@ EXAMPLES = r''' 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 @@ from datetime import datetime LOG = utils.get_logger('filesystem_snapshot') -application_type = "Ansible/1.6.0" +application_type = "Ansible/1.7.1" class FilesystemSnapshot(object): diff --git a/ansible_collections/dellemc/unity/plugins/modules/host.py b/ansible_collections/dellemc/unity/plugins/modules/host.py index 21a5fbae1..fcc13dd9a 100644 --- a/ansible_collections/dellemc/unity/plugins/modules/host.py +++ b/ansible_collections/dellemc/unity/plugins/modules/host.py @@ -347,7 +347,7 @@ import ipaddress LOG = utils.get_logger('host') -application_type = "Ansible/1.6.0" +application_type = "Ansible/1.7.1" class Host(object): diff --git a/ansible_collections/dellemc/unity/plugins/modules/info.py b/ansible_collections/dellemc/unity/plugins/modules/info.py index e89d86335..641074286 100644 --- a/ansible_collections/dellemc/unity/plugins/modules/info.py +++ b/ansible_collections/dellemc/unity/plugins/modules/info.py @@ -38,6 +38,7 @@ description: 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 @@ options: 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 @@ EXAMPLES = r''' - cifs_server - ethernet_port - file_interface + - replication_session - name: Get information of Unity array dellemc.unity.info: @@ -267,6 +269,15 @@ EXAMPLES = r''' 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 @@ File_interfaces: "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 @@ from ansible_collections.dellemc.unity.plugins.module_utils.storage.dell \ LOG = utils.get_logger('info') SUCCESSFULL_LISTED_MSG = 'Successfully listed.' -application_type = "Ansible/1.6.0" +application_type = "Ansible/1.7.1" class Info(object): @@ -1549,6 +1628,20 @@ class Info(object): 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 @@ class Info(object): cifs_server = [] ethernet_port = [] file_interface = [] + replication_session = [] subset = self.module.params['gather_subset'] if subset is not None: @@ -1616,6 +1710,8 @@ class Info(object): 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 @@ class Info(object): 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/ansible_collections/dellemc/unity/plugins/modules/interface.py b/ansible_collections/dellemc/unity/plugins/modules/interface.py index 95ddfd26a..2523f940e 100644 --- a/ansible_collections/dellemc/unity/plugins/modules/interface.py +++ b/ansible_collections/dellemc/unity/plugins/modules/interface.py @@ -227,7 +227,7 @@ from ipaddress import ip_network LOG = utils.get_logger('interface') -application_type = "Ansible/1.6.0" +application_type = "Ansible/1.7.1" class Interface(object): diff --git a/ansible_collections/dellemc/unity/plugins/modules/nasserver.py b/ansible_collections/dellemc/unity/plugins/modules/nasserver.py index 713125cc2..925cc932e 100644 --- a/ansible_collections/dellemc/unity/plugins/modules/nasserver.py +++ b/ansible_collections/dellemc/unity/plugins/modules/nasserver.py @@ -225,15 +225,15 @@ EXAMPLES = r''' 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 @@ EXAMPLES = r''' 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 @@ EXAMPLES = r''' 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 @@ EXAMPLES = r''' 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 @@ EXAMPLES = r''' 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 @@ EXAMPLES = r''' 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 @@ EXAMPLES = r''' 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 @@ changed: 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 @@ nas_server_details: 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 @@ from ansible_collections.dellemc.unity.plugins.module_utils.storage.dell \ import utils LOG = utils.get_logger('nasserver') -application_type = "Ansible/1.6.0" +application_type = "Ansible/1.7.1" class NASServer(object): diff --git a/ansible_collections/dellemc/unity/plugins/modules/nfs.py b/ansible_collections/dellemc/unity/plugins/modules/nfs.py index e6223066b..473e40b2a 100644 --- a/ansible_collections/dellemc/unity/plugins/modules/nfs.py +++ b/ansible_collections/dellemc/unity/plugins/modules/nfs.py @@ -568,7 +568,7 @@ nfs_share_details: '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_DICT = dict(type='list', required=False, elements='dict', HOST_STATE_LIST = ['present-in-export', 'absent-in-export'] STATE_LIST = ['present', 'absent'] -application_type = "Ansible/1.6.0" +application_type = "Ansible/1.7.1" class NFS(object): diff --git a/ansible_collections/dellemc/unity/plugins/modules/nfsserver.py b/ansible_collections/dellemc/unity/plugins/modules/nfsserver.py index e492e3af0..30d2c787f 100644 --- a/ansible_collections/dellemc/unity/plugins/modules/nfsserver.py +++ b/ansible_collections/dellemc/unity/plugins/modules/nfsserver.py @@ -92,12 +92,12 @@ EXAMPLES = r''' 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 @@ EXAMPLES = r''' 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 @@ EXAMPLES = r''' 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 @@ from ansible_collections.dellemc.unity.plugins.module_utils.storage.dell \ LOG = utils.get_logger('nfsserver') -application_type = "Ansible/1.6.0" +application_type = "Ansible/1.7.1" class NFSServer(object): diff --git a/ansible_collections/dellemc/unity/plugins/modules/replication_session.py b/ansible_collections/dellemc/unity/plugins/modules/replication_session.py new file mode 100644 index 000000000..20907d50d --- /dev/null +++ b/ansible_collections/dellemc/unity/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) <ansible.team@dell.com> + +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/ansible_collections/dellemc/unity/plugins/modules/smbshare.py b/ansible_collections/dellemc/unity/plugins/modules/smbshare.py index 58bc8c709..d8b78a7d9 100644 --- a/ansible_collections/dellemc/unity/plugins/modules/smbshare.py +++ b/ansible_collections/dellemc/unity/plugins/modules/smbshare.py @@ -150,11 +150,11 @@ EXAMPLES = r''' 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 @@ EXAMPLES = r''' 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 @@ EXAMPLES = r''' 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 @@ EXAMPLES = r''' 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 @@ changed: 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 @@ from ansible_collections.dellemc.unity.plugins.module_utils.storage.dell \ LOG = utils.get_logger('smbshare') -application_type = "Ansible/1.6.0" +application_type = "Ansible/1.7.1" class SMBShare(object): diff --git a/ansible_collections/dellemc/unity/plugins/modules/snapshot.py b/ansible_collections/dellemc/unity/plugins/modules/snapshot.py index c8aba1846..5660e3c5c 100644 --- a/ansible_collections/dellemc/unity/plugins/modules/snapshot.py +++ b/ansible_collections/dellemc/unity/plugins/modules/snapshot.py @@ -122,7 +122,7 @@ EXAMPLES = r''' 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 @@ snapshot_details: } ''' -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 @@ from datetime import datetime LOG = utils.get_logger('snapshot') -application_type = "Ansible/1.6.0" +application_type = "Ansible/1.7.1" class Snapshot(object): diff --git a/ansible_collections/dellemc/unity/plugins/modules/snapshotschedule.py b/ansible_collections/dellemc/unity/plugins/modules/snapshotschedule.py index aba5524cd..1d6e6ec6c 100644 --- a/ansible_collections/dellemc/unity/plugins/modules/snapshotschedule.py +++ b/ansible_collections/dellemc/unity/plugins/modules/snapshotschedule.py @@ -144,7 +144,7 @@ EXAMPLES = r""" 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 @@ EXAMPLES = r""" 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 @@ EXAMPLES = r""" 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 @@ changed: 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 @@ snapshot_schedule_details: } """ -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.1" class SnapshotSchedule(object): diff --git a/ansible_collections/dellemc/unity/plugins/modules/storagepool.py b/ansible_collections/dellemc/unity/plugins/modules/storagepool.py index ddb7eef65..6438e9c6a 100644 --- a/ansible_collections/dellemc/unity/plugins/modules/storagepool.py +++ b/ansible_collections/dellemc/unity/plugins/modules/storagepool.py @@ -217,10 +217,10 @@ EXAMPLES = r''' 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 @@ RETURN = r''' 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 @@ RETURN = r''' 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.1" class StoragePool(object): @@ -499,7 +498,9 @@ class StoragePool(object): 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/ansible_collections/dellemc/unity/plugins/modules/tree_quota.py b/ansible_collections/dellemc/unity/plugins/modules/tree_quota.py index 063834b45..b066a01fa 100644 --- a/ansible_collections/dellemc/unity/plugins/modules/tree_quota.py +++ b/ansible_collections/dellemc/unity/plugins/modules/tree_quota.py @@ -199,7 +199,7 @@ changed: 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 @@ from ansible_collections.dellemc.unity.plugins.module_utils.storage.dell \ LOG = utils.get_logger('tree_quota') -application_type = "Ansible/1.6.0" +application_type = "Ansible/1.7.1" class QuotaTree(object): diff --git a/ansible_collections/dellemc/unity/plugins/modules/user_quota.py b/ansible_collections/dellemc/unity/plugins/modules/user_quota.py index d9116c3a5..06413aa53 100644 --- a/ansible_collections/dellemc/unity/plugins/modules/user_quota.py +++ b/ansible_collections/dellemc/unity/plugins/modules/user_quota.py @@ -294,7 +294,7 @@ changed: 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 @@ from ansible_collections.dellemc.unity.plugins.module_utils.storage.dell \ LOG = utils.get_logger('user_quota') -application_type = "Ansible/1.6.0" +application_type = "Ansible/1.7.1" class UserQuota(object): diff --git a/ansible_collections/dellemc/unity/plugins/modules/volume.py b/ansible_collections/dellemc/unity/plugins/modules/volume.py index 82bcb0174..81790ea24 100644 --- a/ansible_collections/dellemc/unity/plugins/modules/volume.py +++ b/ansible_collections/dellemc/unity/plugins/modules/volume.py @@ -177,9 +177,9 @@ EXAMPLES = r""" 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 @@ EXAMPLES = r""" 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 @@ changed: 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 @@ volume_details: 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.1" def is_none_or_empty_string(param): diff --git a/ansible_collections/dellemc/unity/requirements.txt b/ansible_collections/dellemc/unity/requirements.txt index 2325e97fb..847cc465d 100644 --- a/ansible_collections/dellemc/unity/requirements.txt +++ b/ansible_collections/dellemc/unity/requirements.txt @@ -1,3 +1,2 @@ -urllib3 +urllib3>=1.26.7 storops>=1.2.11 -setuptools diff --git a/ansible_collections/dellemc/unity/tests/sanity/ignore-2.13.txt b/ansible_collections/dellemc/unity/tests/sanity/ignore-2.13.txt index a175e9976..a7aa13146 100644 --- a/ansible_collections/dellemc/unity/tests/sanity/ignore-2.13.txt +++ b/ansible_collections/dellemc/unity/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/ansible_collections/dellemc/unity/tests/sanity/ignore-2.14.txt b/ansible_collections/dellemc/unity/tests/sanity/ignore-2.14.txt index a175e9976..a7aa13146 100644 --- a/ansible_collections/dellemc/unity/tests/sanity/ignore-2.14.txt +++ b/ansible_collections/dellemc/unity/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/ansible_collections/dellemc/unity/tests/sanity/ignore-2.12.txt b/ansible_collections/dellemc/unity/tests/sanity/ignore-2.15.txt index f78c82922..a7aa13146 100644 --- a/ansible_collections/dellemc/unity/tests/sanity/ignore-2.12.txt +++ b/ansible_collections/dellemc/unity/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/ansible_collections/dellemc/unity/tests/unit/plugins/module_utils/mock_cifsserver_api.py b/ansible_collections/dellemc/unity/tests/unit/plugins/module_utils/mock_cifsserver_api.py index 427d530fa..d3f0e90a1 100644 --- a/ansible_collections/dellemc/unity/tests/unit/plugins/module_utils/mock_cifsserver_api.py +++ b/ansible_collections/dellemc/unity/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/ansible_collections/dellemc/unity/tests/unit/plugins/module_utils/mock_info_api.py b/ansible_collections/dellemc/unity/tests/unit/plugins/module_utils/mock_info_api.py new file mode 100644 index 000000000..80ae035a1 --- /dev/null +++ b/ansible_collections/dellemc/unity/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/ansible_collections/dellemc/unity/tests/unit/plugins/module_utils/mock_interface_api.py b/ansible_collections/dellemc/unity/tests/unit/plugins/module_utils/mock_interface_api.py index 6bd53ea9b..046ff2c41 100644 --- a/ansible_collections/dellemc/unity/tests/unit/plugins/module_utils/mock_interface_api.py +++ b/ansible_collections/dellemc/unity/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/ansible_collections/dellemc/unity/tests/unit/plugins/module_utils/mock_nfsserver_api.py b/ansible_collections/dellemc/unity/tests/unit/plugins/module_utils/mock_nfsserver_api.py index 1254f0035..9c4eadc12 100644 --- a/ansible_collections/dellemc/unity/tests/unit/plugins/module_utils/mock_nfsserver_api.py +++ b/ansible_collections/dellemc/unity/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/ansible_collections/dellemc/unity/tests/unit/plugins/module_utils/mock_replication_session_api.py b/ansible_collections/dellemc/unity/tests/unit/plugins/module_utils/mock_replication_session_api.py new file mode 100644 index 000000000..050084316 --- /dev/null +++ b/ansible_collections/dellemc/unity/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/ansible_collections/dellemc/unity/tests/unit/plugins/module_utils/mock_volume_api.py b/ansible_collections/dellemc/unity/tests/unit/plugins/module_utils/mock_volume_api.py index 82097a338..ddf5c407e 100644 --- a/ansible_collections/dellemc/unity/tests/unit/plugins/module_utils/mock_volume_api.py +++ b/ansible_collections/dellemc/unity/tests/unit/plugins/module_utils/mock_volume_api.py @@ -8,8 +8,6 @@ from __future__ import absolute_import, division, print_function __metaclass__ = type -from ansible_collections.dellemc.unity.tests.unit.plugins.module_utils.mock_sdk_response import MockSDKObject - class MockVolumeApi: diff --git a/ansible_collections/dellemc/unity/tests/unit/plugins/modules/test_cifsserver.py b/ansible_collections/dellemc/unity/tests/unit/plugins/modules/test_cifsserver.py index e28c2e935..a1143a771 100644 --- a/ansible_collections/dellemc/unity/tests/unit/plugins/modules/test_cifsserver.py +++ b/ansible_collections/dellemc/unity/tests/unit/plugins/modules/test_cifsserver.py @@ -14,8 +14,6 @@ from ansible_collections.dellemc.unity.tests.unit.plugins.module_utils.mock_cifs 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/ansible_collections/dellemc/unity/tests/unit/plugins/modules/test_host.py b/ansible_collections/dellemc/unity/tests/unit/plugins/modules/test_host.py index de94c38d3..028a2fa4e 100644 --- a/ansible_collections/dellemc/unity/tests/unit/plugins/modules/test_host.py +++ b/ansible_collections/dellemc/unity/tests/unit/plugins/modules/test_host.py @@ -15,7 +15,7 @@ from ansible_collections.dellemc.unity.tests.unit.plugins.module_utils.mock_host 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/ansible_collections/dellemc/unity/tests/unit/plugins/modules/test_info.py b/ansible_collections/dellemc/unity/tests/unit/plugins/modules/test_info.py new file mode 100644 index 000000000..a36567660 --- /dev/null +++ b/ansible_collections/dellemc/unity/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/ansible_collections/dellemc/unity/tests/unit/plugins/modules/test_nfsserver.py b/ansible_collections/dellemc/unity/tests/unit/plugins/modules/test_nfsserver.py index c2a680487..f7900eeb1 100644 --- a/ansible_collections/dellemc/unity/tests/unit/plugins/modules/test_nfsserver.py +++ b/ansible_collections/dellemc/unity/tests/unit/plugins/modules/test_nfsserver.py @@ -12,8 +12,6 @@ import pytest 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/ansible_collections/dellemc/unity/tests/unit/plugins/modules/test_replication_session.py b/ansible_collections/dellemc/unity/tests/unit/plugins/modules/test_replication_session.py new file mode 100644 index 000000000..9af1800e6 --- /dev/null +++ b/ansible_collections/dellemc/unity/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'] |