Skip to content

Instantly share code, notes, and snippets.

@dmccuk
Last active May 14, 2025 15:29
Show Gist options
  • Save dmccuk/b6e07102d4cec802188a88379b7547f5 to your computer and use it in GitHub Desktop.
Save dmccuk/b6e07102d4cec802188a88379b7547f5 to your computer and use it in GitHub Desktop.
---
- name: Get FlashArray summary info
  hosts: localhost
  gather_facts: false
  tasks:
    - name: Get FlashArray system info
      purestorage.flasharray.purefa_info:
        gather_subset:
          - hardware
          - space
          - arrays
        fa_url: "{{ fa_url }}"
        api_token: "{{ api_token }}"
      register: fa_info

    - name: Show FlashArray summary
      debug:
        msg:
          - "Model: {{ fa_info.purefa_info.hardware[0].model }}"
          - "Chassis Serial: {{ fa_info.purefa_info.hardware[0].serial }}"
          - "Total Capacity: {{ fa_info.purefa_info.space.capacity | int // 1024 // 1024 // 1024 }} GB"
          - "Used Capacity: {{ fa_info.purefa_info.space.total | int // 1024 // 1024 // 1024 }} GB"


    - name: Gather all FlashArray volumes
      purestorage.flasharray.purefa_volume:
        state: list
        fa_url: "{{ fa_url }}"
        api_token: "{{ api_token }}"
      register: volume_info

    - name: Display basic info for each volume
      debug:
        msg: >-
          {% for vol in volume_info.purefa_volumes %}
          Volume: {{ vol.name }}
          Size  : {{ vol.size | int // 1024 // 1024 // 1024 }} GB
          Created: {{ vol.created }}
          Hosts : {{ vol.hosts | default([]) | join(', ') }}
          -----
          {% endfor %}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment