diff options
Diffstat (limited to 'ansible_collections/purestorage/flasharray')
13 files changed, 207 insertions, 94 deletions
diff --git a/ansible_collections/purestorage/flasharray/.github/workflows/main.yml b/ansible_collections/purestorage/flasharray/.github/workflows/main.yml index 27d5532d2..1e8544e3b 100644 --- a/ansible_collections/purestorage/flasharray/.github/workflows/main.yml +++ b/ansible_collections/purestorage/flasharray/.github/workflows/main.yml @@ -15,6 +15,7 @@ jobs: ansible: - stable-2.15 - stable-2.16 + - stable-2.17 - devel python-version: - 3.9 @@ -24,6 +25,8 @@ jobs: - python-version: 3.9 ansible: stable-2.16 - python-version: 3.9 + ansible: stable-2.17 + - python-version: 3.9 ansible: devel steps: - name: Check out code diff --git a/ansible_collections/purestorage/flasharray/CHANGELOG.rst b/ansible_collections/purestorage/flasharray/CHANGELOG.rst index 111a76e53..44fa6a613 100644 --- a/ansible_collections/purestorage/flasharray/CHANGELOG.rst +++ b/ansible_collections/purestorage/flasharray/CHANGELOG.rst @@ -5,6 +5,16 @@ Purestorage.Flasharray Release Notes .. contents:: Topics +v1.28.1 +======= + +Bugfixes +-------- + +- purefa_network - Fix issue with clearing network interface addresses +- purefa_network - Resolve issue when setting a network port on a new array +- purefa_policy - Enhanced idempotency for snapshot policy rules + v1.28.0 ======= diff --git a/ansible_collections/purestorage/flasharray/FILES.json b/ansible_collections/purestorage/flasharray/FILES.json index 81e70779b..cdd19cf58 100644 --- a/ansible_collections/purestorage/flasharray/FILES.json +++ b/ansible_collections/purestorage/flasharray/FILES.json @@ -750,6 +750,13 @@ "format": 1 }, { + "name": "changelogs/fragments/567_newarray_network.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "133ca1f5bdf8e67168153906cfc60fbac837265a42e934b410c624e1c954c0a8", + "format": 1 + }, + { "name": "changelogs/fragments/531_ra_rest.yaml", "ftype": "file", "chksum_type": "sha256", @@ -946,6 +953,13 @@ "format": 1 }, { + "name": "changelogs/fragments/565_fix_clear_interface.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "f82f45bc0c45406a1f31e022272f5402feea9acb1fbc12558acd850b756619c6", + "format": 1 + }, + { "name": "changelogs/fragments/560_snapshot_epoch.yaml", "ftype": "file", "chksum_type": "sha256", @@ -1219,6 +1233,13 @@ "format": 1 }, { + "name": "changelogs/fragments/569_enhanced_snap_policy.yaml", + "ftype": "file", + "chksum_type": "sha256", + "chksum_sha256": "72668007fa3552289903f4c439f82eba3cbbeaf4098a16728ef92bd0e3f70e0d", + "format": 1 + }, + { "name": "changelogs/fragments/136_add_vol_get_send_info.yaml", "ftype": "file", "chksum_type": "sha256", @@ -1565,14 +1586,14 @@ "name": "changelogs/changelog.yaml", "ftype": "file", "chksum_type": "sha256", - "chksum_sha256": "0b587f1c2ab470c01ea25d07a6102c7bd45c511ce57596be9c20f38bb3b5e456", + "chksum_sha256": "dbb3a56908b638220035f4e7cd04174075a0558bf455d0562da15d2ba8247eff", "format": 1 }, { "name": "changelogs/.plugin-cache.yaml", "ftype": "file", "chksum_type": "sha256", - "chksum_sha256": "2eb4d8b274c69bde5af5d3e8dfb793a902429d99ca679286f7cce43712013dad", + "chksum_sha256": "1c4ab55e3f9d085516eb971584c311fa6065bcc4503fe7530422cf4f491bdb88", "format": 1 }, { @@ -1824,7 +1845,7 @@ "name": "plugins/modules/purefa_policy.py", "ftype": "file", "chksum_type": "sha256", - "chksum_sha256": "eb24acd1b8171f2a4f746db11574f9973956393ca450507029e08bd0a4de9f52", + "chksum_sha256": "75f1461aa996b7af83b6ab595aca7f42954d1a8d3af0ee87f00756ca7bf0a08e", "format": 1 }, { @@ -1915,7 +1936,7 @@ "name": "plugins/modules/purefa_network.py", "ftype": "file", "chksum_type": "sha256", - "chksum_sha256": "0e9a2651b81bb8edd1fa026e1a1d9f2496478f207405178b47f5fab8c2e27ae9", + "chksum_sha256": "ec4e1720c6c824a076bb08442a3164c37589dce5088921ad8eaea8bbec156f94", "format": 1 }, { @@ -2118,7 +2139,7 @@ "name": "plugins/modules/purefa_info.py", "ftype": "file", "chksum_type": "sha256", - "chksum_sha256": "71476398cc0db0ada0a924a210ea483bcad581eb94dd778562f845f510fcfb01", + "chksum_sha256": "901490359cac7ad45d4ed9cba3249b91807c66dedb5243c800b9be6fd736d967", "format": 1 }, { @@ -2265,7 +2286,7 @@ "name": ".github/workflows/main.yml", "ftype": "file", "chksum_type": "sha256", - "chksum_sha256": "de55a03dadff2ec71a72efd44dcbcb3c2950d1a00aea1ffd6223c6ce9a9e815a", + "chksum_sha256": "dba5acd44f50630ab9db379b8474245603d41a7eb50388aab39bb5d1f9fca914", "format": 1 }, { @@ -2286,7 +2307,7 @@ "name": "README.md", "ftype": "file", "chksum_type": "sha256", - "chksum_sha256": "f7f6650c570a9b0da9f733fa208da1166b49bddf08658d59ef9905648f80060f", + "chksum_sha256": "0bc220295e26ec0084734261891239b1a7fedbb8c54cb35f95b944f80881f9a3", "format": 1 }, { @@ -2370,7 +2391,7 @@ "name": "CHANGELOG.rst", "ftype": "file", "chksum_type": "sha256", - "chksum_sha256": "ef83ad3fb215623f94ceb80b0dab6978894dd59b90203d2999e9026fa9627b76", + "chksum_sha256": "dda2052fb4a4af4461e1c56807cf896aae1754f6f762c5641b6ddccfbb49fbff", "format": 1 } ], diff --git a/ansible_collections/purestorage/flasharray/MANIFEST.json b/ansible_collections/purestorage/flasharray/MANIFEST.json index 5c39c4c14..91c975a81 100644 --- a/ansible_collections/purestorage/flasharray/MANIFEST.json +++ b/ansible_collections/purestorage/flasharray/MANIFEST.json @@ -2,7 +2,7 @@ "collection_info": { "namespace": "purestorage", "name": "flasharray", - "version": "1.28.0", + "version": "1.28.1", "authors": [ "Pure Storage Ansible Team <pure-ansible-team@purestorage.com>" ], @@ -29,7 +29,7 @@ "name": "FILES.json", "ftype": "file", "chksum_type": "sha256", - "chksum_sha256": "ab3ade4ad530c2f9141631d1ac2c2b431cec2651753ec9e7dc3a845eda21dd82", + "chksum_sha256": "9898c292949e2e5cc9ba99514c95c7b8706ada3f4eb938acbd7061de21ca4d00", "format": 1 }, "format": 1 diff --git a/ansible_collections/purestorage/flasharray/README.md b/ansible_collections/purestorage/flasharray/README.md index 92ae085d8..ea5923bf4 100644 --- a/ansible_collections/purestorage/flasharray/README.md +++ b/ansible_collections/purestorage/flasharray/README.md @@ -6,14 +6,11 @@ # Pure Storage FlashArray Collection -The Pure Storage FlashArray collection consists of the latest versions of the FlashArray modules and also includes support for Cloud Block Store - -## Supported Platforms +## Description -- Pure Storage FlashArray with Purity 6.1.0 or later -- Certain modules and functionality require higher versions of Purity. Modules will inform you if your Purity version is not high enough to use a module. +The Pure Storage FlashArray collection consists of the latest versions of the FlashArray modules and also includes support for Cloud Block Store -## Prerequisites +## Requirements - Ansible 2.15 or later - Pure Storage FlashArray system running Purity 6.1.0 or later @@ -28,11 +25,76 @@ The Pure Storage FlashArray collection consists of the latest versions of the Fl - pycountry - packaging -## Idempotency +## Installation + +Before using this collection, you need to install it with the Ansible Galaxy command-line tool: + +``` +ansible-galaxy collection install purestorage.flasharray +``` + +You can also include it in a `requirements.yml` file and install it with `ansible-galaxy collection install -r requirements.yml`, using the format: + +``` +collections: + - name: purestorage.flasharray +``` + +Note that if you install the collection from Ansible Galaxy, it will not be upgraded automatically when you upgrade the Ansible package. + +To upgrade the collection to the latest available version, run the following command: + +``` +ansible-galaxy collection install purestorage.flasharray --upgrade +``` + +You can also install a specific version of the collection, for example, if you need to downgrade when something is broken in the latest version (please report an issue in this repository). Use the following syntax to install version 1.0.0: + +``` +ansible-galaxy collection install purestorage.flasharray:==1.0.0 +``` + +See [using Ansible collections](https://docs.ansible.com/ansible/devel/user_guide/collections_using.html) for more details. + +## Use Cases + +This collection can be used to perform any task that you would normally perform using the command-line or GUI on a FlashArray. This also includes using the collection in larger playbooks to perform actions with storage-related components, such as: +* Infrastructure Drift Control +* Database Cloning +* Disaster Recovery + +## Contributing + +There are many ways in which you can participate in the project, for example: + +* Submit bugs and feature requests, and help us verify as they are checked in +* Review source code changes +* Review the documentation and make pull requests for anything from typos to new content +* If you are interested in fixing issues and contributing directly to the code base, please see the details below: + 1. Fork this project into your account if you are a first-time contributor. + 2. Create a branch based on the latest `master` branch, commit your changes on this branch. + 3. You may merge the Pull Request in once you have the sign-off of two other developers, or if you do not have permission to do that, you may request the second reviewer to merge it for you. + +## Support + +Only the latest release of this collection is supported. + +For support please raise a GitHub Issue on this repository. + +If you are a Pure Storage customer, you may log a support call with the Pure Storage Support team ([support\@purestorage.com](mailto:support@purestorage.com?subject=FlashArray-Ansible-Collection)) + +If you have a Red Hat Ansible support contract, as this is a Certified collection, you may log a support call with Red Hat directly. + +## Release Notes + +Release notes for this collection can be found [here](https://github.com/Pure-Storage-Ansible/FlashArray-Collection/releases) + +## Related Information +### Idempotency All modules are idempotent with the exception of modules that change or set passwords. Due to security requirements exisitng passwords can be validated against and therefore will always be modified, even if there is no change. -## Available Modules +### Available Modules - purefa_ad - manage FlashArray Active Directoy accounts - purefa_admin - Configure Pure Storage FlashArray Global Admin settings @@ -95,18 +157,10 @@ All modules are idempotent with the exception of modules that change or set pass - purefa_volume - manage volumes on the FlashArray - purefa_volume_tags - manage volume tags on the FlashArray -## Instructions - -Install the Pure Storage FlashArray collection on your Ansible management host. - -- Using ansible-galaxy (Ansible 2.9 or later): -``` -ansible-galaxy collection install purestorage.flasharray -p ~/.ansible/collections -``` - -## License +## License Information [BSD-2-Clause](https://directory.fsf.org/wiki?title=License:FreeBSD) + [GPL-3.0-or-later](https://www.gnu.org/licenses/gpl-3.0.en.html) ## Author diff --git a/ansible_collections/purestorage/flasharray/changelogs/.plugin-cache.yaml b/ansible_collections/purestorage/flasharray/changelogs/.plugin-cache.yaml index f99c9ee8a..7a5c7b9aa 100644 --- a/ansible_collections/purestorage/flasharray/changelogs/.plugin-cache.yaml +++ b/ansible_collections/purestorage/flasharray/changelogs/.plugin-cache.yaml @@ -322,4 +322,4 @@ plugins: strategy: {} test: {} vars: {} -version: 1.28.0 +version: 1.28.1 diff --git a/ansible_collections/purestorage/flasharray/changelogs/changelog.yaml b/ansible_collections/purestorage/flasharray/changelogs/changelog.yaml index c73a6b48b..07129c043 100644 --- a/ansible_collections/purestorage/flasharray/changelogs/changelog.yaml +++ b/ansible_collections/purestorage/flasharray/changelogs/changelog.yaml @@ -609,6 +609,17 @@ releases: - 561_remote_snap_info.yaml - 562_host_vol_fix.yaml release_date: '2024-05-01' + 1.28.1: + changes: + bugfixes: + - purefa_network - Fix issue with clearing network interface addresses + - purefa_network - Resolve issue when setting a network port on a new array + - purefa_policy - Enhanced idempotency for snapshot policy rules + fragments: + - 565_fix_clear_interface.yaml + - 567_newarray_network.yaml + - 569_enhanced_snap_policy.yaml + release_date: '2024-05-31' 1.4.0: changes: bugfixes: diff --git a/ansible_collections/purestorage/flasharray/changelogs/fragments/565_fix_clear_interface.yaml b/ansible_collections/purestorage/flasharray/changelogs/fragments/565_fix_clear_interface.yaml new file mode 100644 index 000000000..8830deddf --- /dev/null +++ b/ansible_collections/purestorage/flasharray/changelogs/fragments/565_fix_clear_interface.yaml @@ -0,0 +1,2 @@ +bugfixes: + - purefa_network - Fix issue with clearing network interface addresses diff --git a/ansible_collections/purestorage/flasharray/changelogs/fragments/567_newarray_network.yaml b/ansible_collections/purestorage/flasharray/changelogs/fragments/567_newarray_network.yaml new file mode 100644 index 000000000..2591d79ac --- /dev/null +++ b/ansible_collections/purestorage/flasharray/changelogs/fragments/567_newarray_network.yaml @@ -0,0 +1,2 @@ +bugfixes: + - purefa_network - Resolve issue when setting a network port on a new array diff --git a/ansible_collections/purestorage/flasharray/changelogs/fragments/569_enhanced_snap_policy.yaml b/ansible_collections/purestorage/flasharray/changelogs/fragments/569_enhanced_snap_policy.yaml new file mode 100644 index 000000000..bac87c8d2 --- /dev/null +++ b/ansible_collections/purestorage/flasharray/changelogs/fragments/569_enhanced_snap_policy.yaml @@ -0,0 +1,2 @@ +bugfixes: + - purefa_policy - Enhanced idempotency for snapshot policy rules diff --git a/ansible_collections/purestorage/flasharray/plugins/modules/purefa_info.py b/ansible_collections/purestorage/flasharray/plugins/modules/purefa_info.py index cc2c92fdc..ca6e73dfe 100644 --- a/ansible_collections/purestorage/flasharray/plugins/modules/purefa_info.py +++ b/ansible_collections/purestorage/flasharray/plugins/modules/purefa_info.py @@ -1800,7 +1800,7 @@ def generate_del_pgroups_dict(module, array): return pgroups_info -def generate_pgroups_dict(module, array, performance): +def generate_pgroups_dict(module, array): pgroups_info = {} api_version = array._list_available_rest_versions() pgroups = array.list_pgroups() diff --git a/ansible_collections/purestorage/flasharray/plugins/modules/purefa_network.py b/ansible_collections/purestorage/flasharray/plugins/modules/purefa_network.py index c296707d0..97a510504 100644 --- a/ansible_collections/purestorage/flasharray/plugins/modules/purefa_network.py +++ b/ansible_collections/purestorage/flasharray/plugins/modules/purefa_network.py @@ -319,6 +319,8 @@ def update_interface(module, array, interface): "services": sorted(interface["services"]), "slaves": sorted(interface["slaves"]), } + if not current_state["address"]: + current_state["address"] = "0.0.0.0" array6 = get_array(module) subinterfaces = sorted(current_state["slaves"]) if module.params["subinterfaces"]: @@ -339,19 +341,19 @@ def update_interface(module, array, interface): enabled = current_state["enabled"] if not current_state["gateway"]: try: - if valid_ipv4(interface["address"]): + if valid_ipv4(current_state["address"]): current_state["gateway"] = None - elif valid_ipv6(interface["address"]): + elif valid_ipv6(current_state["address"]): current_state["gateway"] = None except AttributeError: current_state["gateway"] = None if not module.params["servicelist"]: - services = sorted(interface["services"]) + services = current_state["services"] else: services = sorted(module.params["servicelist"]) if not module.params["address"]: - address = interface["address"] - netmask = interface["netmask"] + address = current_state["address"] + netmask = current_state["netmask"] else: if module.params["gateway"] and module.params["gateway"] not in [ "0.0.0.0", @@ -359,7 +361,7 @@ def update_interface(module, array, interface): ]: if module.params["gateway"] not in IPNetwork(module.params["address"]): module.fail_json(msg="Gateway and subnet are not compatible.") - if not module.params["gateway"] and interface["gateway"] not in [ + if not module.params["gateway"] and current_state["gateway"] not in [ None, IPNetwork(module.params["address"]), ]: @@ -368,7 +370,7 @@ def update_interface(module, array, interface): if address in ["0.0.0.0", "::"]: address = None if not module.params["mtu"]: - mtu = interface["mtu"] + mtu = current_state["mtu"] else: if not 1280 <= module.params["mtu"] <= 9216: module.fail_json( @@ -379,6 +381,8 @@ def update_interface(module, array, interface): else: mtu = module.params["mtu"] if module.params["address"]: + if not address: + address = "0.0.0.0" if valid_ipv4(address): netmask = str(IPNetwork(module.params["address"]).netmask) else: @@ -386,9 +390,9 @@ def update_interface(module, array, interface): if netmask in ["0.0.0.0", "0"]: netmask = None else: - netmask = interface["netmask"] + netmask = current_state["netmask"] if not module.params["gateway"]: - gateway = interface["gateway"] + gateway = current_state["gateway"] elif module.params["gateway"] in ["0.0.0.0", "::"]: gateway = None elif valid_ipv4(address): @@ -427,7 +431,7 @@ def update_interface(module, array, interface): changed = True if ( module.params["servicelist"] - and sorted(module.params["servicelist"]) != interface["services"] + and sorted(module.params["servicelist"]) != current_state["services"] ): api_version = array._list_available_rest_versions() if FC_ENABLE_API in api_version: @@ -450,7 +454,8 @@ def update_interface(module, array, interface): "Servicelist not updated as pypureclient module is required" ) if ( - "management" in interface["services"] or "app" in interface["services"] + "management" in current_state["services"] + or "app" in current_state["services"] ) and address in ["0.0.0.0/0", "::/0"]: module.fail_json( msg="Removing IP address from a management or app port is not supported" diff --git a/ansible_collections/purestorage/flasharray/plugins/modules/purefa_policy.py b/ansible_collections/purestorage/flasharray/plugins/modules/purefa_policy.py index 7247d376f..636a77c50 100644 --- a/ansible_collections/purestorage/flasharray/plugins/modules/purefa_policy.py +++ b/ansible_collections/purestorage/flasharray/plugins/modules/purefa_policy.py @@ -1416,64 +1416,67 @@ def update_policy(module, array, api_version, all_squash): ).items ) if rules: - rule_name = "" for rule in range(0, len(rules)): - if rules[rule].client_name == module.params["snap_client_name"]: - rule_name = rules[rule].name - break - if not rule_name: - if module.params["snap_keep_for"] < module.params["snap_every"]: + if ( + rules[rule].client_name == module.params["snap_client_name"] + and int(rules[rule].every / 60000) + == module.params["snap_every"] + and int(rules[rule].keep_for / 60000) + == module.params["snap_keep_for"] + ): + module.exit_json(changed=False) + if module.params["snap_keep_for"] < module.params["snap_every"]: + module.fail_json( + msg="Retention period (snap_keep_for) cannot be less than snapshot interval (snap_every)." + ) + if module.params["snap_at"]: + if not module.params["snap_every"] % 1440 == 0: module.fail_json( - msg="Retention period (snap_keep_for) cannot be less than snapshot interval (snap_every)." + msg="snap_at time can only be set if snap_every is multiple of 1440" + ) + if suffix_enabled: + rules = flasharray.PolicyrulesnapshotpostRules( + at=convert_to_millisecs(module.params["snap_at"]), + client_name=module.params["snap_client_name"], + every=module.params["snap_every"] * 60000, + keep_for=module.params["snap_keep_for"] * 60000, + suffix=module.params["snap_suffix"], ) - if module.params["snap_at"]: - if not module.params["snap_every"] % 1440 == 0: - module.fail_json( - msg="snap_at time can only be set if snap_every is multiple of 1440" - ) - if suffix_enabled: - rules = flasharray.PolicyrulesnapshotpostRules( - at=convert_to_millisecs(module.params["snap_at"]), - client_name=module.params["snap_client_name"], - every=module.params["snap_every"] * 60000, - keep_for=module.params["snap_keep_for"] * 60000, - suffix=module.params["snap_suffix"], - ) - else: - rules = flasharray.PolicyrulesnapshotpostRules( - at=convert_to_millisecs(module.params["snap_at"]), - client_name=module.params["snap_client_name"], - every=module.params["snap_every"] * 60000, - keep_for=module.params["snap_keep_for"] * 60000, - ) else: - if suffix_enabled: - rules = flasharray.PolicyrulesnapshotpostRules( - client_name=module.params["snap_client_name"], - every=module.params["snap_every"] * 60000, - keep_for=module.params["snap_keep_for"] * 60000, - suffix=module.params["snap_suffix"], - ) - else: - rules = flasharray.PolicyrulesnapshotpostRules( - client_name=module.params["snap_client_name"], - every=module.params["snap_every"] * 60000, - keep_for=module.params["snap_keep_for"] * 60000, - ) - rule = flasharray.PolicyRuleSnapshotPost(rules=[rules]) - changed_rule = True - if not module.check_mode: - rule_created = array.post_policies_snapshot_rules( - policy_names=[module.params["name"]], rules=rule - ) - if rule_created.status_code != 200: - err_no = len(rule_created.errors) - 1 - module.fail_json( - msg="Failed to create new rule for Snapshot policy {0}. Error: {1}".format( - module.params["name"], - rule_created.errors[err_no].message, - ) + rules = flasharray.PolicyrulesnapshotpostRules( + at=convert_to_millisecs(module.params["snap_at"]), + client_name=module.params["snap_client_name"], + every=module.params["snap_every"] * 60000, + keep_for=module.params["snap_keep_for"] * 60000, + ) + else: + if suffix_enabled: + rules = flasharray.PolicyrulesnapshotpostRules( + client_name=module.params["snap_client_name"], + every=module.params["snap_every"] * 60000, + keep_for=module.params["snap_keep_for"] * 60000, + suffix=module.params["snap_suffix"], + ) + else: + rules = flasharray.PolicyrulesnapshotpostRules( + client_name=module.params["snap_client_name"], + every=module.params["snap_every"] * 60000, + keep_for=module.params["snap_keep_for"] * 60000, + ) + rule = flasharray.PolicyRuleSnapshotPost(rules=[rules]) + changed_rule = True + if not module.check_mode: + rule_created = array.post_policies_snapshot_rules( + policy_names=[module.params["name"]], rules=rule + ) + if rule_created.status_code != 200: + err_no = len(rule_created.errors) - 1 + module.fail_json( + msg="Failed to create new rule for Snapshot policy {0}. Error: {1}".format( + module.params["name"], + rule_created.errors[err_no].message, ) + ) else: if module.params["snap_keep_for"] < module.params["snap_every"]: module.fail_json( |