Forum Discussion

mdaniel's avatar
mdaniel
Novice II
2 days ago

Flashblade & Ansible collection

Hello community,

We are facing some issues with our FlashBlade when provisioning policies with Ansible. We have updated all the components (py-pure-client and the collection), and we are failing on a simple policy deployment.

- name: Test
  purestorage.flashblade.purefb_policy:
    name: "filesystem_export_policy"
    enabled: True
    policy_type: "nfs"
    at: True
    client: "mynfsexport.flashblade.local"
    secure: True
    security: "sys"
    permission: "rw"
    access: "no-squash"
    fb_url: "{{ fb_host }}"
    api_token: "{{ fb_api_token }}"

The complete stack trace is :

The full traceback is:
Traceback (most recent call last):
  File "/home/user/.ansible/tmp/ansible-tmp-1778656887.1852276-3067455-48057529014464/AnsiballZ_purefb_policy.py", line 107, in <module>
    _ansiballz_main()
  File "/home/user/.ansible/tmp/ansible-tmp-1778656887.1852276-3067455-48057529014464/AnsiballZ_purefb_policy.py", line 99, in _ansiballz_main
    invoke_module(zipped_mod, temp_path, ANSIBALLZ_PARAMS)
  File "/home/user/.ansible/tmp/ansible-tmp-1778656887.1852276-3067455-48057529014464/AnsiballZ_purefb_policy.py", line 47, in invoke_module
    runpy.run_module(mod_name='ansible_collections.purestorage.flashblade.plugins.modules.purefb_policy', init_globals=dict(_module_fqn='ansible_collections.purestorage.flashblade.plugins.modules.purefb_policy', _modlib_path=modlib_path),
  File "<frozen runpy>", line 226, in run_module
  File "<frozen runpy>", line 98, in _run_module_code
  File "<frozen runpy>", line 88, in _run_code
  File "/opt/tmp/tmp/ansible_purestorage.flashblade.purefb_policy_payload_xaietsz7/ansible_purestorage.flashblade.purefb_policy_payload.zip/ansible_collections/purestorage/flashblade/plugins/modules/purefb_policy.py", line 4233, in <module>
  File "/opt/tmp/tmp/ansible_purestorage.flashblade.purefb_policy_payload_xaietsz7/ansible_purestorage.flashblade.purefb_policy_payload.zip/ansible_collections/purestorage/flashblade/plugins/modules/purefb_policy.py", line 4008, in main
  File "/opt/tmp/tmp/ansible_purestorage.flashblade.purefb_policy_payload_xaietsz7/ansible_purestorage.flashblade.purefb_policy_payload.zip/ansible_collections/purestorage/flashblade/plugins/modules/purefb_policy.py", line 2392, in update_nfs_policy
AttributeError: 'ErrorResponse' object has no attribute 'items'
fatal: [localhost]: FAILED! => {
    "changed": false,
    "module_stderr": "Traceback (most recent call last):\n  File \"/home/user/.ansible/tmp/ansible-tmp-1778656887.1852276-3067455-48057529014464/AnsiballZ_purefb_policy.py\", line 107, in <module>\n    _ansiballz_main()\n  File \"/home/user/.ansible/tmp/ansible-tmp-1778656887.1852276-3067455-48057529014464/AnsiballZ_purefb_policy.py\", line 99, in _ansiballz_main\n    invoke_module(zipped_mod, temp_path, ANSIBALLZ_PARAMS)\n  File \"/home/user/.ansible/tmp/ansible-tmp-1778656887.1852276-3067455-48057529014464/AnsiballZ_purefb_policy.py\", line 47, in invoke_module\n    runpy.run_module(mod_name='ansible_collections.purestorage.flashblade.plugins.modules.purefb_policy', init_globals=dict(_module_fqn='ansible_collections.purestorage.flashblade.plugins.modules.purefb_policy', _modlib_path=modlib_path),\n  File \"<frozen runpy>\", line 226, in run_module\n  File \"<frozen runpy>\", line 98, in _run_module_code\n  File \"<frozen runpy>\", line 88, in _run_code\n  File \"/opt/tmp/tmp/ansible_purestorage.flashblade.purefb_policy_payload_xaietsz7/ansible_purestorage.flashblade.purefb_policy_payload.zip/ansible_collections/purestorage/flashblade/plugins/modules/purefb_policy.py\", line 4233, in <module>\n  File \"/opt/tmp/tmp/ansible_purestorage.flashblade.purefb_policy_payload_xaietsz7/ansible_purestorage.flashblade.purefb_policy_payload.zip/ansible_collections/purestorage/flashblade/plugins/modules/purefb_policy.py\", line 4008, in main\n  File \"/opt/tmp/tmp/ansible_purestorage.flashblade.purefb_policy_payload_xaietsz7/ansible_purestorage.flashblade.purefb_policy_payload.zip/ansible_collections/purestorage/flashblade/plugins/modules/purefb_policy.py\", line 2392, in update_nfs_policy\nAttributeError: 'ErrorResponse' object has no attribute 'items'\n",
    "module_stdout": "",
    "msg": "MODULE FAILURE: No start of json char found\nSee stdout/stderr for the exact error",
    "rc": 1
}

If the policy is already set, the playbook runs perfectly fine. The problem occurs when a new policy is injected.

However, we have to install the collection from GitHub. It seems that the artifact built and installed by Ansible Galaxy is not correct. Some commits are not propagated.

For example, with the FlashBlade collection 1.24 (installed from Galaxy), we have:

>>> from pypureclient.flashblade import (
...     PolicyRuleObjectAccessCondition,
...     PolicyRuleObjectAccessPost,
...     PolicyRuleObjectAccess,
...     NfsExportPolicy,
...     NfsExportPolicyRule,
...     Policy,
...     PolicyPatch,
...     PolicyRule,
...     SmbSharePolicyRule,
...     SmbSharePolicy,
...     SmbClientPolicyRule,
...     SmbClientPolicy,
...     ObjectStoreAccessPolicyPost,
...     NetworkAccessPolicy,
...     NetworkAccessPolicyRule,
...     WormDataPolicy,
... )
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/user/conda/envs/ansible/lib/python3.12/site-packages/pypureclient/flashblade/__init__.py", line 40, in __getattr__
    raise ImportError(f'module {__package__} has no attribute {name}')
ImportError: module pypureclient.flashblade has no attribute PolicyPatch

We have compared the archive from GitHub and there are many differences with the upstream collection code.

To help, find my my env package : 

 Package           Version
----------------- -----------
annotated-types   0.7.0
ansible-core      2.18.5
bcrypt            5.0.0
certifi           2026.4.22
cffi              2.0.0
cryptography      44.0.0
dnspython         2.8.0
invoke            3.0.3
Jinja2            3.1.4
MarkupSafe        2.1.1
packaging         24.1
paramiko          5.0.0
pip               24.2
py-pure-client    1.88.0
pycparser         2.22
pydantic          2.13.4
pydantic_core     2.46.4
PyJWT             2.12.1
PyNaCl            1.6.2
python-dateutil   2.9.0.post0
PyYAML            6.0.2
resolvelib        1.0.1
setuptools        75.8.2
six               1.17.0
typing_extensions 4.15.0
typing-inspection 0.4.2
urllib3           2.7.0
wheel             0.45.0

And our flashblades are running the Purity//FB 4.6.9.

If anyone has a lead to help us get our Ansible back up and running, I thank them in advance.

We appreciate your help.

Matth

2 Replies