diff options
Diffstat (limited to 'ansible_collections/dellemc')
30 files changed, 2000 insertions, 166 deletions
diff --git a/ansible_collections/dellemc/powerflex/.github/CODEOWNERS b/ansible_collections/dellemc/powerflex/.github/CODEOWNERS index f783d12bf..f3093ce14 100644 --- a/ansible_collections/dellemc/powerflex/.github/CODEOWNERS +++ b/ansible_collections/dellemc/powerflex/.github/CODEOWNERS @@ -15,4 +15,4 @@ # Trisha Datta (trisha-dell) # for all files: -* @kuttattz @Bhavneet-Sharma @Jennifer-John @meenakshidembi691 @Pavan-Mudunuri @trisha-dell +* @kuttattz @Bhavneet-Sharma @Jennifer-John @meenakshidembi691 @Pavan-Mudunuri @trisha-dell @felixs88 @sachin-apa diff --git a/ansible_collections/dellemc/powerflex/CHANGELOG.rst b/ansible_collections/dellemc/powerflex/CHANGELOG.rst index 8e67089a3..6aec79d70 100644 --- a/ansible_collections/dellemc/powerflex/CHANGELOG.rst +++ b/ansible_collections/dellemc/powerflex/CHANGELOG.rst @@ -5,6 +5,21 @@ Dellemc.PowerFlex Change Logs .. contents:: Topics +v2.3.0 +====== + +Minor Changes +------------- + +- Added support for PowerFlex ansible modules and roles on Azure. +- Added support for resource group provisioning to validate, deploy, edit, add nodes and delete a resource group. +- The Info module is enhanced to list the firmware repositories. + +New Modules +----------- + +- dellemc.powerflex.resource_group - Manage resource group deployments on Dell PowerFlex + v2.2.0 ====== diff --git a/ansible_collections/dellemc/powerflex/FILES.json b/ansible_collections/dellemc/powerflex/FILES.json index 63f1250cd..9d135a9a9 100644 --- a/ansible_collections/dellemc/powerflex/FILES.json +++ b/ansible_collections/dellemc/powerflex/FILES.json @@ -32,7 +32,7 @@ "name": ".github/CODEOWNERS", "ftype": "file", "chksum_type": "sha256", - "chksum_sha256": "02e53b61090f135ec71115de45f5be3ec18cf5ebe90c17eeb41e4a15a0fa5df5", + "chksum_sha256": "64591e526136e05232234eaf058ee461ca6ff91ea32a07ead2da6c0e54dd917f", "format": 1 }, { @@ -109,7 +109,7 @@ "name": "CHANGELOG.rst", "ftype": "file", "chksum_type": "sha256", - "chksum_sha256": "22481877ddc56823870ff6e2bdd9eec6c683d39bd79f991076e3dcb75488eedd", + "chksum_sha256": "45d7b5658389095f34e42e23f6ef321660ce5d2aebcb3905b688335d396616f8", "format": 1 }, { @@ -130,7 +130,7 @@ "name": "README.md", "ftype": "file", "chksum_type": "sha256", - "chksum_sha256": "b9979afcbcc34a8b63191ce20efa873eefdcbe51a2fa53860477eb79f3563aa2", + "chksum_sha256": "5af6cc66393e097bbb1f2bbb1477c602a11564ea1e9e7741d81be037c3976b8d", "format": 1 }, { @@ -144,14 +144,14 @@ "name": "changelogs/.plugin-cache.yaml", "ftype": "file", "chksum_type": "sha256", - "chksum_sha256": "8d9577349e7feb8bdd19d062101868da3cca572de5cb9dfda913c25256dbd15f", + "chksum_sha256": "5db03a24dc8b5b7ef2b678f130afa55c372b5151d6a2420682b4bcba22e654d8", "format": 1 }, { "name": "changelogs/changelog.yaml", "ftype": "file", "chksum_type": "sha256", - "chksum_sha256": "51a6d9b03a9ac47e7bd547d5d375b6e1021ceff6dc26ac69f06c0fbbc9f618d5", + "chksum_sha256": "932bfd76a42809ca17a1864376a9a2a88ad857bbb4990734d8522072466dcb8f", "format": 1 }, { @@ -200,21 +200,21 @@ "name": "docs/CONTRIBUTING.md", "ftype": "file", "chksum_type": "sha256", - "chksum_sha256": "6826d5757fe5a1bece4b674a3c304b6834602d4cd6aeab7bc86bfe85a36913fe", + "chksum_sha256": "196f895d4e1d69e8831017f36ed709f8ccb7ea035dc97d71abf7213e3e9be868", "format": 1 }, { "name": "docs/INSTALLATION.md", "ftype": "file", "chksum_type": "sha256", - "chksum_sha256": "baa58ede82a6b28b7a2d83beead5ac1a100975dcdfca4cb3e0e44253dae316e5", + "chksum_sha256": "c8fa229fdcec0cb7cdaeb94cfaa429675d14add2d95f77eb4e83a2311ce21203", "format": 1 }, { "name": "docs/ISSUE_TRIAGE.md", "ftype": "file", "chksum_type": "sha256", - "chksum_sha256": "bf51c339af375a21f6448ff4c504fca9c94362332f73d28bfc8ce2d3b1bb6983", + "chksum_sha256": "8bb1ea4a27677d9eb98f4c938fc0ed55c2e718f2abaa9bd5e1ee708e37ce2e1a", "format": 1 }, { @@ -228,21 +228,21 @@ "name": "docs/MAINTAINER_GUIDE.md", "ftype": "file", "chksum_type": "sha256", - "chksum_sha256": "50e95d3b07b93b9633f1c77b6eaa5a19e4f4f7e9825498d958cc071ef014ac42", + "chksum_sha256": "2e0970f922c8b97af52284ea00bf00337929c5e764c417152f49036dd23d21b4", "format": 1 }, { "name": "docs/Release Notes.md", "ftype": "file", "chksum_type": "sha256", - "chksum_sha256": "75ef358ffba38ac7cf03ff24d68626d9e5112a046a2b1eba2a10a6d345a97c0d", + "chksum_sha256": "a50b2c32c7ecc642e5794dcd0fbeef0bd4d3b0918300db814a72fd8f59cebd3c", "format": 1 }, { "name": "docs/SECURITY.md", "ftype": "file", "chksum_type": "sha256", - "chksum_sha256": "27159d1a795f9d6328a1f85bd95b7b1f55b698de821c979b2feba6e6a70599e9", + "chksum_sha256": "081098364e1203078b92bfd17db3186a6dc049cb81ea94059b09882d419a4946", "format": 1 }, { @@ -277,7 +277,7 @@ "name": "docs/modules/info.rst", "ftype": "file", "chksum_type": "sha256", - "chksum_sha256": "ff01e0057c388959a6460ac1b1b6f026ecf7d57e190067beed9e28876cad4a67", + "chksum_sha256": "a2919a7d5b06991e9113acd068ab458e05be216f3fe4344cf1691603b9c29884", "format": 1 }, { @@ -309,6 +309,13 @@ "format": 1 }, { + "name": "docs/modules/resource_group.rst", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "12edaa4dea0ccd6f9b231b5ea10ddd5b100f4b8d23abf8e278769d7a45002c95", + "format": 1 + }, + { "name": "docs/modules/sdc.rst", "ftype": "file", "chksum_type": "sha256", @@ -368,7 +375,7 @@ "name": "meta/runtime.yml", "ftype": "file", "chksum_type": "sha256", - "chksum_sha256": "67490e6204f2b0ef55e2cad348fa79da6d137455dd1e9a25c51cac5cc22dd464", + "chksum_sha256": "272017e3158d619273cbce9badfb648a524232f573aa80e5933541215490d9b3", "format": 1 }, { @@ -403,7 +410,7 @@ "name": "playbooks/modules/info.yml", "ftype": "file", "chksum_type": "sha256", - "chksum_sha256": "36b79dc7559347030ccf349b815be9e6431a807b3ab9064e009163c10970b397", + "chksum_sha256": "ffd7d70717a4e817f5a91a0e7d44c24078471dd3fe12ee54f4e09d89fdafb377", "format": 1 }, { @@ -435,6 +442,13 @@ "format": 1 }, { + "name": "playbooks/modules/resource_group.yml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "cb83c9435ef32003162e8d1e5946ea64d4c86eec0f3766f9c892dcdd9a431c32", + "format": 1 + }, + { "name": "playbooks/modules/sdc.yml", "ftype": "file", "chksum_type": "sha256", @@ -578,7 +592,7 @@ "name": "plugins/doc_fragments/powerflex.py", "ftype": "file", "chksum_type": "sha256", - "chksum_sha256": "801968c2f21f016d0f0861831e74ed4fc804e68a39b021c05f39b38437978bc0", + "chksum_sha256": "fe81e9901c08fa0086544e591ea7dda990ef30905ce80ed61ffd3f138b8e57ca", "format": 1 }, { @@ -648,7 +662,7 @@ "name": "plugins/module_utils/storage/dell/utils.py", "ftype": "file", "chksum_type": "sha256", - "chksum_sha256": "402f820473dc2725d9d3fa1787854861651003a86873c1613951f5faefe9e68c", + "chksum_sha256": "68b549b4dbeefc2eec8974ddc00db73eaafde275a1306522d18a75eb3ae1f963", "format": 1 }, { @@ -676,7 +690,7 @@ "name": "plugins/modules/info.py", "ftype": "file", "chksum_type": "sha256", - "chksum_sha256": "af50f59fca9f9bc84a8ecd622173279f436a7ac96654b86a5afa547aa317123f", + "chksum_sha256": "c4820b86a48d2884756dc4c2b3ff53285cf839b7b8db78494b90da93774ba44b", "format": 1 }, { @@ -708,6 +722,13 @@ "format": 1 }, { + "name": "plugins/modules/resource_group.py", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "40a4370a3a7a3fd9dbc98572870df22d94b877b0345a6d573e97675fd3715bfd", + "format": 1 + }, + { "name": "plugins/modules/sdc.py", "ftype": "file", "chksum_type": "sha256", @@ -2832,28 +2853,28 @@ "name": "tests/sanity/ignore-2.14.txt", "ftype": "file", "chksum_type": "sha256", - "chksum_sha256": "2bbf73bd4314d2ddf3be259531d6053876cf3eedfb2064d3f499230d35a5e29d", + "chksum_sha256": "71fd11298139d7839c2d0cf9c6933ad687b3a6bf7ca09862ea3b984e43bf72a4", "format": 1 }, { "name": "tests/sanity/ignore-2.15.txt", "ftype": "file", "chksum_type": "sha256", - "chksum_sha256": "2bbf73bd4314d2ddf3be259531d6053876cf3eedfb2064d3f499230d35a5e29d", + "chksum_sha256": "71fd11298139d7839c2d0cf9c6933ad687b3a6bf7ca09862ea3b984e43bf72a4", "format": 1 }, { "name": "tests/sanity/ignore-2.16.txt", "ftype": "file", "chksum_type": "sha256", - "chksum_sha256": "284e11dfcae8cd7417880d605cff0c5fca335d506122707fc0dff6485480c1eb", + "chksum_sha256": "9ae1170098d5b400a80d561fbaef8149b6707489c5f1424b64d418b80f1cecb9", "format": 1 }, { "name": "tests/sanity/ignore-2.17.txt", "ftype": "file", "chksum_type": "sha256", - "chksum_sha256": "e67ee7fbc5af526a8d088ddfdb7ce9a576c4fadac1d8146a5615ddc6654d3269", + "chksum_sha256": "51c1ac0a0e1858fc26f4e609e997a6084f49f18ee72bbed0b0e26377174ac60c", "format": 1 }, { @@ -2958,7 +2979,7 @@ "name": "tests/unit/plugins/module_utils/mock_info_api.py", "ftype": "file", "chksum_type": "sha256", - "chksum_sha256": "cab119466db38050d440bc7201e8b8a5124c5ec0696f4a695089a970c02d7602", + "chksum_sha256": "00610d4f77581b396be82ab4aeb8bef87e6a2b8347381664ae8319ebc00ca229", "format": 1 }, { @@ -2990,6 +3011,13 @@ "format": 1 }, { + "name": "tests/unit/plugins/module_utils/mock_resource_group_api.py", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "dde76ae958d17d0f149b29bcc72c48c00fa4df6bfc648ac62ddda4a8ad10ecc9", + "format": 1 + }, + { "name": "tests/unit/plugins/module_utils/mock_sdc_api.py", "ftype": "file", "chksum_type": "sha256", @@ -3063,7 +3091,7 @@ "name": "tests/unit/plugins/modules/test_info.py", "ftype": "file", "chksum_type": "sha256", - "chksum_sha256": "e50a6d20e1e279a687e1b6b699530a3abe8d83768e0d215189e54b0f9d8a12f0", + "chksum_sha256": "a83671b974fb7179328165836be0da764ff4b7d4bb3ebc89124a1c05090b93fb", "format": 1 }, { @@ -3095,6 +3123,13 @@ "format": 1 }, { + "name": "tests/unit/plugins/modules/test_resource_group.py", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "3499365b18657d8eac1e1636f46065e8e37ef3544f3660a4b20d6618a25d8e3a", + "format": 1 + }, + { "name": "tests/unit/plugins/modules/test_sdc.py", "ftype": "file", "chksum_type": "sha256", diff --git a/ansible_collections/dellemc/powerflex/MANIFEST.json b/ansible_collections/dellemc/powerflex/MANIFEST.json index 50f25fa4c..d52c820f7 100644 --- a/ansible_collections/dellemc/powerflex/MANIFEST.json +++ b/ansible_collections/dellemc/powerflex/MANIFEST.json @@ -2,7 +2,7 @@ "collection_info": { "namespace": "dellemc", "name": "powerflex", - "version": "2.2.0", + "version": "2.3.0", "authors": [ "Akash Shendge <ansible.team@dell.com>", "Arindam Datta <ansible.team@dell.com>", @@ -24,16 +24,16 @@ ], "license_file": null, "dependencies": {}, - "repository": "https://github.com/dell/ansible-powerflex/tree/2.2.0", - "documentation": "https://github.com/dell/ansible-powerflex/tree/2.2.0/docs", - "homepage": "https://github.com/dell/ansible-powerflex/tree/2.2.0", + "repository": "https://github.com/dell/ansible-powerflex/tree/2.3.0", + "documentation": "https://github.com/dell/ansible-powerflex/tree/2.3.0/docs", + "homepage": "https://github.com/dell/ansible-powerflex/tree/2.3.0", "issues": "https://www.dell.com/community/Automation/bd-p/Automation" }, "file_manifest_file": { "name": "FILES.json", "ftype": "file", "chksum_type": "sha256", - "chksum_sha256": "7b6cac9b3795806daa37e451654c294ca112eab9b180e45ccc02b4ae0c2f12ff", + "chksum_sha256": "c91fc714e4e70b371ad5de1191d1e8d5a6a829f347016680a0ce39e4931fceb4", "format": 1 }, "format": 1 diff --git a/ansible_collections/dellemc/powerflex/README.md b/ansible_collections/dellemc/powerflex/README.md index a12d86b97..155631def 100644 --- a/ansible_collections/dellemc/powerflex/README.md +++ b/ansible_collections/dellemc/powerflex/README.md @@ -6,29 +6,29 @@ The capabilities of the Ansible modules are managing SDCs, volumes, snapshots, s ## Table of contents -* [Code of conduct](https://github.com/dell/ansible-powerflex/blob/2.2.0/docs/CODE_OF_CONDUCT.md) -* [Maintainer guide](https://github.com/dell/ansible-powerflex/blob/2.2.0/docs/MAINTAINER_GUIDE.md) -* [Committer guide](https://github.com/dell/ansible-powerflex/blob/2.2.0/docs/COMMITTER_GUIDE.md) -* [Contributing guide](https://github.com/dell/ansible-powerflex/blob/2.2.0/docs/CONTRIBUTING.md) -* [Branching strategy](https://github.com/dell/ansible-powerflex/blob/2.2.0/docs/BRANCHING.md) -* [List of adopters](https://github.com/dell/ansible-powerflex/blob/2.2.0/docs/ADOPTERS.md) -* [Maintainers](https://github.com/dell/ansible-powerflex/blob/2.2.0/docs/MAINTAINERS.md) -* [Support](https://github.com/dell/ansible-powerflex/blob/2.2.0/docs/SUPPORT.md) +* [Code of conduct](https://github.com/dell/ansible-powerflex/blob/2.3.0/docs/CODE_OF_CONDUCT.md) +* [Maintainer guide](https://github.com/dell/ansible-powerflex/blob/2.3.0/docs/MAINTAINER_GUIDE.md) +* [Committer guide](https://github.com/dell/ansible-powerflex/blob/2.3.0/docs/COMMITTER_GUIDE.md) +* [Contributing guide](https://github.com/dell/ansible-powerflex/blob/2.3.0/docs/CONTRIBUTING.md) +* [Branching strategy](https://github.com/dell/ansible-powerflex/blob/2.3.0/docs/BRANCHING.md) +* [List of adopters](https://github.com/dell/ansible-powerflex/blob/2.3.0/docs/ADOPTERS.md) +* [Maintainers](https://github.com/dell/ansible-powerflex/blob/2.3.0/docs/MAINTAINERS.md) +* [Support](https://github.com/dell/ansible-powerflex/blob/2.3.0/docs/SUPPORT.md) * [License](#license) -* [Security](https://github.com/dell/ansible-powerflex/blob/2.2.0/docs/SECURITY.md) +* [Security](https://github.com/dell/ansible-powerflex/blob/2.3.0/docs/SECURITY.md) * [Prerequisites](#prerequisites) * [List of Ansible modules for Dell PowerFlex](#list-of-ansible-modules-for-dell-powerflex) * [Installation and execution of Ansible modules for Dell PowerFlex](#installation-and-execution-of-ansible-modules-for-dell-powerflex) * [Releasing, Maintenance and Deprecation](#releasing-maintenance-and-deprecation) ## License -The Ansible collection for PowerFlex is released and licensed under the GPL-3.0 license. See [LICENSE](https://github.com/dell/ansible-powerflex/blob/2.2.0/LICENSE) for the full terms. Ansible modules and modules utilities that are part of the Ansible collection for PowerFlex are released and licensed under the Apache 2.0 license. See [MODULE-LICENSE](https://github.com/dell/ansible-powerflex/blob/2.2.0/MODULE-LICENSE) for the full terms. +The Ansible collection for PowerFlex is released and licensed under the GPL-3.0 license. See [LICENSE](https://github.com/dell/ansible-powerflex/blob/2.3.0/LICENSE) for the full terms. Ansible modules and modules utilities that are part of the Ansible collection for PowerFlex are released and licensed under the Apache 2.0 license. See [MODULE-LICENSE](https://github.com/dell/ansible-powerflex/blob/2.3.0/MODULE-LICENSE) for the full terms. ## Prerequisites | **Ansible Modules** | **PowerFlex/VxFlex OS Version** | **SDK version** | **Python version** | **Ansible** | |---------------------|-----------------------|-------|--------------------|--------------------------| -| v2.2.0 |3.6 <br> 4.0 <br> 4.5 | 1.9.0 | 3.9.x <br> 3.10.x <br> 3.11.x | 2.14 <br> 2.15 <br> 2.16 | +| v2.3.0 |3.6 <br> 4.0 <br> 4.5 | 1.10.0 | 3.9.x <br> 3.10.x <br> 3.11.x | 2.14 <br> 2.15 <br> 2.16 | * Please follow PyPowerFlex installation instructions on [PyPowerFlex Documentation](https://github.com/dell/python-powerflex) @@ -36,22 +36,22 @@ The Ansible collection for PowerFlex is released and licensed under the GPL-3.0 The modules are written in such a way that all requests are idempotent and hence fault-tolerant. It essentially means that the result of a successfully performed request is independent of the number of times it is executed. ## List of Ansible modules for Dell PowerFlex - * [Info module](https://github.com/dell/ansible-powerflex/blob/2.2.0/docs/modules/info.rst) - * [Snapshot module](https://github.com/dell/ansible-powerflex/blob/2.2.0/docs/modules/snapshot.rst) - * [SDC module](https://github.com/dell/ansible-powerflex/blob/2.2.0/docs/modules/sdc.rst) - * [Storage pool module](https://github.com/dell/ansible-powerflex/blob/2.2.0/docs/modules/storagepool.rst) - * [Volume module](https://github.com/dell/ansible-powerflex/blob/2.2.0/docs/modules/volume.rst) - * [SDS module](https://github.com/dell/ansible-powerflex/blob/2.2.0/docs/modules/sds.rst) - * [Device Module](https://github.com/dell/ansible-powerflex/blob/2.2.0/docs/modules/device.rst) - * [Protection Domain Module](https://github.com/dell/ansible-powerflex/blob/2.2.0/docs/modules/protection_domain.rst) - * [MDM Cluster Module](https://github.com/dell/ansible-powerflex/blob/2.2.0/docs/modules/mdm_cluster.rst) - * [Replication Consistency Group Module](https://github.com/dell/ansible-powerflex/blob/2.2.0/docs/modules/replication_consistency_group.rst) - * [Replication Pair Module](https://github.com/dell/ansible-powerflex/blob/2.2.0/docs/modules/replication_pair.rst) - * [Snapshot Policy Module](https://github.com/dell/ansible-powerflex/blob/2.2.0/docs/modules/snapshot_policy.rst) - * [Fault Sets Module](https://github.com/dell/ansible-powerflex/blob/2.2.0/docs/modules/fault_set.rst) + * [Info module](https://github.com/dell/ansible-powerflex/blob/2.3.0/docs/modules/info.rst) + * [Snapshot module](https://github.com/dell/ansible-powerflex/blob/2.3.0/docs/modules/snapshot.rst) + * [SDC module](https://github.com/dell/ansible-powerflex/blob/2.3.0/docs/modules/sdc.rst) + * [Storage pool module](https://github.com/dell/ansible-powerflex/blob/2.3.0/docs/modules/storagepool.rst) + * [Volume module](https://github.com/dell/ansible-powerflex/blob/2.3.0/docs/modules/volume.rst) + * [SDS module](https://github.com/dell/ansible-powerflex/blob/2.3.0/docs/modules/sds.rst) + * [Device Module](https://github.com/dell/ansible-powerflex/blob/2.3.0/docs/modules/device.rst) + * [Protection Domain Module](https://github.com/dell/ansible-powerflex/blob/2.3.0/docs/modules/protection_domain.rst) + * [MDM Cluster Module](https://github.com/dell/ansible-powerflex/blob/2.3.0/docs/modules/mdm_cluster.rst) + * [Replication Consistency Group Module](https://github.com/dell/ansible-powerflex/blob/2.3.0/docs/modules/replication_consistency_group.rst) + * [Replication Pair Module](https://github.com/dell/ansible-powerflex/blob/2.3.0/docs/modules/replication_pair.rst) + * [Snapshot Policy Module](https://github.com/dell/ansible-powerflex/blob/2.3.0/docs/modules/snapshot_policy.rst) + * [Fault Sets Module](https://github.com/dell/ansible-powerflex/blob/2.3.0/docs/modules/fault_set.rst) ## Installation and execution of Ansible modules for Dell PowerFlex -The installation and execution steps of Ansible modules for Dell PowerFlex can be found [here](https://github.com/dell/ansible-powerflex/blob/2.2.0/docs/INSTALLATION.md). +The installation and execution steps of Ansible modules for Dell PowerFlex can be found [here](https://github.com/dell/ansible-powerflex/blob/2.3.0/docs/INSTALLATION.md). ## Releasing, Maintenance and Deprecation @@ -59,6 +59,6 @@ Ansible Modules for Dell Technologies PowerFlex follows [Semantic Versioning](ht 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-powerflex/blob/2.2.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-powerflex/blob/2.3.0/docs/BRANCHING.md). Ansible Modules for Dell Technologies PowerFlex deprecation cycle is aligned with that of [Ansible](https://docs.ansible.com/ansible/latest/dev_guide/module_lifecycle.html).
\ No newline at end of file diff --git a/ansible_collections/dellemc/powerflex/changelogs/.plugin-cache.yaml b/ansible_collections/dellemc/powerflex/changelogs/.plugin-cache.yaml index b2098aee6..ce26c2f7e 100644 --- a/ansible_collections/dellemc/powerflex/changelogs/.plugin-cache.yaml +++ b/ansible_collections/dellemc/powerflex/changelogs/.plugin-cache.yaml @@ -16,6 +16,11 @@ plugins: name: device namespace: '' version_added: 1.1.0 + fault_set: + description: Manage Fault Sets on Dell PowerFlex + name: fault_set + namespace: '' + version_added: 2.2.0 info: description: Gathering information about Dell PowerFlex name: info @@ -41,6 +46,11 @@ plugins: name: replication_pair namespace: '' version_added: 1.6.0 + resource_group: + description: Manage resource group deployments on Dell PowerFlex. + name: resource_group + namespace: '' + version_added: 2.3.0 sdc: description: Manage SDCs on Dell PowerFlex name: sdc @@ -76,4 +86,4 @@ plugins: strategy: {} test: {} vars: {} -version: 2.1.0 +version: 2.3.0 diff --git a/ansible_collections/dellemc/powerflex/changelogs/changelog.yaml b/ansible_collections/dellemc/powerflex/changelogs/changelog.yaml index 8211b2b91..2c8926ed1 100644 --- a/ansible_collections/dellemc/powerflex/changelogs/changelog.yaml +++ b/ansible_collections/dellemc/powerflex/changelogs/changelog.yaml @@ -146,3 +146,15 @@ releases: name: fault_set namespace: '' release_date: '2024-02-29' + 2.3.0: + changes: + minor_changes: + - Added support for resource group provisioning to validate, deploy, + edit, add nodes and delete a resource group. + - The Info module is enhanced to list the firmware repositories. + - Added support for PowerFlex ansible modules and roles on Azure. + modules: + - description: Manage resource group deployments on Dell PowerFlex + name: resource_group + namespace: '' + release_date: '2024-03-29' diff --git a/ansible_collections/dellemc/powerflex/docs/CONTRIBUTING.md b/ansible_collections/dellemc/powerflex/docs/CONTRIBUTING.md index 726c931d0..9c45af69c 100644 --- a/ansible_collections/dellemc/powerflex/docs/CONTRIBUTING.md +++ b/ansible_collections/dellemc/powerflex/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-powerflex/blob/2.2.0/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-powerflex/blob/2.3.0/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 PowerFlex 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-powerflex/blob/2.2.0/ISSUE_TRIAGE.md). +Read more about the ways you can [Triage issues](https://github.com/dell/ansible-powerflex/blob/2.3.0/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 PowerFlex](https://github.com/dell/ansible-powerflex/blob/2.2.0/BRANCHING.md) +* [Branching Strategy for Ansible modules for Dell PowerFlex](https://github.com/dell/ansible-powerflex/blob/2.3.0/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-powerflex/blob/2.2.0/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-powerflex/blob/2.3.0/SUPPORT.md). #### Code sanitization diff --git a/ansible_collections/dellemc/powerflex/docs/INSTALLATION.md b/ansible_collections/dellemc/powerflex/docs/INSTALLATION.md index 86861574b..1aed4d367 100644 --- a/ansible_collections/dellemc/powerflex/docs/INSTALLATION.md +++ b/ansible_collections/dellemc/powerflex/docs/INSTALLATION.md @@ -41,7 +41,7 @@ You may obtain a copy of the License at * Download the latest tar build from any of the available distribution channel [Ansible Galaxy](https://galaxy.ansible.com/dellemc/powerflex) /[Automation Hub](https://console.redhat.com/ansible/automation-hub/repo/published/dellemc/powerflex) and use this command to install the collection anywhere in your system: - ansible-galaxy collection install dellemc-powerflex-2.2.0.tar.gz -p <install_path> + ansible-galaxy collection install dellemc-powerflex-2.3.0.tar.gz -p <install_path> * Set the environment variable: @@ -68,7 +68,7 @@ You may obtain a copy of the License at ## Ansible modules execution -The Ansible server must be configured with Python library for PowerFlex to run the Ansible playbooks. The [Documents](https://github.com/dell/ansible-powerflex/blob/2.2.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 PowerFlex to run the Ansible playbooks. The [Documents](https://github.com/dell/ansible-powerflex/blob/2.3.0/docs/) provide information on different Ansible modules along with their functions and syntax. The parameters table in the Product Guide provides information on various parameters which needs to be configured before running the modules. ## SSL certificate validation diff --git a/ansible_collections/dellemc/powerflex/docs/ISSUE_TRIAGE.md b/ansible_collections/dellemc/powerflex/docs/ISSUE_TRIAGE.md index 8871da8e3..939aca18d 100644 --- a/ansible_collections/dellemc/powerflex/docs/ISSUE_TRIAGE.md +++ b/ansible_collections/dellemc/powerflex/docs/ISSUE_TRIAGE.md @@ -43,8 +43,8 @@ Should explain what happened, what was expected and how to reproduce it together - Ansible Version: [e.g. 2.14] - Python Version [e.g. 3.11] - - Ansible modules for Dell PowerFlex Version: [e.g. 2.2.0] - - PowerFlex SDK version: [e.g. PyPowerFlex 1.9.0] + - Ansible modules for Dell PowerFlex Version: [e.g. 2.3.0] + - PowerFlex SDK version: [e.g. PyPowerFlex 1.10.0] - Any other additional information... #### Feature requests diff --git a/ansible_collections/dellemc/powerflex/docs/MAINTAINER_GUIDE.md b/ansible_collections/dellemc/powerflex/docs/MAINTAINER_GUIDE.md index e2d1d90e0..b6efdd20b 100644 --- a/ansible_collections/dellemc/powerflex/docs/MAINTAINER_GUIDE.md +++ b/ansible_collections/dellemc/powerflex/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-powerflex/blob/2.2.0/CODE_OF_CONDUCT.md) and the guidelines in the [Contributing](https://github.com/dell/ansible-powerflex/blob/2.2.0/CONTRIBUTING.md) and [Committer](https://github.com/dell/ansible-powerflex/blob/2.2.0/COMMITTER_GUIDE.md) guides +* Follow the [Code of Conduct](https://github.com/dell/ansible-powerflex/blob/2.3.0/CODE_OF_CONDUCT.md) and the guidelines in the [Contributing](https://github.com/dell/ansible-powerflex/blob/2.3.0/CONTRIBUTING.md) and [Committer](https://github.com/dell/ansible-powerflex/blob/2.3.0/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/powerflex/docs/Release Notes.md b/ansible_collections/dellemc/powerflex/docs/Release Notes.md index 9ce24b6d0..e9c5f24c2 100644 --- a/ansible_collections/dellemc/powerflex/docs/Release Notes.md +++ b/ansible_collections/dellemc/powerflex/docs/Release Notes.md @@ -1,6 +1,6 @@ **Ansible Modules for Dell Technologies PowerFlex** ========================================= -### Release notes 2.2.0 +### Release notes 2.3.0 > © 2024 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 | February 2024 | Current release of Ansible Modules for Dell PowerFlex 2.2.0 | +| 01 | March 2024 | Current release of Ansible Modules for Dell PowerFlex 2.3.0 | Product description ------------------- @@ -36,7 +36,7 @@ Product description The Ansible modules for Dell PowerFlex are used to automate and orchestrate the deployment, configuration, and management of Dell PowerFlex storage systems. The capabilities of Ansible modules are managing volumes, -storage pools, SDCs, snapshots, snapshot policy, SDSs, replication consistency groups, replication pairs, devices, protection domain, MDM and fault sets. +storage pools, SDCs, snapshots, snapshot policy, SDSs, replication consistency groups, replication pairs, resource group, devices, protection domain, MDM and fault sets. cluster, and obtaining high-level information about a PowerFlex system information. The modules use playbooks to list, show, create, delete, and modify each of the entities. @@ -44,15 +44,15 @@ each of the entities. New features and enhancements ----------------------------- Along with the previous release deliverables, this release supports following features - -- Fault set module is introduced to create, get details, rename and delete fault sets. -- The SDS module has been enhanced to facilitate SDS creation within a fault set. -- The Info module is enhanced to retrieve lists related to fault sets, service templates, deployments, and managed devices. +- Added support for resource group provisioning to validate, deploy, edit, add nodes and delete a resource group. +- The Info module is enhanced to list out all the firmware repository. +- Added support for PowerFlex ansible modules and roles on Azure. Known issues ------------ - Setting the RF cache and performance profile of the SDS during its creation fails intermittently on PowerFlex version 3.5. - The creation of replication pair fails when copy_type is specified as OfflineCopy on PowerFlex version 4.0. -- Pagination in info module with offset and limit fetches more than expected records when listing service templates or deployments. +- Pagination in info module with offset and limit fetches more than expected records when listing service templates, deployments or firmware repository. - Templates are fetched using the info module in spite of setting include_templates to false when listing deployments. Limitations @@ -62,11 +62,11 @@ Limitations Distribution ------------ The software package is available for download from the [Ansible Modules -for PowerFlex GitHub](https://github.com/dell/ansible-powerflex/tree/2.2.0) page. +for PowerFlex GitHub](https://github.com/dell/ansible-powerflex/tree/2.3.0) page. Documentation ------------- -The documentation is available on [Ansible Modules for PowerFlex GitHub](https://github.com/dell/ansible-powerflex/tree/2.2.0/docs) +The documentation is available on [Ansible Modules for PowerFlex GitHub](https://github.com/dell/ansible-powerflex/tree/2.3.0/docs) page. It includes the following: - README diff --git a/ansible_collections/dellemc/powerflex/docs/SECURITY.md b/ansible_collections/dellemc/powerflex/docs/SECURITY.md index 77323e456..5ebcaa3ee 100644 --- a/ansible_collections/dellemc/powerflex/docs/SECURITY.md +++ b/ansible_collections/dellemc/powerflex/docs/SECURITY.md @@ -12,7 +12,7 @@ You may obtain a copy of the License at The Ansible modules for Dell PowerFlex 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-powerflex/blob/2.2.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-powerflex/blob/2.3.0/docs/CONTRIBUTING.md#Pull-requests) for more information. ## Reporting a vulnerability diff --git a/ansible_collections/dellemc/powerflex/docs/modules/info.rst b/ansible_collections/dellemc/powerflex/docs/modules/info.rst index ced8e0aaa..7b933203f 100644 --- a/ansible_collections/dellemc/powerflex/docs/modules/info.rst +++ b/ansible_collections/dellemc/powerflex/docs/modules/info.rst @@ -14,7 +14,7 @@ Synopsis Gathering information about Dell PowerFlex storage system includes getting the api details, list of volumes, SDSs, SDCs, storage pools, protection domains, snapshot policies, and devices. -Gathering information about Dell PowerFlex Manager includes getting the list of managed devices, deployments and service templates. +Gathering information about Dell PowerFlex Manager includes getting the list of managed devices, deployments, service templates and firmware repository. @@ -22,9 +22,9 @@ Requirements ------------ The below requirements are needed on the host that executes this module. -- A Dell PowerFlex storage system version 3.5 or later. +- A Dell PowerFlex storage system version 3.6 or later. - Ansible-core 2.14 or later. -- PyPowerFlex 1.8.0. +- PyPowerFlex 1.10.0. - Python 3.9, 3.10 or 3.11. @@ -33,7 +33,7 @@ Parameters ---------- gather_subset (optional, list, None) - List of string variables to specify the Powerflex storage system entities for which information is required. + List of string variables to specify the PowerFlex storage system entities for which information is required. Volumes - ``vol``. @@ -61,6 +61,8 @@ Parameters Deployments - ``deployment``. + FirmwareRepository - ``firmware_repository``. + filters (optional, list, None) List of filters to support filtered output for storage entities. @@ -77,7 +79,7 @@ Parameters filter_operator (True, str, None) Operation to be performed on filter key. - Choice *'contains'* is supported for gather_subset keys *service_template*, *managed_device*, *deployment*. + Choice ``contains`` is supported for *gather_subset* keys ``service_template``, ``managed_device``, ``deployment``, ``firmware_repository``. filter_value (True, str, None) @@ -88,47 +90,65 @@ Parameters limit (optional, int, 50) Page limit. - Supported for gather_subset keys *service_template*, *managed_device*, *deployment*. + Supported for *gather_subset* keys ``service_template``, ``managed_device``, ``deployment``, ``firmware_repository``. offset (optional, int, 0) Pagination offset. - Supported for gather_subset keys *service_template*, *managed_device*, *deployment*. + Supported for *gather_subset* keys ``service_template``, ``managed_device``, ``deployment``, ``firmware_repository``. sort (optional, str, None) Sort the returned components based on specified field. - Supported for gather_subset keys *service_template*, *managed_device*, *deployment*. + Supported for *gather_subset* keys ``service_template``, ``managed_device``, ``deployment``, ``firmware_repository``. - The supported sort keys for the gather_subset can be referred from PowerFlex Manager API documentation in developer.dell.com. + The supported sort keys for the *gather_subset* can be referred from PowerFlex Manager API documentation in https://developer.dell.com. include_devices (optional, bool, True) Include devices in response. - Applicable when gather_subset is *deployment*. + Applicable when *gather_subset* is ``deployment``. include_template (optional, bool, True) Include service templates in response. - Applicable when gather_subset is *deployment*. + Applicable when *gather_subset* is ``deployment``. full (optional, bool, False) Specify if response is full or brief. - Applicable when gather_subset is *deployment*, *service_template*. + Applicable when *gather_subset* is ``deployment``, ``service_template``. - For *deployment* specify to use full templates including resources in response. + For ``deployment`` specify to use full templates including resources in response. include_attachments (optional, bool, True) Include attachments. - Applicable when gather_subset is *service_template*. + Applicable when *gather_subset* is ``service_template``. + + + include_related (optional, bool, False) + Include related entities. + + Applicable when *gather_subset* is ``firmware_repository``. + + + include_bundles (optional, bool, False) + Include software bundle entities. + + Applicable when *gather_subset* is ``firmware_repository``. + + + include_components (optional, bool, False) + Include software component entities. + + Applicable when *gather_subset* is ``firmware_repository``. hostname (True, str, None) @@ -169,8 +189,8 @@ Notes .. note:: - The *check_mode* is supported. - - The supported filter keys for the gather_subset can be referred from PowerFlex Manager API documentation in developer.dell.com. - - The *filter*, *sort*, *limit* and *offset* options will be ignored when more than one *gather_subset* is specified along with *service_template*, *managed_device* or *deployment*. + - The supported filter keys for the *gather_subset* can be referred from PowerFlex Manager API documentation in https://developer.dell.com. + - The *filter*, *sort*, *limit* and *offset* options will be ignored when more than one *gather_subset* is specified along with ``service_template``, ``managed_device``, ``deployment`` or ``firmware_repository``. - The modules present in the collection named as 'dellemc.powerflex' are built to support the Dell PowerFlex storage platform. @@ -184,10 +204,10 @@ Examples - name: Get detailed list of PowerFlex entities dellemc.powerflex.info: - hostname: "{{hostname}}" - username: "{{username}}" - password: "{{password}}" - validate_certs: "{{validate_certs}}" + hostname: "{{ hostname }}" + username: "{{ username }}" + password: "{{ password }}" + validate_certs: "{{ validate_certs }}" gather_subset: - vol - storage_pool @@ -202,10 +222,10 @@ Examples - name: Get a subset list of PowerFlex volumes dellemc.powerflex.info: - hostname: "{{hostname}}" - username: "{{username}}" - password: "{{password}}" - validate_certs: "{{validate_certs}}" + hostname: "{{ hostname }}" + username: "{{ username }}" + password: "{{ password }}" + validate_certs: "{{ validate_certs }}" gather_subset: - vol filters: @@ -215,10 +235,10 @@ Examples - name: Get deployment and resource provisioning info dellemc.powerflex.info: - hostname: "{{hostname}}" - username: "{{username}}" - password: "{{password}}" - validate_certs: "{{validate_certs}}" + hostname: "{{ hostname }}" + username: "{{ username }}" + password: "{{ password }}" + validate_certs: "{{ validate_certs }}" gather_subset: - managed_device - deployment @@ -226,10 +246,10 @@ Examples - name: Get deployment with filter, sort, pagination dellemc.powerflex.info: - hostname: "{{hostname}}" - username: "{{username}}" - password: "{{password}}" - validate_certs: "{{validate_certs}}" + hostname: "{{ hostname }}" + username: "{{ username }}" + password: "{{ password }}" + validate_certs: "{{ validate_certs }}" gather_subset: - deployment filters: @@ -242,6 +262,60 @@ Examples include_devices: true include_template: true + - name: Get the list of firmware repository. + dellemc.powerflex.info: + hostname: "{{ hostname }}" + username: "{{ username }}" + password: "{{ password }}" + validate_certs: "{{ validate_certs }}" + gather_subset: + - firmware_repository + + - name: Get the list of firmware repository + dellemc.powerflex.info: + hostname: "{{ hostname }}" + username: "{{ username }}" + password: "{{ password }}" + validate_certs: "{{ validate_certs }}" + gather_subset: + - firmware_repository + include_related: true + include_bundles: true + include_components: true + + - name: Get the list of firmware repository with filter + dellemc.powerflex.info: + hostname: "{{ hostname }}" + username: "{{ username }}" + password: "{{ password }}" + validate_certs: "{{ validate_certs }}" + gather_subset: + - firmware_repository + filters: + - filter_key: "createdBy" + filter_operator: "equal" + filter_value: "admin" + sort: createdDate + limit: 10 + include_related: true + include_bundles: true + include_components: true + register: result_repository_out + + - name: Get the list of available firmware repository + ansible.builtin.debug: + msg: "{{ result_repository_out.FirmwareRepository | selectattr('state', 'equalto', 'available') }}" + + - name: Get the list of software components in the firmware repository + ansible.builtin.debug: + msg: "{{ result_repository_out.FirmwareRepository | + selectattr('id', 'equalto', '8aaa80788b7') | map(attribute='softwareComponents') | flatten }}" + + - name: Get the list of software bundles in the firmware repository + ansible.builtin.debug: + msg: "{{ result_repository_out.FirmwareRepository | + selectattr('id', 'equalto', '8aaa80788b7') | map(attribute='softwareBundles') | flatten }}" + Return Values @@ -841,6 +915,39 @@ ServiceTemplates (when I(gather_subset) is I(service_template), list, [{'id': '2 +FirmwareRepository (when I(gather_subset) is C(firmware_repository), list, [{'id': '8aaa03a78de4b2a5018de662818d000b', 'name': 'https://192.168.0.1/artifactory/path/pfxmlogs-bvt-pfmp-swo-upgrade-402-to-451-56.tar.gz', 'sourceLocation': 'https://192.168.0.2/artifactory/path/pfxmlogs-bvt-pfmp-swo-upgrade-402-to-451-56.tar.gz', 'sourceType': None, 'diskLocation': '', 'filename': '', 'md5Hash': None, 'username': '', 'password': '', 'downloadStatus': 'error', 'createdDate': '2024-02-26T17:07:11.884+00:00', 'createdBy': 'admin', 'updatedDate': '2024-03-01T06:21:10.917+00:00', 'updatedBy': 'system', 'defaultCatalog': False, 'embedded': False, 'state': 'errors', 'softwareComponents': [], 'softwareBundles': [], 'deployments': [], 'bundleCount': 0, 'componentCount': 0, 'userBundleCount': 0, 'minimal': True, 'downloadProgress': 100, 'extractProgress': 0, 'fileSizeInGigabytes': 0.0, 'signedKeySourceLocation': None, 'signature': 'Unknown', 'custom': False, 'needsAttention': False, 'jobId': 'Job-10d75a23-d801-4fdb-a2d0-7f6389ab75cf', 'rcmapproved': False}]) + Details of all firmware repository. + + + id (, str, ) + ID of the firmware repository. + + + name (, str, ) + Name of the firmware repository. + + + sourceLocation (, str, ) + Source location of the firmware repository. + + + state (, str, ) + State of the firmware repository. + + + softwareComponents (, list, ) + Software components of the firmware repository. + + + softwareBundles (, list, ) + Software bundles of the firmware repository. + + + deployments (, list, ) + Deployments of the firmware repository. + + + @@ -857,4 +964,5 @@ Authors - Arindam Datta (@dattaarindam) <ansible.team@dell.com> - Trisha Datta (@trisha-dell) <ansible.team@dell.com> - Jennifer John (@Jennifer-John) <ansible.team@dell.com> +- Felix Stephen (@felixs88) <ansible.team@dell.com> diff --git a/ansible_collections/dellemc/powerflex/docs/modules/resource_group.rst b/ansible_collections/dellemc/powerflex/docs/modules/resource_group.rst new file mode 100644 index 000000000..e8bdbde09 --- /dev/null +++ b/ansible_collections/dellemc/powerflex/docs/modules/resource_group.rst @@ -0,0 +1,281 @@ +.. _resource_group_module: + + +resource_group -- Manage resource group deployments on Dell PowerFlex. +====================================================================== + +.. contents:: + :local: + :depth: 1 + + +Synopsis +-------- + +Managing resource group deployments on PowerFlex storage system includes deploying, editing, adding nodes and deleting a resource group deployment. + + + +Requirements +------------ +The below requirements are needed on the host that executes this module. + +- A Dell PowerFlex storage system version 3.6 or later. +- Ansible-core 2.14 or later. +- PyPowerFlex 1.10.0. +- Python 3.9, 3.10 or 3.11. + + + +Parameters +---------- + + resource_group_name (optional, str, None) + The name of the resource group. + + This is a required field to deploy a resource group. + + Either *resource_group_id* or *resource_group_name* must be specified to perform resource group operations. + + Mutually exclusive with *resource_group_id*. + + + resource_group_id (optional, str, None) + The ID of the resource group. + + Either *resource_group_id* or *resource_group_name* must be specified to perform resource group operations. + + Mutually exclusive with *resource_group_name*. + + + template_name (optional, str, None) + The name of the published template. + + Either *template_id* or *template_name* must be specified to deploy a resource group. + + Mutually exclusive with *template_id*. + + + template_id (optional, str, None) + The ID of the published template. + + Either *template_id* or *template_name* must be specified to deploy a resource group. + + Mutually exclusive with *template_name*. + + + firmware_repository_id (optional, str, None) + The ID of the firmware repository if not using the appliance default catalog. + + Mutually exclusive with *firmware_repository_name*. + + + firmware_repository_name (optional, str, None) + The name of the firmware repository if not using the appliance default catalog. + + Mutually exclusive with *firmware_repository_id*. + + + new_resource_group_name (optional, str, None) + New name of the resource group to rename to. + + + description (optional, str, None) + The description of the resource group. + + + scaleup (optional, bool, False) + Whether to scale up the resource group. Specify as true to add nodes to the resource group. + + + clone_node (optional, str, None) + Resource to duplicate during scaleup, if more than one nodes are available in the resource group. + + + node_count (optional, int, 1) + Number of nodes to clone during scaleup. + + + validate (optional, bool, False) + Specify as true to validate the deployment of resource group. + + + schedule_date (optional, str, None) + Scheduled date for the resource group deployment. + + Specify in YYYY-MM-DD HH:MM:SS.sss or YYYY-MM-DD format. + + + state (optional, str, present) + The state of the resource group. + + + hostname (True, str, None) + IP or FQDN of the PowerFlex host. + + + username (True, str, None) + The username of the PowerFlex host. + + + password (True, str, None) + The password of the PowerFlex host. + + + 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 PowerFlex host. + + + timeout (False, int, 120) + Time after which connection will get terminated. + + It is to be mentioned in seconds. + + + + + +Notes +----- + +.. note:: + - The *check_mode* is supported. + - Resource group scale up can be done only when deployment is complete. + - The modules present in the collection named as 'dellemc.powerflex' are built to support the Dell PowerFlex storage platform. + + + + +Examples +-------- + +.. code-block:: yaml+jinja + + + - name: Validate deployment of a resource group + dellemc.powerflex.resource_group: + hostname: "{{ hostname }}" + username: "{{ username }}" + password: "{{ password }}" + validate_certs: "{{ validate_certs }}" + port: "{{ port }}" + resource_group_name: "{{ resource_group_name_1 }}" + description: ans_rg + template_id: c65d0172-8666-48ab-935e-9a0bf69ed66d + firmware_repository_id: 8aaa80788b5755d1018b576126d51ba3 + validate: true + + - name: Deploy a resource group + dellemc.powerflex.resource_group: + hostname: "{{ hostname }}" + username: "{{ username }}" + password: "{{ password }}" + validate_certs: "{{ validate_certs }}" + port: "{{ port }}" + resource_group_name: "{{ resource_group_name_1 }}" + description: ans_rg + template_id: c65d0172-8666-48ab-935e-9a0bf69ed66d + firmware_repository_id: 8aaa80788b5755d1018b576126d51ba3 + + - name: Add a node to a resource group + dellemc.powerflex.resource_group: + hostname: "{{ hostname }}" + username: "{{ username }}" + password: "{{ password }}" + validate_certs: "{{ validate_certs }}" + resource_group_name: "{{ resource_group_name_1 }}" + scaleup: true + clone_node: "{{ node_1 }}" + node_count: "{{ node_count }}" + + - name: Modify a resource group + dellemc.powerflex.resource_group: + hostname: "{{ hostname }}" + username: "{{ username }}" + password: "{{ password }}" + validate_certs: "{{ validate_certs }}" + resource_group_name: "{{ resource_group_name_1 }}" + new_resource_group_name: "{{ new_resource_group_name }}" + description: "description new" + + - name: Delete a resource group + dellemc.powerflex.resource_group: + hostname: "{{ hostname }}" + username: "{{ username }}" + password: "{{ password }}" + validate_certs: "{{ validate_certs }}" + port: "{{ port }}" + resource_group_name: ans_rg + state: "absent" + + + +Return Values +------------- + +changed (always, bool, false) + Whether or not the resource has changed. + + +resource_group_details (When resource group exists., dict, {'id': '8aaa03a88de961fa018de96a88d80008', 'deploymentName': 'dep-ans-test-rg1', 'deploymentDescription': 'ans test rg', 'retry': True, 'teardown': False, 'serviceTemplate': {'id': '8aaa03a88de961fa018de96a88d80008', 'templateName': 'update-template (8aaa03a88de961fa018de96a88d80008)'}, 'scheduleDate': None, 'status': 'error', 'compliant': True, 'deploymentDevice': [{'refId': 'scaleio-block-legacy-gateway', 'refType': 'SCALEIO', 'deviceHealth': 'GREEN', 'compliantState': 'COMPLIANT', 'deviceType': 'scaleio', 'currentIpAddress': '1.3.9.2', 'componentId': '910bf934-d45a-4fe3-8ea2-dc481e063a81', 'statusMessage': 'The processing of PowerFlex is unsuccessful.', 'model': 'PowerFlex Gateway', 'brownfield': False}], 'updateServerFirmware': True, 'useDefaultCatalog': True, 'firmwareRepository': {'id': '8aaa80788b5755d1018b576126d51ba3', 'name': 'PowerFlex 4.5.0.0', 'rcmapproved': False}, 'firmwareRepositoryId': '8aaa80788b5755d1018b576126d51ba3', 'deploymentHealthStatusType': 'red', 'allUsersAllowed': False, 'owner': 'admin', 'numberOfDeployments': 0, 'lifecycleMode': False, 'vds': False, 'scaleUp': False, 'brownfield': False, 'templateValid': True, 'configurationChange': False}) + Details of the resource group deployment. + + + id (, str, ) + The ID of the deployed resource group. + + + deploymentName (, str, ) + The name of the resource group deployment. + + + deploymentDescription (, str, ) + The description of the resource group deployment. + + + serviceTemplate (, dict, ) + The service template of the resource group. + + + id (, str, ) + The ID of the service template. + + + templateName (, str, ) + The name of the service template. + + + + status (, str, ) + The status of the deployment of the resource group. + + + firmwareRepositoryId (, str, ) + The ID of the firmware repository of the resource group. + + + + + + +Status +------ + + + + + +Authors +~~~~~~~ + +- Jennifer John (@johnj9) <ansible.team@dell.com> +- Trisha Datta (@trisha-dell) <ansible.team@dell.com> + diff --git a/ansible_collections/dellemc/powerflex/meta/runtime.yml b/ansible_collections/dellemc/powerflex/meta/runtime.yml index 6fa701d3a..dd41c3e91 100644 --- a/ansible_collections/dellemc/powerflex/meta/runtime.yml +++ b/ansible_collections/dellemc/powerflex/meta/runtime.yml @@ -3,37 +3,30 @@ requires_ansible: ">=2.14.0" plugin_routing: modules: dellemc_powerflex_gatherfacts: - redirect: dellemc.powerflex.info - deprecation: - removal_date: "2024-03-31" + tombstone: + removal_date: "2024-03-22" warning_text: Use info module instead. dellemc_powerflex_device: - redirect: dellemc.powerflex.device - deprecation: - removal_date: "2024-03-31" + tombstone: + removal_date: "2024-03-22" warning_text: Use device module instead. dellemc_powerflex_sdc: - redirect: dellemc.powerflex.sdc - deprecation: - removal_date: "2024-03-31" + tombstone: + removal_date: "2024-03-22" warning_text: Use sdc module instead. dellemc_powerflex_sds: - redirect: dellemc.powerflex.sds - deprecation: - removal_date: "2024-03-31" + tombstone: + removal_date: "2024-03-22" warning_text: Use sds module instead. dellemc_powerflex_snapshot: - redirect: dellemc.powerflex.snapshot - deprecation: - removal_date: "2024-03-31" + tombstone: + removal_date: "2024-03-22" warning_text: Use snapshot module instead. dellemc_powerflex_storagepool: - redirect: dellemc.powerflex.storagepool - deprecation: - removal_date: "2024-03-31" + tombstone: + removal_date: "2024-03-22" warning_text: Use storagepool module instead. dellemc_powerflex_volume: - redirect: dellemc.powerflex.volume - deprecation: - removal_date: "2024-03-31" + tombstone: + removal_date: "2024-03-22" warning_text: Use volume module instead. diff --git a/ansible_collections/dellemc/powerflex/playbooks/modules/info.yml b/ansible_collections/dellemc/powerflex/playbooks/modules/info.yml index b1a16785a..fac8af87e 100644 --- a/ansible_collections/dellemc/powerflex/playbooks/modules/info.yml +++ b/ansible_collections/dellemc/powerflex/playbooks/modules/info.yml @@ -78,3 +78,60 @@ filter_value: "partial" sort: name limit: 10 + + - name: Get the list of firmware repository + dellemc.powerflex.info: + hostname: "{{ hostname }}" + username: "{{ username }}" + password: "{{ password }}" + validate_certs: "{{ validate_certs }}" + gather_subset: + - firmware_repository + + - name: Get the list of firmware repository + dellemc.powerflex.info: + hostname: "{{ hostname }}" + username: "{{ username }}" + password: "{{ password }}" + validate_certs: "{{ validate_certs }}" + gather_subset: + - firmware_repository + include_related: true + include_bundles: true + include_components: true + + - name: Get the list of firmware repository with filter + dellemc.powerflex.info: + hostname: "{{ hostname }}" + username: "{{ username }}" + password: "{{ password }}" + validate_certs: "{{ validate_certs }}" + gather_subset: + - firmware_repository + filters: + - filter_key: "createdBy" + filter_operator: "equal" + filter_value: "admin" + sort: createdDate + limit: 10 + include_related: true + include_bundles: true + include_components: true + register: result_repository_out + + - name: Get the list of available firmware repository + ansible.builtin.debug: + msg: "{{ result_repository_out.FirmwareRepository | + selectattr('state', 'equalto', 'available') }}" + + - name: Get the list of software components in the firmware repository + ansible.builtin.debug: + msg: "{{ result_repository_out.FirmwareRepository | + selectattr('id', 'equalto', '8aaa80788b7') | + map(attribute='softwareComponents') | flatten }}" + + - name: Get the list of software bundles in the firmware repository + ansible.builtin.debug: + msg: "{{ result_repository_out.FirmwareRepository | + selectattr('id', 'equalto', '8aaa80788b7') | + map(attribute='softwareBundles') | flatten }}" diff --git a/ansible_collections/dellemc/powerflex/playbooks/modules/resource_group.yml b/ansible_collections/dellemc/powerflex/playbooks/modules/resource_group.yml new file mode 100644 index 000000000..2cbc22e55 --- /dev/null +++ b/ansible_collections/dellemc/powerflex/playbooks/modules/resource_group.yml @@ -0,0 +1,71 @@ +--- +- name: Resource group operations on PowerFlex array. + hosts: localhost + connection: local + gather_facts: false + vars: + hostname: 'x.x.x.x' + username: 'admin' + password: 'Password' + validate_certs: false + host_port: 443 + resource_group_name_1: "ans_rg" + node_1: "vpi2170" + template_id: "c65d0172-8666-48ab-935e-9a0bf69ed66d" + + tasks: + - name: Validate deployment of a resource group + register: result + dellemc.powerflex.resource_group: + hostname: "{{ hostname }}" + username: "{{ username }}" + password: "{{ password }}" + validate_certs: "{{ validate_certs }}" + resource_group_name: "{{ resource_group_name_1 }}" + description: ans_rg + template_id: "{{ template_id }}" + firmware_repository_name: "PowerFlex 4.5.0.0" + validate: true + + - name: Deploy a resource group + register: result + dellemc.powerflex.resource_group: + hostname: "{{ hostname }}" + username: "{{ username }}" + password: "{{ password }}" + validate_certs: "{{ validate_certs }}" + resource_group_name: "{{ resource_group_name_1 }}" + description: ans_rg + template_id: "{{ template_id }}" + firmware_repository_name: "PowerFlex 4.5.0.0" + + - name: Add a node to a resource group + dellemc.powerflex.resource_group: + hostname: "{{ hostname }}" + username: "{{ username }}" + password: "{{ password }}" + validate_certs: "{{ validate_certs }}" + resource_group_name: "{{ resource_group_name_1 }}" + scaleup: true + clone_node: "{{ node_1 }}" + node_count: 2 + + - name: Modify a resource group + dellemc.powerflex.resource_group: + hostname: "{{ hostname }}" + username: "{{ username }}" + password: "{{ password }}" + validate_certs: "{{ validate_certs }}" + resource_group_name: "{{ resource_group_name_1 }}" + new_resource_group_name: "new_resource_group_name" + description: "description new" + + - name: Delete a resource group + register: result + dellemc.powerflex.resource_group: + hostname: "{{ hostname }}" + username: "{{ username }}" + password: "{{ password }}" + validate_certs: "{{ validate_certs }}" + resource_group_name: "{{ resource_group_name_1 }}" + state: "absent" diff --git a/ansible_collections/dellemc/powerflex/plugins/doc_fragments/powerflex.py b/ansible_collections/dellemc/powerflex/plugins/doc_fragments/powerflex.py index 0c0e0d9e1..32b17a4d6 100644 --- a/ansible_collections/dellemc/powerflex/plugins/doc_fragments/powerflex.py +++ b/ansible_collections/dellemc/powerflex/plugins/doc_fragments/powerflex.py @@ -53,7 +53,7 @@ class ModuleDocFragment(object): requirements: - A Dell PowerFlex storage system version 3.6 or later. - Ansible-core 2.14 or later. - - PyPowerFlex 1.9.0. + - PyPowerFlex 1.10.0. - Python 3.9, 3.10 or 3.11. notes: - The modules present in the collection named as 'dellemc.powerflex' diff --git a/ansible_collections/dellemc/powerflex/plugins/module_utils/storage/dell/utils.py b/ansible_collections/dellemc/powerflex/plugins/module_utils/storage/dell/utils.py index 94024d498..e3ba11971 100644 --- a/ansible_collections/dellemc/powerflex/plugins/module_utils/storage/dell/utils.py +++ b/ansible_collections/dellemc/powerflex/plugins/module_utils/storage/dell/utils.py @@ -8,11 +8,14 @@ __metaclass__ = type import logging import math import re +from datetime import datetime from decimal import Decimal from ansible_collections.dellemc.powerflex.plugins.module_utils.storage.dell.logging_handler \ import CustomRotatingFileHandler import traceback from ansible.module_utils.basic import missing_required_lib +import random +import string """import PyPowerFlex lib""" try: @@ -80,10 +83,10 @@ def ensure_required_libs(module): exception=PKG_RSRC_IMP_ERR) if not HAS_POWERFLEX_SDK: - module.fail_json(msg=missing_required_lib("PyPowerFlex V 1.9.0 or above"), + module.fail_json(msg=missing_required_lib("PyPowerFlex V 1.10.0 or above"), exception=POWERFLEX_SDK_IMP_ERR) - min_ver = '1.9.0' + min_ver = '1.10.0' try: curr_version = pkg_resources.require("PyPowerFlex")[0].version supported_version = (parse_version(curr_version) >= parse_version(min_ver)) @@ -193,3 +196,34 @@ def get_time_minutes(time, time_unit): return time else: return 0 + + +def get_display_message(error_text): + match = re.search(r"displayMessage=([^']+)", error_text) + error_message = match.group(1) if match else error_text + return error_message + + +def validate_date(date): + try: + return datetime.strptime(date, '%Y-%m-%dT%H:%M:%S.%f') + except ValueError: + try: + date_obj = datetime.strptime(date, '%Y-%m-%d') + return date_obj.replace(hour=0, minute=0, second=0, microsecond=0) + except ValueError: + return None + + +def get_filter(name, id=None): + filter_type = "id" if id else "name" + filter_value = id or name + filter_query = f"eq,{filter_type},{filter_value}" + return filter_query + + +def random_uuid_generation(): + generate_uuid = ''.join( + [random.choice(string.ascii_lowercase + string.digits) for n in range(32)]) + + return generate_uuid diff --git a/ansible_collections/dellemc/powerflex/plugins/modules/info.py b/ansible_collections/dellemc/powerflex/plugins/modules/info.py index 33f3a8ad8..a114d0c51 100644 --- a/ansible_collections/dellemc/powerflex/plugins/modules/info.py +++ b/ansible_collections/dellemc/powerflex/plugins/modules/info.py @@ -22,7 +22,7 @@ description: getting the api details, list of volumes, SDSs, SDCs, storage pools, protection domains, snapshot policies, and devices. - Gathering information about Dell PowerFlex Manager includes getting the - list of managed devices, deployments and service templates. + list of managed devices, deployments, service templates and firmware repository. extends_documentation_fragment: - dellemc.powerflex.powerflex @@ -31,11 +31,12 @@ author: - Arindam Datta (@dattaarindam) <ansible.team@dell.com> - Trisha Datta (@trisha-dell) <ansible.team@dell.com> - Jennifer John (@Jennifer-John) <ansible.team@dell.com> +- Felix Stephen (@felixs88) <ansible.team@dell.com> options: gather_subset: description: - - List of string variables to specify the Powerflex storage system + - List of string variables to specify the PowerFlex storage system entities for which information is required. - Volumes - C(vol). - Storage pools - C(storage_pool). @@ -50,9 +51,10 @@ options: - Service templates - C(service_template). - Managed devices - C(managed_device). - Deployments - C(deployment). + - FirmwareRepository - C(firmware_repository). choices: [vol, storage_pool, protection_domain, sdc, sds, snapshot_policy, device, rcg, replication_pair, - fault_set, service_template, managed_device, deployment] + fault_set, service_template, managed_device, deployment, firmware_repository] type: list elements: str filters: @@ -71,7 +73,8 @@ options: filter_operator: description: - Operation to be performed on filter key. - - Choice I('contains') is supported for gather_subset keys I(service_template), I(managed_device), I(deployment). + - Choice C(contains) is supported for I(gather_subset) keys C(service_template), C(managed_device), + C(deployment), C(firmware_repository). type: str choices: [equal, contains] required: true @@ -83,60 +86,81 @@ options: limit: description: - Page limit. - - Supported for gather_subset keys I(service_template), I(managed_device), I(deployment). + - Supported for I(gather_subset) keys C(service_template), C(managed_device), C(deployment), C(firmware_repository). type: int default: 50 offset: description: - Pagination offset. - - Supported for gather_subset keys I(service_template), I(managed_device), I(deployment). + - Supported for I(gather_subset) keys C(service_template), C(managed_device), C(deployment), C(firmware_repository). type: int default: 0 sort: description: - Sort the returned components based on specified field. - - Supported for gather_subset keys I(service_template), I(managed_device), I(deployment). - - The supported sort keys for the gather_subset can be referred from PowerFlex Manager API documentation in developer.dell.com. + - Supported for I(gather_subset) keys C(service_template), C(managed_device), C(deployment), C(firmware_repository). + - The supported sort keys for the I(gather_subset) can be referred from PowerFlex Manager API documentation in U(https://developer.dell.com). type: str include_devices: description: - Include devices in response. - - Applicable when gather_subset is I(deployment). + - Applicable when I(gather_subset) is C(deployment). type: bool default: true include_template: description: - Include service templates in response. - - Applicable when gather_subset is I(deployment). + - Applicable when I(gather_subset) is C(deployment). type: bool default: true full: description: - Specify if response is full or brief. - - Applicable when gather_subset is I(deployment), I(service_template). - - For I(deployment) specify to use full templates including resources in response. + - Applicable when I(gather_subset) is C(deployment), C(service_template). + - For C(deployment) specify to use full templates including resources in response. type: bool default: false include_attachments: description: - Include attachments. - - Applicable when gather_subset is I(service_template). + - Applicable when I(gather_subset) is C(service_template). type: bool default: true + include_related: + description: + - Include related entities. + - Applicable when I(gather_subset) is C(firmware_repository). + type: bool + default: false + version_added: 2.3.0 + include_bundles: + description: + - Include software bundle entities. + - Applicable when I(gather_subset) is C(firmware_repository). + type: bool + default: false + version_added: 2.3.0 + include_components: + description: + - Include software component entities. + - Applicable when I(gather_subset) is C(firmware_repository). + type: bool + default: false + version_added: 2.3.0 notes: - The I(check_mode) is supported. - - The supported filter keys for the gather_subset can be referred from PowerFlex Manager API documentation in developer.dell.com. + - The supported filter keys for the I(gather_subset) can be referred from PowerFlex Manager API documentation in U(https://developer.dell.com). - The I(filter), I(sort), I(limit) and I(offset) options will be ignored when more than one I(gather_subset) is specified along with - I(service_template), I(managed_device) or I(deployment). + C(service_template), C(managed_device), C(deployment) or C(firmware_repository). ''' EXAMPLES = r''' - name: Get detailed list of PowerFlex entities dellemc.powerflex.info: - hostname: "{{hostname}}" - username: "{{username}}" - password: "{{password}}" - validate_certs: "{{validate_certs}}" + hostname: "{{ hostname }}" + username: "{{ username }}" + password: "{{ password }}" + validate_certs: "{{ validate_certs }}" gather_subset: - vol - storage_pool @@ -151,10 +175,10 @@ EXAMPLES = r''' - name: Get a subset list of PowerFlex volumes dellemc.powerflex.info: - hostname: "{{hostname}}" - username: "{{username}}" - password: "{{password}}" - validate_certs: "{{validate_certs}}" + hostname: "{{ hostname }}" + username: "{{ username }}" + password: "{{ password }}" + validate_certs: "{{ validate_certs }}" gather_subset: - vol filters: @@ -164,10 +188,10 @@ EXAMPLES = r''' - name: Get deployment and resource provisioning info dellemc.powerflex.info: - hostname: "{{hostname}}" - username: "{{username}}" - password: "{{password}}" - validate_certs: "{{validate_certs}}" + hostname: "{{ hostname }}" + username: "{{ username }}" + password: "{{ password }}" + validate_certs: "{{ validate_certs }}" gather_subset: - managed_device - deployment @@ -175,10 +199,10 @@ EXAMPLES = r''' - name: Get deployment with filter, sort, pagination dellemc.powerflex.info: - hostname: "{{hostname}}" - username: "{{username}}" - password: "{{password}}" - validate_certs: "{{validate_certs}}" + hostname: "{{ hostname }}" + username: "{{ username }}" + password: "{{ password }}" + validate_certs: "{{ validate_certs }}" gather_subset: - deployment filters: @@ -190,6 +214,60 @@ EXAMPLES = r''' offset: 10 include_devices: true include_template: true + +- name: Get the list of firmware repository. + dellemc.powerflex.info: + hostname: "{{ hostname }}" + username: "{{ username }}" + password: "{{ password }}" + validate_certs: "{{ validate_certs }}" + gather_subset: + - firmware_repository + +- name: Get the list of firmware repository + dellemc.powerflex.info: + hostname: "{{ hostname }}" + username: "{{ username }}" + password: "{{ password }}" + validate_certs: "{{ validate_certs }}" + gather_subset: + - firmware_repository + include_related: true + include_bundles: true + include_components: true + +- name: Get the list of firmware repository with filter + dellemc.powerflex.info: + hostname: "{{ hostname }}" + username: "{{ username }}" + password: "{{ password }}" + validate_certs: "{{ validate_certs }}" + gather_subset: + - firmware_repository + filters: + - filter_key: "createdBy" + filter_operator: "equal" + filter_value: "admin" + sort: createdDate + limit: 10 + include_related: true + include_bundles: true + include_components: true + register: result_repository_out + +- name: Get the list of available firmware repository + ansible.builtin.debug: + msg: "{{ result_repository_out.FirmwareRepository | selectattr('state', 'equalto', 'available') }}" + +- name: Get the list of software components in the firmware repository + ansible.builtin.debug: + msg: "{{ result_repository_out.FirmwareRepository | + selectattr('id', 'equalto', '8aaa80788b7') | map(attribute='softwareComponents') | flatten }}" + +- name: Get the list of software bundles in the firmware repository + ansible.builtin.debug: + msg: "{{ result_repository_out.FirmwareRepository | + selectattr('id', 'equalto', '8aaa80788b7') | map(attribute='softwareBundles') | flatten }}" ''' RETURN = r''' @@ -1763,6 +1841,67 @@ ServiceTemplates: ], "blockServiceOperationsMap": {} }] +FirmwareRepository: + description: Details of all firmware repository. + returned: when I(gather_subset) is C(firmware_repository) + type: list + contains: + id: + description: ID of the firmware repository. + type: str + name: + description: Name of the firmware repository. + type: str + sourceLocation: + description: Source location of the firmware repository. + type: str + state: + description: State of the firmware repository. + type: str + softwareComponents: + description: Software components of the firmware repository. + type: list + softwareBundles: + description: Software bundles of the firmware repository. + type: list + deployments: + description: Deployments of the firmware repository. + type: list + sample: [{ + "id": "8aaa03a78de4b2a5018de662818d000b", + "name": "https://192.168.0.1/artifactory/path/pfxmlogs-bvt-pfmp-swo-upgrade-402-to-451-56.tar.gz", + "sourceLocation": "https://192.168.0.2/artifactory/path/pfxmlogs-bvt-pfmp-swo-upgrade-402-to-451-56.tar.gz", + "sourceType": null, + "diskLocation": "", + "filename": "", + "md5Hash": null, + "username": "", + "password": "", + "downloadStatus": "error", + "createdDate": "2024-02-26T17:07:11.884+00:00", + "createdBy": "admin", + "updatedDate": "2024-03-01T06:21:10.917+00:00", + "updatedBy": "system", + "defaultCatalog": false, + "embedded": false, + "state": "errors", + "softwareComponents": [], + "softwareBundles": [], + "deployments": [], + "bundleCount": 0, + "componentCount": 0, + "userBundleCount": 0, + "minimal": true, + "downloadProgress": 100, + "extractProgress": 0, + "fileSizeInGigabytes": 0.0, + "signedKeySourceLocation": null, + "signature": "Unknown", + "custom": false, + "needsAttention": false, + "jobId": "Job-10d75a23-d801-4fdb-a2d0-7f6389ab75cf", + "rcmapproved": false + }] ''' from ansible.module_utils.basic import AnsibleModule @@ -2126,6 +2265,25 @@ class PowerFlexInfo(object): msg = f'Get deployments from PowerFlex Manager failed with error {str(e)}' return self.handle_error_exit(msg) + def get_pagination_params(self): + """ Get the pagination parameters """ + return {'limit': self.get_param_value('limit'), 'offset': self.get_param_value('offset'), + 'sort': self.get_param_value('sort'), 'filters': self.populate_filter_list()} + + def get_firmware_repository_list(self): + """ Get the list of firmware repository on a given PowerFlex Manager system """ + try: + LOG.info('Getting firmware repository list ') + firmware_repository = self.powerflex_conn.firmware_repository.get( + **self.get_pagination_params(), + related=self.get_param_value('include_related'), + bundles=self.get_param_value('include_bundles'), + components=self.get_param_value('include_components')) + return firmware_repository + except Exception as e: + msg = f'Get firmware repository from PowerFlex Manager failed with error {str(e)}' + return self.handle_error_exit(msg) + def get_service_templates_list(self): """ Get the list of service templates on a given PowerFlex Manager system """ try: @@ -2246,6 +2404,7 @@ class PowerFlexInfo(object): service_template = [] managed_device = [] deployment = [] + firmware_repository = [] subset = self.module.params['gather_subset'] self.validate_subset(api_version, subset) @@ -2276,6 +2435,8 @@ class PowerFlexInfo(object): service_template = self.get_service_templates_list() if 'deployment' in subset: deployment = self.get_deployments_list() + if 'firmware_repository' in subset: + firmware_repository = self.get_firmware_repository_list() self.module.exit_json( Array_Details=array_details, @@ -2292,7 +2453,8 @@ class PowerFlexInfo(object): Fault_Sets=fault_sets, ManagedDevices=managed_device, ServiceTemplates=service_template, - Deployments=deployment + Deployments=deployment, + FirmwareRepository=firmware_repository ) @@ -2319,7 +2481,7 @@ def get_powerflex_info_parameters(): choices=['vol', 'storage_pool', 'protection_domain', 'sdc', 'sds', 'snapshot_policy', 'device', 'rcg', 'replication_pair', 'fault_set', - 'service_template', 'managed_device', 'deployment']), + 'service_template', 'managed_device', 'deployment', 'firmware_repository']), filters=dict(type='list', required=False, elements='dict', options=dict(filter_key=dict(type='str', required=True, no_log=False), filter_operator=dict( @@ -2333,7 +2495,10 @@ def get_powerflex_info_parameters(): include_devices=dict(type='bool', default=True), include_template=dict(type='bool', default=True), full=dict(type='bool', default=False), - include_attachments=dict(type='bool', default=True) + include_attachments=dict(type='bool', default=True), + include_related=dict(type='bool', default=False), + include_bundles=dict(type='bool', default=False), + include_components=dict(type='bool', default=False), ) diff --git a/ansible_collections/dellemc/powerflex/plugins/modules/resource_group.py b/ansible_collections/dellemc/powerflex/plugins/modules/resource_group.py new file mode 100644 index 000000000..768d0c973 --- /dev/null +++ b/ansible_collections/dellemc/powerflex/plugins/modules/resource_group.py @@ -0,0 +1,631 @@ +#!/usr/bin/python + +# Copyright: (c) 2024, Dell Technologies +# Apache License version 2.0 (see MODULE-LICENSE or http://www.apache.org/licenses/LICENSE-2.0.txt) + +""" Ansible module for managing resource group deployments on Dell Technologies (Dell) PowerFlex""" +from __future__ import (absolute_import, division, print_function) + +__metaclass__ = type + +DOCUMENTATION = r''' +module: resource_group +version_added: '2.3.0' +short_description: Manage resource group deployments on Dell PowerFlex. +description: +- Managing resource group deployments on PowerFlex storage system includes deploying, + editing, adding nodes and deleting a resource group deployment. +author: +- Jennifer John (@johnj9) <ansible.team@dell.com> +- Trisha Datta (@trisha-dell) <ansible.team@dell.com> +extends_documentation_fragment: + - dellemc.powerflex.powerflex +options: + resource_group_name: + description: + - The name of the resource group. + - This is a required field to deploy a resource group. + - Either I(resource_group_id) or I(resource_group_name) must be specified to perform resource group operations. + - Mutually exclusive with I(resource_group_id). + type: str + resource_group_id: + description: + - The ID of the resource group. + - Either I(resource_group_id) or I(resource_group_name) must be specified to perform resource group operations. + - Mutually exclusive with I(resource_group_name). + type: str + template_name: + description: + - The name of the published template. + - Either I(template_id) or I(template_name) must be specified to deploy a resource group. + - Mutually exclusive with I(template_id). + type: str + template_id: + description: + - The ID of the published template. + - Either I(template_id) or I(template_name) must be specified to deploy a resource group. + - Mutually exclusive with I(template_name). + type: str + firmware_repository_id: + description: + - The ID of the firmware repository if not using the appliance default catalog. + - Mutually exclusive with I(firmware_repository_name). + type: str + firmware_repository_name: + description: + - The name of the firmware repository if not using the appliance default catalog. + - Mutually exclusive with I(firmware_repository_id). + type: str + new_resource_group_name: + description: + - New name of the resource group to rename to. + type: str + description: + description: + - The description of the resource group. + type: str + scaleup: + description: + - Whether to scale up the resource group. Specify as true to add nodes to the resource group. + type: bool + default: false + clone_node: + description: + - Resource to duplicate during scaleup, if more than one nodes are available in the resource group. + type: str + node_count: + description: + - Number of nodes to clone during scaleup. + type: int + default: 1 + validate: + description: + - Specify as true to validate the deployment of resource group. + type: bool + default: false + schedule_date: + description: + - Scheduled date for the resource group deployment. + - Specify in YYYY-MM-DD HH:MM:SS.sss or YYYY-MM-DD format. + type: str + state: + description: + - The state of the resource group. + type: str + choices: ['absent', 'present'] + default: 'present' +notes: +- The I(check_mode) is supported. +- Resource group scale up can be done only when deployment is complete. +''' + +EXAMPLES = r''' +- name: Validate deployment of a resource group + dellemc.powerflex.resource_group: + hostname: "{{ hostname }}" + username: "{{ username }}" + password: "{{ password }}" + validate_certs: "{{ validate_certs }}" + port: "{{ port }}" + resource_group_name: "{{ resource_group_name_1 }}" + description: ans_rg + template_id: c65d0172-8666-48ab-935e-9a0bf69ed66d + firmware_repository_id: 8aaa80788b5755d1018b576126d51ba3 + validate: true + +- name: Deploy a resource group + dellemc.powerflex.resource_group: + hostname: "{{ hostname }}" + username: "{{ username }}" + password: "{{ password }}" + validate_certs: "{{ validate_certs }}" + port: "{{ port }}" + resource_group_name: "{{ resource_group_name_1 }}" + description: ans_rg + template_id: c65d0172-8666-48ab-935e-9a0bf69ed66d + firmware_repository_id: 8aaa80788b5755d1018b576126d51ba3 + +- name: Add a node to a resource group + dellemc.powerflex.resource_group: + hostname: "{{ hostname }}" + username: "{{ username }}" + password: "{{ password }}" + validate_certs: "{{ validate_certs }}" + resource_group_name: "{{ resource_group_name_1 }}" + scaleup: true + clone_node: "{{ node_1 }}" + node_count: "{{ node_count }}" + +- name: Modify a resource group + dellemc.powerflex.resource_group: + hostname: "{{ hostname }}" + username: "{{ username }}" + password: "{{ password }}" + validate_certs: "{{ validate_certs }}" + resource_group_name: "{{ resource_group_name_1 }}" + new_resource_group_name: "{{ new_resource_group_name }}" + description: "description new" + +- name: Delete a resource group + dellemc.powerflex.resource_group: + hostname: "{{ hostname }}" + username: "{{ username }}" + password: "{{ password }}" + validate_certs: "{{ validate_certs }}" + port: "{{ port }}" + resource_group_name: ans_rg + state: "absent" +''' + +RETURN = r''' +changed: + description: Whether or not the resource has changed. + returned: always + type: bool + sample: 'false' +resource_group_details: + description: Details of the resource group deployment. + returned: When resource group exists. + type: dict + contains: + id: + description: The ID of the deployed resource group. + type: str + deploymentName: + description: The name of the resource group deployment. + type: str + deploymentDescription: + description: The description of the resource group deployment. + type: str + serviceTemplate: + description: The service template of the resource group. + type: dict + contains: + id: + description: The ID of the service template. + type: str + templateName: + description: The name of the service template. + type: str + status: + description: The status of the deployment of the resource group. + type: str + firmwareRepositoryId: + description: The ID of the firmware repository of the resource group. + type: str + sample: { + "id": "8aaa03a88de961fa018de96a88d80008", + "deploymentName": "dep-ans-test-rg1", + "deploymentDescription": "ans test rg", + "retry": true, + "teardown": false, + "serviceTemplate": { + "id": "8aaa03a88de961fa018de96a88d80008", + "templateName": "update-template (8aaa03a88de961fa018de96a88d80008)" + }, + "scheduleDate": null, + "status": "error", + "compliant": true, + "deploymentDevice": [ + { + "refId": "scaleio-block-legacy-gateway", + "refType": "SCALEIO", + "deviceHealth": "GREEN", + "compliantState": "COMPLIANT", + "deviceType": "scaleio", + "currentIpAddress": "1.3.9.2", + "componentId": "910bf934-d45a-4fe3-8ea2-dc481e063a81", + "statusMessage": "The processing of PowerFlex is unsuccessful.", + "model": "PowerFlex Gateway", + "brownfield": false + } + ], + "updateServerFirmware": true, + "useDefaultCatalog": true, + "firmwareRepository": { + "id": "8aaa80788b5755d1018b576126d51ba3", + "name": "PowerFlex 4.5.0.0", + "rcmapproved": false + }, + "firmwareRepositoryId": "8aaa80788b5755d1018b576126d51ba3", + "deploymentHealthStatusType": "red", + "allUsersAllowed": false, + "owner": "admin", + "numberOfDeployments": 0, + "lifecycleMode": false, + "vds": false, + "scaleUp": false, + "brownfield": false, + "templateValid": true, + "configurationChange": false + } +''' + + +from ansible.module_utils.basic import AnsibleModule +from ansible_collections.dellemc.powerflex.plugins.module_utils.storage.dell \ + import utils +import json +import copy + +LOG = utils.get_logger('resource_group') + + +class PowerFlexResourceGroup: + def __init__(self): + """ Define all parameters required by this module""" + self.module_params = utils.get_powerflex_gateway_host_parameters() + self.module_params.update(get_powerflex_resource_group_parameters()) + mut_ex_args = [['resource_group_name', 'resource_group_id'], + ['template_name', 'template_id'], + ['firmware_repository_id', 'firmware_repository_name']] + + required_one_of_args = [['resource_group_name', 'resource_group_id']] + + # initialize the Ansible module + self.module = AnsibleModule( + argument_spec=self.module_params, + mutually_exclusive=mut_ex_args, + required_one_of=required_one_of_args, + supports_check_mode=True) + + utils.ensure_required_libs(self.module) + + try: + self.powerflex_conn = utils.get_powerflex_gateway_host_connection( + self.module.params) + LOG.info("Got the PowerFlex system connection object instance") + except Exception as e: + LOG.error(str(e)) + self.module.fail_json(msg=str(e)) + + def get_service_template(self, template_id=None, template_name=None, for_deployment=True): + """ + Retrieves a service template based on the provided parameters. + + Args: + template_id (str, optional): The ID of the service template. Defaults to None. + template_name (str, optional): The name of the service template. Defaults to None. + for_deployment (bool, optional): Indicates whether the template is for deployment. Defaults to True. + + Returns: + ServiceTemplate: The retrieved service template. + + Raises: + AnsibleFailJson: If either `template_id` or `template_name` is not specified for resource group deployment. + AnsibleFailJson: If the service template with the specified `template_name` is not found. + AnsibleFailJson: If the service template with the specified `template_id` is not found. + """ + if not (template_id or template_name): + self.module.fail_json(msg="Either template_id or template_name must be specified for resource group deployment") + if template_name: + filter_query = utils.get_filter(template_name) + template = self.powerflex_conn.service_template.get(filters=[filter_query]) + if not template: + error_msg = f"Service template {template_name} is not found" + self.module.fail_json(msg=error_msg) + + template_id = template_id or template[0]['id'] + return self.powerflex_conn.service_template.get_by_id(template_id, for_deployment) + + def get_firmware_repo(self, firmware_repo_id=None, firmware_repo_name=None): + """ + Retrieves the firmware repository ID based on the provided firmware repository name or ID. + + Args: + firmware_repo_id (str, optional): The ID of the firmware repository. Defaults to None. + firmware_repo_name (str, optional): The name of the firmware repository. Defaults to None. + + Returns: + str: The ID of the firmware repository. + + Raises: + ValueError: If the firmware repository is not found. + """ + firmware_repos = self.powerflex_conn.firmware_repository.get() + if firmware_repo_id: + firmware_repo = next((repo for repo in firmware_repos if repo.get('id') == firmware_repo_id), None) + else: + firmware_repo = next((repo for repo in firmware_repos if repo.get('name') == firmware_repo_name), None) + if not firmware_repo: + self.module.fail_json(msg=f"Firmware repository {firmware_repo_id or firmware_repo_name} is not found") + return firmware_repo['id'] + + def get_resource_group_name(self): + """ Retrieves the name of the resource group. """ + resource_group_name = self.module.params['resource_group_name'] + if not resource_group_name: + self.module.fail_json(msg="Specify resource_group_name for resource group deployment.") + return resource_group_name + + def is_modify_needed(self, deployment_data): + + modify_dict = False + if self.module.params["new_resource_group_name"] is not None and \ + deployment_data["deploymentName"] != self.module.params["new_resource_group_name"]: + modify_dict = True + if self.module.params["description"] is not None and \ + deployment_data["deploymentDescription"] != self.module.params["description"]: + modify_dict = True + if self.module.params["scaleup"]: + modify_dict = True + + return modify_dict + + def clone_component(self, deploy_data): + new_component = None + count_server = 0 + server_name = [] + for component in range(len(deploy_data["serviceTemplate"]["components"])): + if deploy_data["serviceTemplate"]["components"][component]["type"] == "SERVER": + count_server = count_server + 1 + server_name.append(deploy_data["serviceTemplate"]["components"][component]["name"]) + for component in range(len(deploy_data["serviceTemplate"]["components"])): + if self.module.params["clone_node"] is None: + if count_server == 1 and deploy_data["serviceTemplate"]["components"][component]["name"] == server_name[0]: + new_component = deploy_data["serviceTemplate"]["components"][component] + elif count_server != 1: + self.module.fail_json(msg="More than 1 server components exist. Provide the clone_node.") + else: + if deploy_data["serviceTemplate"]["components"][component]["name"] == self.module.params["clone_node"]: + new_component = deploy_data["serviceTemplate"]["components"][component] + + return new_component + + def prepare_add_node_payload(self, deploy_data): + + new_component = self.clone_component(deploy_data=deploy_data) + if new_component is not None: + uuid = utils.random_uuid_generation() + new_component.update({ + "identifier": None, + "asmGUID": None, + "puppetCertName": None, + "osPuppetCertName": None, + "managementIpAddress": None, + "brownfield": False, + "id": uuid, + "name": uuid}) + resource_params = ["razor_image", "scaleio_enabled", "scaleio_role", + "compression_enabled", "replication_enabled"] + + for resource in range(len(new_component["resources"])): + if new_component["resources"][resource]["id"] == "asm::server": + for param in range(len(new_component["resources"][resource]["parameters"])): + if new_component["resources"][resource]["parameters"][param]["id"] \ + not in resource_params: + new_component["resources"][resource]["parameters"][param]["guid"] = None + new_component["resources"][resource]["parameters"][param]["value"] = None + return new_component + + def modify_resource_group_details(self, deployment_data): + new_deployment_data = copy.deepcopy(deployment_data) + + # edit resource group + + if self.module.params["new_resource_group_name"]: + new_deployment_data["deploymentName"] = self.module.params["new_resource_group_name"] + if self.module.params["description"]: + new_deployment_data["deploymentDescription"] = self.module.params["description"] + + # Add nodes + + if self.module.params["scaleup"]: + new_deployment_data["scaleup"] = True + new_deployment_data["retry"] = True + node = 0 + while node < self.module.params["node_count"]: + new_deployment_data1 = copy.deepcopy(deployment_data) + new_component = self.prepare_add_node_payload(deploy_data=new_deployment_data1) + if new_component: + new_deployment_data["serviceTemplate"]["components"].append(new_component) + node = node + 1 + + try: + if not self.module.check_mode: + self.powerflex_conn.deployment.edit(deployment_id=deployment_data["id"], + rg_data=new_deployment_data) + + except Exception as e: + errmsg = f'Modifying a resource group deployment failed with error {utils.get_display_message(str(e))}' + self.module.fail_json(msg=errmsg) + + def get_deployment_data(self): + """ + Retrieves deployment data based on the provided parameters. + + :return: A JSON string representing the deployment data. + """ + template_id = self.module.params['template_id'] + template_name = self.module.params['template_name'] + resource_group_name = self.get_resource_group_name() + description = self.module.params['description'] + firmware_repo_id = self.module.params['firmware_repository_id'] + firmware_repo_name = self.module.params['firmware_repository_name'] + schedule_date = self.module.params['schedule_date'] + service_template = self.get_service_template(template_id, template_name, for_deployment=True) + deployment_data = { + "deploymentName": resource_group_name, + "deploymentDescription": description, + "serviceTemplate": service_template, + "updateServerFirmware": True, + "useDefaultCatalog": True + } + + if firmware_repo_id or firmware_repo_name: + firmware_repository_id = self.get_firmware_repo(firmware_repo_id, firmware_repo_name) + deployment_data["firmwareRepositoryId"] = firmware_repository_id + deployment_data["useDefaultCatalog"] = False + if schedule_date: + if not utils.validate_date(schedule_date): + self.module.fail_json(msg="Invalid schedule_date format. Specify the date in the format 'YYYY-MM-DDTHH:MM:SS.sss'") + deployment_data["scheduleDate"] = schedule_date + + return json.dumps(deployment_data) + + def get_deployment_details(self, deployment_name=None, deployment_id=None): + """ + Retrieves deployment details based on the provided deployment name or deployment ID. + + Args: + deployment_name (str, optional): The name of the deployment. Defaults to None. + deployment_id (str, optional): The ID of the deployment. Defaults to None. + + Returns: + list: A list of deployment details if the deployment name is provided and a matching deployment is found. + None: if the deployment ID is provided and no deployment is found with that ID. + """ + try: + if deployment_name: + filter_query = utils.get_filter(deployment_name) + resp = self.powerflex_conn.deployment.get(filters=[filter_query]) + if len(resp) > 0: + deployment_id = resp[0]["id"] + else: + return None + return self.powerflex_conn.deployment.get_by_id(deployment_id) + + except Exception as e: + if hasattr(e, 'status') and str(e.status) == '404': + return None + else: + self.module.fail_json(msg=utils.get_display_message(str(e))) + + def get_operation_mapping(self): + """ + Get the operation mapping based on the deployment details and module parameters. + + :return: The operation mapping for the given state, validate, and check_mode. + """ + if not self.deployment_details: + operation_mapping = { + ('present', True, True): ValidateDeploy, + ('present', True, False): ValidateDeploy, + ('present', False, True): ValidateDeploy, + ('present', False, False): Deploy + } + else: + operation_mapping = { + ('absent', True, True): DeleteDeploy, + ('absent', True, False): DeleteDeploy, + ('absent', False, True): DeleteDeploy, + ('absent', False, False): DeleteDeploy, + ('present', True, True): ModifyResourceGroup, + ('present', True, False): ModifyResourceGroup, + ('present', False, True): ModifyResourceGroup, + ('present', False, False): ModifyResourceGroup + } + + state = self.module.params['state'] + validate = self.module.params['validate'] + check_mode = self.module.check_mode + + return operation_mapping.get((state, validate, check_mode)) + + def perform_module_operation(self): + """ + Perform the module operation. + + :return: A dictionary containing the result of the module operation. + """ + result = dict( + changed=False, + resource_group_details=[] + ) + + self.deployment_details = self.get_deployment_details( + deployment_name=self.module.params['resource_group_name'], + deployment_id=self.module.params['resource_group_id']) + resource_group_operation = self.get_operation_mapping() + if resource_group_operation: + changed, resource_group_details = resource_group_operation.execute(self) + result['resource_group_details'] = resource_group_details + result['changed'] = changed + + self.module.exit_json(**result) + + +class Deploy: + def execute(self): + try: + rg_data = self.get_deployment_data() + response = self.powerflex_conn.deployment.create(rg_data) + return True, response + except Exception as e: + errmsg = f'Deploying a resource group failed with error {utils.get_display_message(str(e))}' + self.module.fail_json(msg=errmsg) + + +class ValidateDeploy: + def execute(self): + try: + rg_data = self.get_deployment_data() + response = self.powerflex_conn.deployment.validate(rg_data) + return False, response + except Exception as e: + errmsg = f'Validating a resource group deployment failed with error {utils.get_display_message(str(e))}' + self.module.fail_json(msg=errmsg) + + +class ModifyResourceGroup: + def execute(self): + try: + changed = False + rg_data = self.deployment_details + if self.is_modify_needed(deployment_data=rg_data): + self.modify_resource_group_details(deployment_data=rg_data) + changed = True + + response = self.get_deployment_details(deployment_id=rg_data['id']) + return changed, response + except Exception as e: + errmsg = f'Editing a resource group failed with error {utils.get_display_message(str(e))}' + self.module.fail_json(msg=errmsg) + + +class DeleteDeploy: + def execute(self): + try: + changed = False + if self.deployment_details: + if not self.module.check_mode: + self.powerflex_conn.deployment.delete(self.deployment_details['id']) + self.deployment_details = \ + self.get_deployment_details(deployment_name=self.deployment_details['deploymentName']) + changed = True + return changed, self.deployment_details + except Exception as e: + errmsg = f'Deleting a resource group deployment failed with error {utils.get_display_message(str(e))}' + self.module.fail_json(msg=errmsg) + + +def main(): + """ Create PowerFlex resource group object and perform actions on it + based on user input from playbook""" + obj = PowerFlexResourceGroup() + obj.perform_module_operation() + + +def get_powerflex_resource_group_parameters(): + """This method provides parameters required for the resource group + module on PowerFlex""" + return dict( + resource_group_name=dict(), + resource_group_id=dict(), + template_name=dict(), + template_id=dict(), + firmware_repository_id=dict(), + firmware_repository_name=dict(), + new_resource_group_name=dict(), + description=dict(), + scaleup=dict(type='bool', default=False), + clone_node=dict(), + node_count=dict(type='int', default=1), + validate=dict(type='bool', default=False), + schedule_date=dict(), + state=dict(choices=['present', 'absent'], default='present') + ) + + +if __name__ == '__main__': + main() diff --git a/ansible_collections/dellemc/powerflex/tests/sanity/ignore-2.14.txt b/ansible_collections/dellemc/powerflex/tests/sanity/ignore-2.14.txt index cb6ef4675..571402121 100644 --- a/ansible_collections/dellemc/powerflex/tests/sanity/ignore-2.14.txt +++ b/ansible_collections/dellemc/powerflex/tests/sanity/ignore-2.14.txt @@ -40,3 +40,6 @@ plugins/modules/replication_consistency_group.py import-2.7 plugins/modules/replication_consistency_group.py import-3.5 plugins/modules/replication_consistency_group.py compile-2.7 plugins/modules/replication_consistency_group.py compile-3.5 +plugins/modules/resource_group.py validate-modules:missing-gplv3-license +plugins/modules/resource_group.py compile-2.7 +plugins/modules/resource_group.py import-2.7 diff --git a/ansible_collections/dellemc/powerflex/tests/sanity/ignore-2.15.txt b/ansible_collections/dellemc/powerflex/tests/sanity/ignore-2.15.txt index cb6ef4675..571402121 100644 --- a/ansible_collections/dellemc/powerflex/tests/sanity/ignore-2.15.txt +++ b/ansible_collections/dellemc/powerflex/tests/sanity/ignore-2.15.txt @@ -40,3 +40,6 @@ plugins/modules/replication_consistency_group.py import-2.7 plugins/modules/replication_consistency_group.py import-3.5 plugins/modules/replication_consistency_group.py compile-2.7 plugins/modules/replication_consistency_group.py compile-3.5 +plugins/modules/resource_group.py validate-modules:missing-gplv3-license +plugins/modules/resource_group.py compile-2.7 +plugins/modules/resource_group.py import-2.7 diff --git a/ansible_collections/dellemc/powerflex/tests/sanity/ignore-2.16.txt b/ansible_collections/dellemc/powerflex/tests/sanity/ignore-2.16.txt index 531796f6c..0dbde689c 100644 --- a/ansible_collections/dellemc/powerflex/tests/sanity/ignore-2.16.txt +++ b/ansible_collections/dellemc/powerflex/tests/sanity/ignore-2.16.txt @@ -26,3 +26,6 @@ plugins/modules/replication_consistency_group.py import-2.7 plugins/modules/replication_consistency_group.py compile-2.7 plugins/modules/info.py compile-2.7 plugins/modules/info.py import-2.7 +plugins/modules/resource_group.py validate-modules:missing-gplv3-license +plugins/modules/resource_group.py compile-2.7 +plugins/modules/resource_group.py import-2.7 diff --git a/ansible_collections/dellemc/powerflex/tests/sanity/ignore-2.17.txt b/ansible_collections/dellemc/powerflex/tests/sanity/ignore-2.17.txt index 54067647b..a464e7b26 100644 --- a/ansible_collections/dellemc/powerflex/tests/sanity/ignore-2.17.txt +++ b/ansible_collections/dellemc/powerflex/tests/sanity/ignore-2.17.txt @@ -11,3 +11,4 @@ plugins/modules/replication_consistency_group.py validate-modules:missing-gplv3- plugins/modules/replication_pair.py validate-modules:missing-gplv3-license plugins/modules/snapshot_policy.py validate-modules:missing-gplv3-license plugins/modules/fault_set.py validate-modules:missing-gplv3-license +plugins/modules/resource_group.py validate-modules:missing-gplv3-license diff --git a/ansible_collections/dellemc/powerflex/tests/unit/plugins/module_utils/mock_info_api.py b/ansible_collections/dellemc/powerflex/tests/unit/plugins/module_utils/mock_info_api.py index 20de1c1c9..2682cbdd5 100644 --- a/ansible_collections/dellemc/powerflex/tests/unit/plugins/module_utils/mock_info_api.py +++ b/ansible_collections/dellemc/powerflex/tests/unit/plugins/module_utils/mock_info_api.py @@ -319,7 +319,8 @@ class MockInfoApi: 'system_exception': "Get array details from Powerflex array failed with error", 'managed_device_get_error': "Get managed devices from PowerFlex Manager failed with error", 'service_template_get_error': "Get service templates from PowerFlex Manager failed with error", - 'deployment_get_error': "Get deployments from PowerFlex Manager failed with error" + 'deployment_get_error': "Get deployments from PowerFlex Manager failed with error", + 'firmware_repository_get_error': "Get firmware repository from PowerFlex Manager failed with error" } @staticmethod diff --git a/ansible_collections/dellemc/powerflex/tests/unit/plugins/module_utils/mock_resource_group_api.py b/ansible_collections/dellemc/powerflex/tests/unit/plugins/module_utils/mock_resource_group_api.py new file mode 100644 index 000000000..228443449 --- /dev/null +++ b/ansible_collections/dellemc/powerflex/tests/unit/plugins/module_utils/mock_resource_group_api.py @@ -0,0 +1,162 @@ +# Copyright: (c) 2024, Dell Technologies + +# Apache License version 2.0 (see MODULE-LICENSE or http://www.apache.org/licenses/LICENSE-2.0.txt) + +"""Mock ApiException for Dell Technologies (Dell) PowerFlex Test modules""" + +from __future__ import (absolute_import, division, print_function) + +__metaclass__ = type + + +class MockResourceResourceGroupAPI: + + RG_COMMON_ARGS = { + "hostname": "**.***.**.***", + "username": "username", + "password": "password", + "validate_certs": False, + "port": "443", + "validate": False, + "template_name": None, + "template_id": None, + "firmware_repository_name": None, + "firmware_repository_id": None, + "resource_group_name": None, + "resource_group_id": None, + "schedule_date": None + } + + RG_RESPONSE = [{ + "id": "8aaa03a88de961fa018de96a88d80008", + "deploymentName": "ans_rg", + "deploymentDescription": "ans test rg", + "retry": True, + "teardown": False, + "serviceTemplate": { + "id": "8aaa03a88de961fa018de96a88d80008", + "templateName": "update-template (8aaa03a88de961fa018de96a88d80008)", + "components": [ + { + "id": "a7dafed9-96f2-4a55-9518-57af4f45686e", + "componentID": "component-scaleio-gateway-1", + "identifier": None, + "componentValid": { + "valid": True, + "messages": [] + }, + "puppetCertName": "scaleio-block-legacy-gateway", + "osPuppetCertName": None, + "name": "block-legacy-gateway", + "type": "SERVER", + "subType": "COMPUTEONLY", + "teardown": False, + "helpText": None, + "managementIpAddress": None, + "configFile": None, + "serialNumber": None, + "asmGUID": "scaleio-block-legacy-gateway", + "relatedComponents": { + "fc0f8f08-18c7-4fa8-bae8-67f3e6f9ccd6": "Node (Software Only)" + }, + "resources": [{ + "id": "asm::server", + "parameters": [{ + "id": "a7dafed9", + "guid": None, + "value": None}]}], + "refId": None, + "cloned": False, + "clonedFromId": None, + "manageFirmware": False, + "brownfield": False, + "instances": 1, + "clonedFromAsmGuid": None, + "ip": None + }] + }, + "scheduleDate": None, + "status": "error", + "compliant": True, + "deploymentDevice": [{ + "refId": "scaleio-block-legacy-gateway", + "refType": "SCALEIO", + "deviceHealth": "GREEN", + "compliantState": "COMPLIANT", + "deviceType": "scaleio", + "currentIpAddress": "1.3.9.2", + "componentId": "910bf934-d45a-4fe3-8ea2-dc481e063a81", + "statusMessage": "The processing of PowerFlex is unsuccessful.", + "model": "PowerFlex Gateway", + "brownfield": False}], + "updateServerFirmware": True, + "useDefaultCatalog": True, + "firmwareRepository": { + "id": "8aaa80788b5755d1018b576126d51ba3", + "name": "PowerFlex 4.5.0.0", + "rcmapproved": False}, + "firmwareRepositoryId": "8aaa80788b5755d1018b576126d51ba3", + "deploymentHealthStatusType": "red", + "allUsersAllowed": False, + "owner": "admin", + "numberOfDeployments": 0, + "lifecycleMode": False, + "vds": False, + "scaleUp": False, + "brownfield": False, + "templateValid": True, + "configurationChange": False}] + + RG_FIRMWARE_REPO = [{ + "id": "8aaa80788b5755d1018b576126d51ba3", + "name": "firmware-name", + "sourceLocation": "https://100.65.27.72/artifactory/path/pfxmlogs-bvt-pfmp-swo-upgrade-402-to-451-56.tar.gz", + "sourceType": None, + "diskLocation": "", + "filename": "", + "md5Hash": None, + "username": "", + "password": "", + "downloadStatus": "error", + "createdDate": "2024-02-26T17:07:11.884+00:00", + "createdBy": "admin", + "updatedDate": "2024-03-01T06:21:10.917+00:00", + "updatedBy": "system", + "defaultCatalog": False, + "embedded": False, + "state": "errors", + "softwareComponents": [], + "softwareBundles": [], + "deployments": [], + "bundleCount": 0, + "componentCount": 0, + "userBundleCount": 0, + "minimal": True, + "downloadProgress": 100, + "extractProgress": 0, + "fileSizeInGigabytes": 0.0, + "signedKeySourceLocation": None, + "signature": "Unknown", + "custom": False, + "needsAttention": False, + "jobId": "Job-10d75a23-d801-4fdb-a2d0-7f6389ab75cf", + "rcmapproved": False + }] + + RG_TEMPLATE_RESPONSE = [{ + "id": "8aaa03a88de961fa018de96a88d80008", + "templateName": "update-template" + }] + + @staticmethod + def resource_group_error(response_type): + return { + "get_delete_deploy_exception": "Deleting a resource group deployment failed with error ", + "get_validate_deploy_exception": "Validating a resource group deployment failed with error", + "get_create_deploy_exception": "Deploying a resource group failed with error", + "get_template_validate_error": "Deploying a resource group failed with error Either template_id", + "get_template_error": "Service template new-template is not found", + "invalid_date_format": "Deploying a resource group failed with error Invalid schedule_date format", + "resource_group_name_error": "Specify resource_group_name for resource group deployment", + "resource_group_edit_error": "Editing a resource group failed with error", + }[response_type] diff --git a/ansible_collections/dellemc/powerflex/tests/unit/plugins/modules/test_info.py b/ansible_collections/dellemc/powerflex/tests/unit/plugins/modules/test_info.py index ce5091212..043fcd566 100644 --- a/ansible_collections/dellemc/powerflex/tests/unit/plugins/modules/test_info.py +++ b/ansible_collections/dellemc/powerflex/tests/unit/plugins/modules/test_info.py @@ -604,3 +604,24 @@ class TestPowerflexInfo(): info_module_mock.perform_module_operation() assert info_module_mock.get_param_value('limit') is None assert info_module_mock.get_param_value('offset') is None + + def test_get_firmware_repository_details(self, info_module_mock): + self.get_module_args.update({ + "gather_subset": ['firmware_repository'], + "limit": 20 + }) + info_module_mock.module.params = self.get_module_args + info_module_mock.powerflex_conn.firmware_repository.get = MagicMock() + info_module_mock.perform_module_operation() + info_module_mock.powerflex_conn.firmware_repository.get.assert_called() + + def test_get_deployment_details_throws_exception(self, info_module_mock): + self.get_module_args.update({ + "gather_subset": ['firmware_repository'] + }) + info_module_mock.module.params = self.get_module_args + info_module_mock.powerflex_conn.firmware_repository.get = MagicMock( + side_effect=MockApiException + ) + self.capture_fail_json_call(MockInfoApi.get_exception_response( + 'firmware_repository_get_error'), info_module_mock) diff --git a/ansible_collections/dellemc/powerflex/tests/unit/plugins/modules/test_resource_group.py b/ansible_collections/dellemc/powerflex/tests/unit/plugins/modules/test_resource_group.py new file mode 100644 index 000000000..1bf57f083 --- /dev/null +++ b/ansible_collections/dellemc/powerflex/tests/unit/plugins/modules/test_resource_group.py @@ -0,0 +1,228 @@ +# Copyright: (c) 2024, Dell Technologies + +# Apache License version 2.0 (see MODULE-LICENSE or http://www.apache.org/licenses/LICENSE-2.0.txt) + +"""Unit Tests for Resource Group module on Dell Technologies (Dell) PowerFlex""" + +from __future__ import (absolute_import, division, print_function) + +__metaclass__ = type +import pytest +# pylint: disable=unused-import +from ansible_collections.dellemc.powerflex.tests.unit.plugins.module_utils.libraries import initial_mock +from mock.mock import MagicMock +from ansible_collections.dellemc.powerflex.tests.unit.plugins.module_utils.mock_api_exception \ + import MockApiException +from ansible_collections.dellemc.powerflex.tests.unit.plugins.module_utils.mock_resource_group_api \ + import MockResourceResourceGroupAPI +from ansible_collections.dellemc.powerflex.tests.unit.plugins.module_utils.libraries.powerflex_unit_base \ + import PowerFlexUnitBase +from ansible_collections.dellemc.powerflex.plugins.modules.resource_group \ + import PowerFlexResourceGroup + + +class TestResourceGroup(PowerFlexUnitBase): + + get_module_args = MockResourceResourceGroupAPI.RG_COMMON_ARGS + + @pytest.fixture + def module_object(self): + return PowerFlexResourceGroup + + def test_delete_deploy_check_mode(self, powerflex_module_mock): + self.set_module_params(powerflex_module_mock, self.get_module_args, + {"resource_group_name": "ans_rg", "state": "absent", "validate": True}) + powerflex_module_mock.module.check_mode = True + powerflex_module_mock.powerflex_conn.deployment.get = MagicMock( + return_value=MockResourceResourceGroupAPI.RG_RESPONSE) + powerflex_module_mock.powerflex_conn.deployment.delete = MagicMock(return_value=None) + powerflex_module_mock.perform_module_operation() + assert powerflex_module_mock.module.exit_json.call_args[1]['changed'] is True + + def test_delete_deploy(self, powerflex_module_mock): + self.set_module_params(powerflex_module_mock, self.get_module_args, + {"resource_group_name": "ans_rg", "state": "absent", "validate": True}) + powerflex_module_mock.powerflex_conn.deployment.get = MagicMock(return_value=[MagicMock()]) + powerflex_module_mock.powerflex_conn.deployment.delete = MagicMock(return_value=None) + powerflex_module_mock.perform_module_operation() + assert powerflex_module_mock.module.exit_json.call_args[1]['changed'] is True + + def test_delete_deploy_by_id(self, powerflex_module_mock): + self.set_module_params(powerflex_module_mock, self.get_module_args, + {"resource_group_id": "8aaa03a88de961fa018de96a88d80008", + "state": "absent", "validate": True, "resource_group_name": None}) + powerflex_module_mock.powerflex_conn.deployment.get_by_id = MagicMock( + return_value=MockResourceResourceGroupAPI.RG_RESPONSE[0]) + powerflex_module_mock.powerflex_conn.deployment.delete = MagicMock(return_value=None) + powerflex_module_mock.perform_module_operation() + assert powerflex_module_mock.module.exit_json.call_args[1]['changed'] is True + + def test_delete_deploy_by_id_exception(self, powerflex_module_mock): + self.set_module_params(powerflex_module_mock, self.get_module_args, + {"resource_group_id": "8aaa03a88de961fa018de96a88d80008", + "state": "absent", "validate": True, "resource_group_name": None}) + powerflex_module_mock.powerflex_conn.deployment.get_by_id = MagicMock(side_effect=MockApiException) + powerflex_module_mock.powerflex_conn.deployment.delete = MagicMock(return_value=None) + self.capture_fail_json_call("", powerflex_module_mock, invoke_perform_module=True) + + def test_delete_deploy_exception(self, powerflex_module_mock): + self.set_module_params(powerflex_module_mock, self.get_module_args, + {"resource_group_name": "ans_rg", "state": "absent", "validate": True, + "resource_group_id": None}) + powerflex_module_mock.powerflex_conn.deployment.get = MagicMock( + return_value=MockResourceResourceGroupAPI.RG_RESPONSE) + powerflex_module_mock.powerflex_conn.deployment.get_by_id = MagicMock( + return_value=MockResourceResourceGroupAPI.RG_RESPONSE[0]) + powerflex_module_mock.powerflex_conn.deployment.delete = MagicMock(side_effect=MockApiException) + self.capture_fail_json_call( + MockResourceResourceGroupAPI.resource_group_error('get_delete_deploy_exception'), + powerflex_module_mock, invoke_perform_module=True) + + def test_validate_deploy(self, powerflex_module_mock): + arguments = {"resource_group_name": "ans_rg", "description": "ans_rg", + "template_id": "c65d0172-8666-48ab-935e-9a0bf69ed66d", + "firmware_repository_id": "8aaa80788b5755d1018b576126d51ba3", + "validate": True, "resource_group_id": None, "state": "present"} + self.set_module_params(powerflex_module_mock, self.get_module_args, arguments) + powerflex_module_mock.powerflex_conn.deployment.get = MagicMock(return_value=[]) + powerflex_module_mock.powerflex_conn.deployment.get_by_id = MagicMock(return_value=[]) + powerflex_module_mock.powerflex_conn.service_template.get_by_id = MagicMock( + return_value=MockResourceResourceGroupAPI.RG_TEMPLATE_RESPONSE) + powerflex_module_mock.powerflex_conn.firmware_repository.get = MagicMock( + return_value=MockResourceResourceGroupAPI.RG_FIRMWARE_REPO) + powerflex_module_mock.powerflex_conn.deployment.validate = MagicMock( + return_value=MockResourceResourceGroupAPI.RG_RESPONSE) + powerflex_module_mock.perform_module_operation() + assert powerflex_module_mock.module.exit_json.call_args[1]['changed'] is False + + def test_validate_deploy_exception(self, powerflex_module_mock): + arguments = {"resource_group_name": "ans_rg", "description": "ans_rg", + "template_id": "c65d0172-8666-48ab-935e-9a0bf69ed66d", + "firmware_repository_id": "8aaa80788b5755d1018b576126d51ba3", + "validate": True, "resource_group_id": None, "state": "present"} + self.set_module_params(powerflex_module_mock, self.get_module_args, arguments) + powerflex_module_mock.get_deployment_data = MagicMock(side_effect=MockApiException) + self.capture_fail_json_call( + MockResourceResourceGroupAPI.resource_group_error('get_validate_deploy_exception'), + powerflex_module_mock, invoke_perform_module=True) + + def test_create_deploy(self, powerflex_module_mock): + arguments = {"resource_group_name": "ans_rg", "description": "ans_rg", + "template_id": None, "template_name": "update-template", + "firmware_repository_id": None, "firmware_repository_name": "firmware-name", + "validate": False, "state": "present", "schedule_date": "2020-01-01"} + self.set_module_params(powerflex_module_mock, self.get_module_args, arguments) + powerflex_module_mock.powerflex_conn.deployment.get = MagicMock(return_value=[]) + powerflex_module_mock.powerflex_conn.deployment.get_by_id = MagicMock(return_value=[]) + powerflex_module_mock.powerflex_conn.service_template.get = MagicMock( + return_value=MockResourceResourceGroupAPI.RG_TEMPLATE_RESPONSE) + powerflex_module_mock.powerflex_conn.service_template.get_by_id = MagicMock( + return_value=MockResourceResourceGroupAPI.RG_TEMPLATE_RESPONSE) + powerflex_module_mock.powerflex_conn.firmware_repository.get = MagicMock( + return_value=MockResourceResourceGroupAPI.RG_FIRMWARE_REPO) + powerflex_module_mock.powerflex_conn.deployment.create = MagicMock( + return_value=MockResourceResourceGroupAPI.RG_RESPONSE) + powerflex_module_mock.perform_module_operation() + assert powerflex_module_mock.module.exit_json.call_args[1]['changed'] is True + + def test_create_deploy_exception(self, powerflex_module_mock): + arguments = {"resource_group_name": "ans_rg", "description": "ans_rg", + "template_id": None, "template_name": "update-template", + "firmware_repository_id": None, "firmware_repository_name": "firmware-name", + "validate": False, "state": "present"} + self.set_module_params(powerflex_module_mock, self.get_module_args, arguments) + powerflex_module_mock.get_deployment_data = MagicMock(side_effect=MockApiException) + self.capture_fail_json_call( + MockResourceResourceGroupAPI.resource_group_error('get_create_deploy_exception'), + powerflex_module_mock, invoke_perform_module=True) + + def test_template_validation(self, powerflex_module_mock): + arguments = {"resource_group_name": "ans_rg", "description": "ans_rg", + "template_id": None, "template_name": None, + "firmware_repository_id": None, "firmware_repository_name": "firmware-name", + "validate": False, "state": "present"} + self.set_module_params(powerflex_module_mock, self.get_module_args, arguments) + powerflex_module_mock.powerflex_conn.service_template.get = MagicMock( + return_value=MockResourceResourceGroupAPI.RG_TEMPLATE_RESPONSE) + self.capture_fail_json_call( + MockResourceResourceGroupAPI.resource_group_error('get_template_validate_error'), + powerflex_module_mock, invoke_perform_module=True) + + def test_scheduled_data(self, powerflex_module_mock): + arguments = {"resource_group_name": "ans_rg", "description": "ans_rg", + "template_id": None, "template_name": "update-template", + "firmware_repository_id": None, "firmware_repository_name": "firmware-name", + "validate": False, "state": "present", "schedule_date": "01/01/2024"} + self.set_module_params(powerflex_module_mock, self.get_module_args, arguments) + powerflex_module_mock.powerflex_conn.deployment.get = MagicMock(return_value=[]) + powerflex_module_mock.powerflex_conn.deployment.get_by_id = MagicMock(return_value=[]) + powerflex_module_mock.powerflex_conn.service_template.get = MagicMock( + return_value=MockResourceResourceGroupAPI.RG_TEMPLATE_RESPONSE) + powerflex_module_mock.powerflex_conn.service_template.get_by_id = MagicMock( + return_value=MockResourceResourceGroupAPI.RG_TEMPLATE_RESPONSE) + powerflex_module_mock.powerflex_conn.firmware_repository.get = MagicMock( + return_value=MockResourceResourceGroupAPI.RG_FIRMWARE_REPO) + self.capture_fail_json_call( + MockResourceResourceGroupAPI.resource_group_error('invalid_date_format'), + powerflex_module_mock, invoke_perform_module=True) + + def test_resource_group_name_error(self, powerflex_module_mock): + arguments = {"resource_group_name": None, "description": "ans_rg", + "template_id": None, "template_name": "update-template", + "firmware_repository_id": None, "firmware_repository_name": "firmware-name", + "validate": False, "state": "present", "schedule_date": None} + self.set_module_params(powerflex_module_mock, self.get_module_args, arguments) + powerflex_module_mock.powerflex_conn.deployment.get = MagicMock(return_value=None) + powerflex_module_mock.powerflex_conn.deployment.get_by_id = MagicMock(return_value=None) + self.capture_fail_json_call( + MockResourceResourceGroupAPI.resource_group_error('resource_group_name_error'), + powerflex_module_mock, invoke_perform_module=True) + + def test_resource_group_edit(self, powerflex_module_mock): + arguments = {"resource_group_name": "ans_rg", "description": "ans_rg", + "template_id": None, "template_name": "update-template", + "firmware_repository_id": None, "firmware_repository_name": "firmware-name", + "validate": False, "state": "present", "schedule_date": "2020-01-01", + "scaleup": True, "node_count": 1, "clone_node": "block-legacy-gateway", + "new_resource_group_name": "ans_rg1"} + self.set_module_params(powerflex_module_mock, self.get_module_args, arguments) + powerflex_module_mock.powerflex_conn.deployment.get = MagicMock( + return_value=MockResourceResourceGroupAPI.RG_RESPONSE) + powerflex_module_mock.powerflex_conn.deployment.get_by_id = MagicMock( + return_value=MockResourceResourceGroupAPI.RG_RESPONSE[0]) + powerflex_module_mock.powerflex_conn.service_template.get = MagicMock( + return_value=MockResourceResourceGroupAPI.RG_TEMPLATE_RESPONSE) + powerflex_module_mock.powerflex_conn.service_template.get_by_id = MagicMock( + return_value=MockResourceResourceGroupAPI.RG_TEMPLATE_RESPONSE) + powerflex_module_mock.powerflex_conn.firmware_repository.get = MagicMock( + return_value=MockResourceResourceGroupAPI.RG_FIRMWARE_REPO) + powerflex_module_mock.powerflex_conn.deployment.edit = MagicMock( + return_value=None) + powerflex_module_mock.perform_module_operation() + assert powerflex_module_mock.module.exit_json.call_args[1]['changed'] is True + arguments.update({"clone_node": None}) + self.set_module_params(powerflex_module_mock, self.get_module_args, arguments) + powerflex_module_mock.perform_module_operation() + assert powerflex_module_mock.module.exit_json.call_args[1]['changed'] is True + + def test_modify_resource_group_exception(self, powerflex_module_mock): + arguments = {"resource_group_name": "ans_rg", "description": "ans_rg", + "template_id": None, "template_name": "update-template", + "firmware_repository_id": None, "firmware_repository_name": "firmware-name", + "validate": False, "state": "present", "schedule_date": "2020-01-01", + "scaleup": True, "node_count": 1, "clone_node": "block-legacy-gateway"} + self.set_module_params(powerflex_module_mock, self.get_module_args, arguments) + powerflex_module_mock.powerflex_conn.deployment.get = MagicMock( + return_value=MockResourceResourceGroupAPI.RG_RESPONSE) + powerflex_module_mock.powerflex_conn.deployment.get_by_id = MagicMock( + return_value=MockResourceResourceGroupAPI.RG_RESPONSE[0]) + powerflex_module_mock.powerflex_conn.service_template.get = MagicMock( + return_value=MockResourceResourceGroupAPI.RG_TEMPLATE_RESPONSE) + powerflex_module_mock.powerflex_conn.service_template.get_by_id = MagicMock( + return_value=MockResourceResourceGroupAPI.RG_TEMPLATE_RESPONSE) + powerflex_module_mock.powerflex_conn.firmware_repository.get = MagicMock( + return_value=MockResourceResourceGroupAPI.RG_FIRMWARE_REPO) + powerflex_module_mock.modify_resource_group_details = MagicMock(side_effect=MockApiException) + self.capture_fail_json_call( + MockResourceResourceGroupAPI.resource_group_error('resource_group_edit_error'), + powerflex_module_mock, invoke_perform_module=True) |