Giter Site home page Giter Site logo

c-snell / ansible-3par Goto Github PK

View Code? Open in Web Editor NEW
4.0 2.0 4.0 32 KB

Ansible playbooks to manage HPE 3PAR Storeserv array

License: Apache License 2.0

ansible ansible-playbook hpe 3par 3par-storage-arrays 3par-sdk wsapi hpe-3par-wsapi volume playbook

ansible-3par's Introduction

Ansible-3par

Ansible-3par is a starter kit which provides simple Ansible playbooks and examples that can be used to write custom playbooks to manage your HPE 3PAR storage arrays. These playbooks use Ansible uri module to communicate via RESTful calls to the HPE 3PAR WSAPI hosted on the 3PAR storage arrays.

Check out the official HPE 3PAR Storage modules for Ansible found here: https://github.com/HewlettPackard/hpe3par_ansible_module

Requirements

  • Ansible >= 2.1
  • Python >= 2.7.9
  • HPE 3PAR WSAPI enabled

Playbooks

Each playbook corresponds to a storage provisioning operation and talks natively with the HPE 3PAR WSAPI using RESTful calls.

Variables

Each playbook contains variables that can be static var or dynamically var_prompt configured. Currently the playbooks take the IP, username and password at runtime but depending on your use case, this can be modified easily by adding variables under the corresponding variable sections.

Note, spaces matter in yaml! Don't use tabs.

Using your favorite text editor, edit the /playbooks/create_3par_volume.yml playbook

Look for the vars and vars_prompt.

#Define static variables here
vars:  #
    rest_api_url_3par: "https://{{ ip_address_3par }}:8080/api/v1"
#   auth_3par_user: "3paruser"
#   ip_address_3par: "192.168.1.150"

#Run-time variables defined here - Note the
vars_prompt:
    - name: "auth_3par_user"            #variable name
      prompt: "Enter 3par admin user"   #prompt text
      private: no                       #input visible at runtime
      default: "3paruser"               #include if you want default option defined

    - name: "auth_3par_password"
      prompt: "Enter password"
      private: yes                      #password entry obfuscated at runtime
      default: "3parpass"

    - name: "ip_address_3par"
      prompt: "3PAR Storage System IP address"
      private: no
      default: "192.168.1.150"

    - name: "vol_name"
      prompt: "Enter new volume name"  
      private: no

    - name: "cpg_name"
      prompt: "Enter CPG name"
      private: no
      default: "FC_r6"

    - name: "size_GiB"
      prompt: "Enter Size in GiB"
      private: no

Example how to create a 3PAR Volume using the /playbooks/create_3par_volume.yml playbook

ansible@ansible-server:~/playbooks/virtual_volume$ ansible-playbook create_3par_volume.yml

Follow the prompts

Enter 3par admin user: 3paruser
Enter password: 3parpass
3PAR Storage System IP address: 192.168.1.150
Enter new volume name: my_first_ansible_vol
Enter CPG name [FC_r6]:
Enter Size in GiB: 10

PLAY [New 3par Volume] ******************************************************************************

TASK [Gathering Facts] ******************************************************************************
ok: [localhost]

TASK [check if 3par WSAPI is running] ***************************************************************
ok: [localhost]

TASK [Parsing key] **********************************************************************************
ok: [localhost] => {
    "msg": "0-813c20ffd9bc7a4c4af0eec0e3afbdef-b8ed745a"
}

TASK [Create 3par volume] ***************************************************************************
ok: [localhost]

TASK [Parsing Volumes GET] **************************************************************************
ok: [localhost] => {
    "msg": {
        "cache_control": "no-cache",
        "changed": false,
        "connection": "close",
        "content": "",
        "cookies": {},
        "date": "Fri, 02 Feb 2018 23:01:13 GMT",
        "failed": false,
        "location": "https://192.168.1.150:8080/api/v1/volumes/my_first_ansible_vol",
        "msg": "OK (unknown bytes)",
        "pragma": "no-cache",
        "redirected": false,
        "server": "hp3par-wsapi",
        "status": 201,
        "url": "https://192.168.1.150:8080/api/v1/volumes"
    }
}

PLAY RECAP ******************************************************************************************
localhost                  : ok=5    changed=0    unreachable=0    failed=0

Once complete, you have successfully created a volume.

ansible-3par's People

Contributors

c-snell avatar

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

ansible-3par's Issues

release auth key

first off, nice collection.

Might I suggest adding auth key release to your playbooks (good api housekeeping :) )

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

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.