项目作者: c-snell

项目描述 :
Ansible playbooks to manage HPE 3PAR Storeserv array
高级语言:
项目地址: git://github.com/c-snell/ansible-3par.git
创建时间: 2018-02-03T14:57:10Z
项目社区:https://github.com/c-snell/ansible-3par

开源协议:Apache License 2.0

下载


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.

  1. #Define static variables here
  2. vars: #
  3. rest_api_url_3par: "https://{{ ip_address_3par }}:8080/api/v1"
  4. # auth_3par_user: "3paruser"
  5. # ip_address_3par: "192.168.1.150"
  6. #Run-time variables defined here - Note the
  7. vars_prompt:
  8. - name: "auth_3par_user" #variable name
  9. prompt: "Enter 3par admin user" #prompt text
  10. private: no #input visible at runtime
  11. default: "3paruser" #include if you want default option defined
  12. - name: "auth_3par_password"
  13. prompt: "Enter password"
  14. private: yes #password entry obfuscated at runtime
  15. default: "3parpass"
  16. - name: "ip_address_3par"
  17. prompt: "3PAR Storage System IP address"
  18. private: no
  19. default: "192.168.1.150"
  20. - name: "vol_name"
  21. prompt: "Enter new volume name"
  22. private: no
  23. - name: "cpg_name"
  24. prompt: "Enter CPG name"
  25. private: no
  26. default: "FC_r6"
  27. - name: "size_GiB"
  28. prompt: "Enter Size in GiB"
  29. private: no

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

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

Follow the prompts

  1. Enter 3par admin user: 3paruser
  2. Enter password: 3parpass
  3. 3PAR Storage System IP address: 192.168.1.150
  4. Enter new volume name: my_first_ansible_vol
  5. Enter CPG name [FC_r6]:
  6. Enter Size in GiB: 10
  7. PLAY [New 3par Volume] ******************************************************************************
  8. TASK [Gathering Facts] ******************************************************************************
  9. ok: [localhost]
  10. TASK [check if 3par WSAPI is running] ***************************************************************
  11. ok: [localhost]
  12. TASK [Parsing key] **********************************************************************************
  13. ok: [localhost] => {
  14. "msg": "0-813c20ffd9bc7a4c4af0eec0e3afbdef-b8ed745a"
  15. }
  16. TASK [Create 3par volume] ***************************************************************************
  17. ok: [localhost]
  18. TASK [Parsing Volumes GET] **************************************************************************
  19. ok: [localhost] => {
  20. "msg": {
  21. "cache_control": "no-cache",
  22. "changed": false,
  23. "connection": "close",
  24. "content": "",
  25. "cookies": {},
  26. "date": "Fri, 02 Feb 2018 23:01:13 GMT",
  27. "failed": false,
  28. "location": "https://192.168.1.150:8080/api/v1/volumes/my_first_ansible_vol",
  29. "msg": "OK (unknown bytes)",
  30. "pragma": "no-cache",
  31. "redirected": false,
  32. "server": "hp3par-wsapi",
  33. "status": 201,
  34. "url": "https://192.168.1.150:8080/api/v1/volumes"
  35. }
  36. }
  37. PLAY RECAP ******************************************************************************************
  38. localhost : ok=5 changed=0 unreachable=0 failed=0

Once complete, you have successfully created a volume.