Pure-Storage-Ansible / FlashArray-Collection

Ansible Collection for Pure Storage FlashArray
GNU General Public License v3.0
19 stars 21 forks source link

Add VG rename #479

Closed colinet closed 9 months ago

colinet commented 9 months ago

I need to rename volume groups using purefa_vg. This is possible with CLI but not with Ansible Pure collection.

Could this be added to the collection using purefa_vg command?

sdodsley commented 9 months ago

@colinet please try #480 and let me know if it resolves your issue

colinet commented 9 months ago

I applied the provided patch. Then I ran the below playbook:

- name: "Pure | volumegroup delete | rename volume group from {{ _volumegroup_rename_name }} to {{ _volumegroup_rename_rename }}"
  purefa_vg:
    fa_url: "{{ san_CRUD_fa_url }}"
    api_token: "{{ san_CRUD_api_token }}"
    name: "{{ _volumegroup_rename_name }}"
    rename: "{{ _volumegroup_rename_rename }}"

I get the below outcome:

TASK [ds-role-san_CRUD : Pure | volumegroup delete | rename volume group from TEST-MHXPUR999-VG to TEST-MHXPUR999-VG-TODELETE-2023-10-17-11h17m30s] ***************************************************************************************************************************
Tuesday 17 October 2023  13:17:49 +0200 (0:00:00.289)       0:01:19.380 ******* 
fatal: [localhost]: FAILED! => {"changed": false, "module_stderr": "/home/rcolinet/.local/lib/python3.9/site-packages/urllib3/connectionpool.py:1045: InsecureRequestWarning: Unverified HTTPS request is being made to host '10.81.0.114'. Adding certificate verification is strongly advised. See: https://urllib3.readthedocs.io/en/1.26.x/advanced-usage.html#ssl-warnings\n  warnings.warn(\n/home/rcolinet/.local/lib/python3.9/site-packages/urllib3/connectionpool.py:1045: InsecureRequestWarning: 
Unverified HTTPS request is being made to host '10.81.0.114'. Adding certificate verification is strongly advised. See: https://urllib3.readthedocs.io/en/1.26.x/advanced-usage.html#ssl-warnings\n  warnings.warn(\n/home/rcolinet/.local/lib/python3.9/site-packages/urllib3/connectionpool.py:1045: InsecureRequestWarning: 
Unverified HTTPS request is being made to host '10.81.0.114'. Adding certificate verification is strongly advised. See: https://urllib3.readthedocs.io/en/1.26.x/advanced-usage.html#ssl-warnings\n  warnings.warn(\n/home/rcolinet/.local/lib/python3.9/site-packages/urllib3/connectionpool.py:1045: InsecureRequestWarning: 
Unverified HTTPS request is being made to host '10.81.0.114'. Adding certificate verification is strongly advised. See: https://urllib3.readthedocs.io/en/1.26.x/advanced-usage.html#ssl-warnings\n  warnings.warn(\n/home/rcolinet/.local/lib/python3.9/site-packages/urllib3/connectionpool.py:1045: InsecureRequestWarning: 
Unverified HTTPS request is being made to host '10.81.0.114'. Adding certificate verification is strongly advised. See: https://urllib3.readthedocs.io/en/1.26.x/advanced-usage.html#ssl-warnings\n  warnings.warn(\n/home/rcolinet/.local/lib/python3.9/site-packages/urllib3/connectionpool.py:1045: InsecureRequestWarning: 
Unverified HTTPS request is being made to host '10.81.0.114'. Adding certificate verification is strongly advised. See: https://urllib3.readthedocs.io/en/1.26.x/advanced-usage.html#ssl-warnings\n  warnings.warn(\n/home/rcolinet/.local/lib/python3.9/site-packages/urllib3/connectionpool.py:1045: InsecureRequestWarning: 
Unverified HTTPS request is being made to host '10.81.0.114'. Adding certificate verification is strongly advised. See: https://urllib3.readthedocs.io/en/1.26.x/advanced-usage.html#ssl-warnings\n  warnings.warn(\n/home/rcolinet/.local/lib/python3.9/site-packages/urllib3/connectionpool.py:1045: InsecureRequestWarning: 
Unverified HTTPS request is being made to host '10.81.0.114'. Adding certificate verification is strongly advised. See: https://urllib3.readthedocs.io/en/1.26.x/advanced-usage.html#ssl-warnings\n  warnings.warn(\nTraceback (most recent call last):\n  
File \"/home/rcolinet/.ansible/tmp/ansible-tmp-1697541470.0493464-2047422-262090363652632/AnsiballZ_purefa_vg.py\", line 107, in <module>\n    _ansiballz_main()\n  
File \"/home/rcolinet/.ansible/tmp/ansible-tmp-1697541470.0493464-2047422-262090363652632/AnsiballZ_purefa_vg.py\", line 99, in _ansiballz_main\n    invoke_module(zipped_mod, temp_path, ANSIBALLZ_PARAMS)\n  
File \"/home/rcolinet/.ansible/tmp/ansible-tmp-1697541470.0493464-2047422-262090363652632/AnsiballZ_purefa_vg.py\", line 47, in invoke_module\n    runpy.run_module(mod_name='ansible.modules.purefa_vg', init_globals=dict(_module_fqn='ansible.modules.purefa_vg', _modlib_path=modlib_path),\n  
File \"/usr/lib64/python3.9/runpy.py\", line 225, in run_module\n    return _run_module_code(code, init_globals, run_name, mod_spec)\n  
File \"/usr/lib64/python3.9/runpy.py\", line 97, in _run_module_code\n    _run_code(code, mod_globals, init_globals,\n  
File \"/usr/lib64/python3.9/runpy.py\", line 87, in _run_code\n    exec(code, run_globals)\n  
File \"/tmp/ansible_purefa_vg_payload_pe88dbaf/ansible_purefa_vg_payload.zip/ansible/modules/purefa_vg.py\", line 730, in <module>\n  
File \"/tmp/ansible_purefa_vg_payload_pe88dbaf/ansible_purefa_vg_payload.zip/ansible/modules/purefa_vg.py\", line 720, in main\nAttributeError: 'AnsibleModule' object has no attribute 'array'\n", "module_stdout": "", "msg": "MODULE FAILURE\nSee stdout/stderr for the exact error", "rc": 1}

PLAY RECAP ********************************************************************************************************************************************************************************************************************************************************************
localhost                  : ok=78   changed=2    unreachable=0    failed=1    skipped=7    rescued=0    ignored=0 

Current environment is :

[rcolinet@xxxxxxxxxxxxxxxxxx~]$ ansible-galaxy collection list |grep -i pure purestorage.flasharray 1.21.0

[rcolinet@xxxxxxxxxxxxxxxxxx~]$ ansible --version ansible [core 2.15.0] config file = /etc/ansible/ansible.cfg configured module search path = ['/home/rcolinet/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules'] ansible python module location = /usr/local/lib/python3.9/site-packages/ansible ansible collection location = /home/rcolinet/.ansible/collections:/usr/share/ansible/collections executable location = /usr/local/bin/ansible python version = 3.9.16 (main, May 29 2023, 00:00:00) [GCC 11.3.1 20221121 (Red Hat 11.3.1-4)] (/usr/bin/python) jinja version = 3.1.2 libyaml = True

The playbook looks fine but fails to fetch an attribute in the module.

sdodsley commented 9 months ago

@colinet sorry for the delay - travelling in the Far East. Please retry the patch now

colinet commented 9 months ago

No pb for the delay. I tested the updated patch 480. It works as expected. The rename VG was done with the requested name "{{ rename }}".

So the patch is good for me.

Any hint when this will be available in the collection?

sdodsley commented 9 months ago

I think we are looking ot release a new collection next week, or the week after

colinet commented 9 months ago

Great! Thx !