Enable rest on 3PAR

showwsapi
startwsapi
setwsapi -http enable
setwsapi -https enable

Install Centos 7
Check python version

# python --version

Search for ansible

# yum search ansible

Install ansible

# yum install ansible

Update system

# yum update -y

Check ansible

# which ansible
# ansible --version
# yum install -y open-vm-tools

Install gcc and openssl development


yum install gcc openssl-devel

Install Virtual Environment


# sudo yum install epel-release
sudo yum -y install python-pip pip

sudo pip install virtualenv

yum install virtualenv

Create virtual enviroment

# virtualenv ~/ansible

Install WinRM (Windows Remote Management).

pip install pywinrm

$ cat /etc/ansible/hosts
# This is the default ansible 'hosts' file.
#
# It should live in /etc/ansible/hosts
#
# - Comments begin with the '#' character
# - Blank lines are ignored
# - Groups of hosts are delimited by [header] elements
# - You can enter hostnames or ip addresses
# - A hostname/ip can be a member of multiple groups

# Ex 1: Ungrouped hosts, specify before any group headers.

[3PAR]
192.168.1.100

ansible hpe3par_sdk

pip install hpe3par_sdk

Install Ansible 3PAR Module and Playbooks

 

cd ~/ansible/
git clone https://github.com/HewlettPackard/hpe3par_ansible_module

Get full path of Modules

cd ~/ansible/hpe3par_ansible_module/Modules
pwd
/home/cwilmot/ansible/hpe3par_ansible_module/Modules

Edit /etc/ansible/ansible.cfg

sudo vi /etc/ansible/ansible.cfg
[defaults]
host_key_checking = false
#library        = Modules
library=/home/cwilmot/ansible/hpe3par_ansible_module/Modules
vi ~/ansible/hpe3par_ansible_module/playbooks/demo_playbook.yml
---
- name: Demo 3PAR Ansible playbook
  hosts: 192.168.1.250
  vars:
    volume_name: 'demo_ansible_volume'
    size: 10
    size_unit: 'GiB'
    cpg: 'FC_r1'
    host_name: 'virt-esx01'
    autolun: False
    lunid: 110

  tasks:
    - name: Load Storage System Vars
      include_vars: 'properties/storage_system_properties.yml'
    - name: Create Volume "{{ volume_name }}"
      hpe3par_volume:
        storage_system_ip="{{ storage_system_ip }}"
        storage_system_username="{{ storage_system_username }}"
        storage_system_password="{{ storage_system_password }}"
        state=present
        volume_name="{{ volume_name }}"
        cpg="{{ cpg }}"
        size="{{ size }}"
        size_unit="{{ size_unit }}"

    - name: Create VLUN
      hpe3par_vlun:
        storage_system_ip="{{ storage_system_ip }}"
        storage_system_username="{{ storage_system_username }}"
        storage_system_password="{{ storage_system_password }}"
        state=export_volume_to_host
        volume_name="{{ volume_name }}"
        host_name="{{ host_name }}"
        lunid="{{ lunid }}"
        autolun="{{ autolun }}"

Run your new Ansible script by typing

cd ~/ansible/hpe3par_ansible_module/playbooks
ansible-playbook demo_playbook.yml

Install Modules

yum install python-netaddr
pip install pyvmomi
pip install python-hpilo

Links

HPE Dev 3PAR Ansible

Vmware Ansible

HPE ILO Ansible

Ansible Ilo for each loop

Ansible Ilo

Ansible Oneview

Ansible Brocade

NimbleStorage Ansinimble

Ansible Cisco IOS

VMware Ansible Training

Install AWX on Centos

ESXi Ansible Code

https://github.com/budhac/ansible-3par

GIT Hub SDK Help

Deploy ESXi Lab