Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Feature Request] Module to get list of Volumes, VolumesSet, CPG, VLUN, Hosts and HostsSet #52

Open
xenlo opened this issue Dec 11, 2018 · 3 comments
Assignees
Labels
enhancement New feature or request

Comments

@xenlo
Copy link

xenlo commented Dec 11, 2018

Summary
It would be helpful to have a module to get the list of 'objects'* with their attributes as facts.

[*] By 'objects' I mean Volumes, VolumesSet, CPG, VLUN, Hosts and HostsSet.

UseCase
One use case could be to wipe a 3par of all existing Volumes before reprovision it.

Current Implementation
The current implementation I found is done via the REST API (Based on the following page as input).

Here is a sample:

---
- name: Delete all Volumes defined on the HPe 3PAR
  hosts: localhost
  gather_facts: no

  vars:
    hpe3par_user: "user"
    hpe3par_ip: "10.0.0.1"
    hpe3par_api_url: "https://{{ hpe3par_ip }}:8080/api/v1"

  vars_prompt:
    - name: "hpe3par_password"
      prompt: "Enter the HPe 3PAR Password"
      private: yes

  tasks:
    - name: Open the REST API session
      uri:
        url: "{{ hpe3par_api_url }}/credentials"
        method: POST
        headers:
          Content-Type: "application/json"
        body_format: json
        body: "{ 'user': '{{ hpe3par_user }}', 'password': '{{ hpe3par_password }}' }"
        status_code: 201
        return_content: yes
        validate_certs: no
      register: output

    - name: Get list of volumes
      uri:
        url: "{{ hpe3par_api_url }}/volumes"
        method: GET
        headers:
          Content-Type: "application/json"
          X-HP3PAR-WSAPI-SessionKey: "{{ output.json.key }}"
          Accept: "application/json"
        status_code: 200
        return_content: yes
        validate_certs: no
      register: volumes

    - name: Show the volumes
      debug:
        var: volumes.json.members | map(attribute='name') | list

    - name: Release authentication key
      uri:
        url: "{{ hpe3par_api_url }}/credentials/{{ output.json.key }}"
        method: DELETE
        headers:
          Content-Type: "application/json"
        validate_certs: no

    - name: Remove Virtual Volume Set
      hpe3par_volumeset:
        storage_system_ip: "{{ hpe3par_ip }}"
        storage_system_username: "{{ hpe3par_user }}"
        storage_system_password: "{{ hpe3par_password }}"
        state: absent
        volumeset_name: "{{ item }}"
      loop: "{{ volumes.json.members | map(attribute='name') | list }}"

@prablr79 prablr79 added the enhancement New feature or request label Dec 13, 2018
@mpunix
Copy link

mpunix commented Dec 9, 2019

Any progress on the module to get the list of 'objects'* with their attributes as facts? we are looking similar ones. It helps to automate our storage provisioning.

@xenlo
Copy link
Author

xenlo commented Dec 11, 2019

AFAIK none.

@apol76
Copy link

apol76 commented Mar 16, 2022

this would help on our side as well. Getting infos from an array is a strict requirement in our setup when using ansible to touch arrays that are (or were) managed manually - just to avoid collisions in names etc. due to errors made previously. So we're actually not using the ansible modules, but use ansible to start scripts written in scripting languages (with support for getting data :-) )

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

5 participants