Anons79 Mini Shell

Directory : /lib/python2.7/site-packages/ansible/modules/storage/purestorage/
Upload File :
Current File : //lib/python2.7/site-packages/ansible/modules/storage/purestorage/purefa_offload.pyo

�
�Udac@`s�ddlmZmZmZeZidd6dgd6dd6ZdZd	Zd
Z	ddl
Z
ddlmZdd
l
mZddlmZmZdZe
jd�Zd�Zd�Zd�Zd�Zd�Zedkr�e�ndS(i(tabsolute_importtdivisiontprint_functions1.1tmetadata_versiontpreviewtstatust	communitytsupported_bys
---
module: purefa_offload
version_added: '2.8'
short_description: Create, modify and delete NFS or S3 offload targets
description:
- Create, modify and delete NFS or S3 offload targets.
- Only supported on Purity v5.2.0 or higher.
- You must have a correctly configured offload network for offload to work.
author:
- Pure Storage Ansible Team (@sdodsley) <[email protected]>
options:
  state:
    description:
    - Define state of offload
    default: present
    choices: [ absent, present ]
    type: str
  name:
    description:
    - The name of the offload target
    required: true
    type: str
  protocol:
    description:
    - Define which protocol the offload engine uses
    default: nfs
    choices: [ nfs, s3 ]
    type: str
  address:
    description:
    - The IP or FQDN address of the NFS server
    type: str
  share:
    description:
    - NFS export on the NFS server
    type: str
  options:
    description:
    - Additional mount options for the NFS share
    - Supported mount options include I(port), I(rsize),
      I(wsize), I(nfsvers), and I(tcp) or I(udp)
    required: false
    default: ""
    type: str
  access_key:
    description:
    - Access Key ID of the S3 target
    type: str
  bucket:
    description:
    - Name of the bucket for the S3 target
    type: str
  secret:
    description:
    - Secret Access Key for the S3 target
    type: str
  initialize:
    description:
    - Define whether to initialize the S3 bucket
    type: bool
    default: true

extends_documentation_fragment:
- purestorage.fa
s�
- name: Create NFS offload target
  purefa_offload:
    name: nfs-offload
    protocol: nfs
    address: 10.21.200.4
    share: "/offload_target"
    fa_url: 10.10.10.2
    api_token: e31060a7-21fc-e277-6240-25983c6c4592

- name: Create S3 offload target
  purefa_offload:
    name: s3-offload
    protocol: s3
    access_key: "3794fb12c6204e19195f"
    bucket: offload-bucket
    secret: "wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY"
    fa_url: 10.10.10.2
    api_token: e31060a7-21fc-e277-6240-25983c6c4592

- name: Delete offload target
  purefa_offload:
    name: nfs-offload
    protocol: nfs
    state: absent
    fa_url: 10.10.10.2
    api_token: e31060a7-21fc-e277-6240-25983c6c4592


t
N(tLooseVersion(t
AnsibleModule(t
get_systemtpurefa_argument_specs1.16s^[a-zA-Z0-9\-]*$cC`s1y|j|jd�SWntk
r,dSXdS(sReturn target or NonetnameN(tget_offloadtparamst	ExceptiontNone(tmoduletarray((sV/usr/lib/python2.7/site-packages/ansible/modules/storage/purestorage/purefa_offload.pyt
get_target}s
cC`s�t}y*|jd�ds/|jdd�nWn!tk
rS|jdd�nX|jddkr�yE|j|jdd	|jd
d|jdd|jd
�t}Wq�tk
r�|jddj|jd��q�Xn|jddkryR|j|jdd|jdd|jdd|jdd|jd�t}Wqtk
r{|jddj|jd��qXn|j	d|�dS(sCreate offload targets
@offload.datatenabledtmsgs6Offload Network interface not enabled. Please resolve.sCOffload Network interface not correctly configured. Please resolve.tprotocoltnfsR
tmount_pointtsharetaddresst
mount_optionstoptionssCFailed to create NFS offload {0}. Please perform diagnostic checks.ts3t
access_key_idt
access_keytsecret_access_keytsecrettbuckett
initializesBFailed to create S3 offload {0}. Please perform diagnostic checks.tchangedN(
tFalsetget_network_interfacet	fail_jsonRRtconnect_nfs_offloadtTruetformattconnect_s3_offloadt	exit_json(RRR%((sV/usr/lib/python2.7/site-packages/ansible/modules/storage/purestorage/purefa_offload.pytcreate_offload�s8









cC`st}|jd|�dS(sUpdate offload targetR%N(R&R-(RRR%((sV/usr/lib/python2.7/site-packages/ansible/modules/storage/purestorage/purefa_offload.pytupdate_offload�scC`s�t}|jddkrny|j|jd�t}Wqntk
rj|jddj|jd��qnXn|jddkr�y|j|jd�t}Wq�tk
r�|jddj|jd��q�Xn|jd|�d	S(
sDelete offload targetRRR
Rs!Failed to delete NFS offload {0}.Rs Failed to delete S3 offload {0}.R%N(R&Rtdisconnect_nfs_offloadR*RR(R+R-(RRR%((sV/usr/lib/python2.7/site-packages/ansible/modules/storage/purestorage/purefa_offload.pytdelete_offload�s

'

'cC`s�t�}|jtdtdddddddg�dtdddd	dd	d
g�dtdddt�d
tdtdd�dtdd�dtdddt�dtdd�dtdd�dtdd�dtdddd��
�g}|ddkr1dd	ddgfdd
dddgfg}nt|d|dt�}t|�}|j�}t|kr�|j	ddj
t��ntjd|j
d�s�t|j
d�dkr�|j	dd�n|j
dd
kr+tjd|j
d�st|j
d�dkr+|j	dd �q+n|j�}d!}t}x�td!t|��D]w}||dd"krY||d#r�||d$d%kr�t||d&�td'�kr�t}||d&}Pq�qYqYW|s�|j	dd(�n5t|j�d&�t|�kr"|j	dd)�nt||�}	|j
ddkr�|	r�t|j��}
|
d!kr||j	dd*�nt||�nR|j
ddkr�|	r�t||�n)|j
ddkr�|	r�t||�n|jd+t�dS(,NtstatettypetstrtdefaulttpresenttchoicestabsentRRRR
trequiredR$tboolR R"tno_logR#RRRttrequired_iftsupports_check_modeRsDFlashArray REST version not supported. Minimum version required: {0}s#^[a-zA-Z][a-zA-Z0-9\-]*[a-zA-Z0-9]$i8s�Target name invalid. Target name must be between 1 and 56 characters (alphanumeric and -) in length and begin and end with a letter or number. The name must include at least one letter.s^[a-z0-9][a-z0-9.\-]*[a-z0-9]$i?s�Bucket name invalid. Bucket name must be between 3 and 63 characters (ilowercase, alphanumeric, dash or period) in length and begin and end with a letter or number.itoffloadRRthealthytversions5.2.0s;Correct Offload app not installed or incorrectly configureds>Offload app version must match Purity version. Please upgrade.s-Currently only 1 Offload Target is supported.R%(RtupdatetdictR*R
R&Rt_list_available_rest_versionstMIN_REQUIRED_API_VERSIONR(R+tretmatchRtlent	list_appstrangeR	tgetRtlist_offloadR.R/R1R-(t
argument_specR=RRtapi_versiontappstapp_versiontall_goodtappttargetttarget_count((sV/usr/lib/python2.7/site-packages/ansible/modules/storage/purestorage/purefa_offload.pytmain�sn	!!		
33 "t__main__(t
__future__RRRR3t
__metaclass__tANSIBLE_METADATAt
DOCUMENTATIONtEXAMPLEStRETURNRFtdistutils.versionR	tansible.module_utils.basicR
tansible.module_utils.pureRRREtcompiletREGEX_TARGET_NAMERR.R/R1RUt__name__(((sV/usr/lib/python2.7/site-packages/ansible/modules/storage/purestorage/purefa_offload.pyt<module>s(


C		!			O

Anons79 File Manager Version 1.0, Coded By Anons79
Email: [email protected]