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_pgsnap.pyc

�
�Udac@`s�ddlmZmZmZeZidd6dgd6dd6ZdZd	Zd
Z	ddl
mZddlm
Z
mZdd
lmZd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zedkr�e�ndS(i(tabsolute_importtdivisiontprint_functions1.1tmetadata_versiontpreviewtstatust	communitytsupported_bysa
---
module: purefa_pgsnap
version_added: '2.6'
short_description: Manage protection group snapshots on Pure Storage FlashArrays
description:
- Create or delete protection group snapshots on Pure Storage FlashArray.
- Recovery of replicated snapshots on the replica target array is enabled.
author:
- Pure Storage Ansible Team (@sdodsley) <[email protected]>
options:
  name:
    description:
    - The name of the source protection group.
    type: str
    required: true
  suffix:
    description:
    - Suffix of snapshot name.
  state:
    description:
    - Define whether the protection group snapshot should exist or not.
      Copy (added in 2.7) will create a full read/write clone of the
      snapshot.
    type: str
    choices: [ absent, present, copy ]
    default: present
  eradicate:
    description:
    - Define whether to eradicate the snapshot on delete or leave in trash.
    type: bool
    default: 'no'
  restore:
    description:
    - Restore a specific volume from a protection group snapshot.
    type: str
    version_added: 2.7
  overwrite:
    description:
    - Define whether to overwrite the target volume if it already exists.
    type: bool
    default: 'no'
    version_added: 2.8
  target:
    description:
    - Volume to restore a specified volume to.
    - If not supplied this will default to the volume defined in I(restore)
    type: str
    version_added: 2.8
  now:
    description: Whether to initiate a snapshot of the protection group immediately
    type: bool
    default: False
    version_added: 2.9
  apply_retention:
    description: Apply retention schedule settings to the snapshot
    type: bool
    default: False
    version_added: 2.9
  remote:
    description: Force immeadiate snapshot to remote targets
    type: bool
    default: False
    version_added: 2.9
extends_documentation_fragment:
- purestorage.fa
s
- name: Create protection group snapshot foo.ansible
  purefa_pgsnap:
    name: foo
    suffix: ansible
    fa_url: 10.10.10.2
    api_token: e31060a7-21fc-e277-6240-25983c6c4592
    state: present

- name: Delete and eradicate protection group snapshot named foo.snap
  purefa_pgsnap:
    name: foo
    suffix: snap
    eradicate: true
    fa_url: 10.10.10.2
    api_token: e31060a7-21fc-e277-6240-25983c6c4592
    state: absent

- name: Restore volume data from local protection group snapshot named foo.snap to volume data2
  purefa_pgsnap:
    name: foo
    suffix: snap
    restore: data
    target: data2
    overwrite: true
    fa_url: 10.10.10.2
    api_token: e31060a7-21fc-e277-6240-25983c6c4592
    state: copy

- name: Restore remote protection group snapshot arrayA:pgname.snap.data to local copy
  purefa_pgsnap:
    name: arrayA:pgname
    suffix: snap
    restore: data
    fa_url: 10.10.10.2
    api_token: e31060a7-21fc-e277-6240-25983c6c4592
    state: copy

- name: Create snapshot of existing pgroup foo with suffix and force immeadiate copy to remote targets
  purefa_pgsnap:
    name: pgname
    suffix: force
    now: True
    apply_retention: True
    remote: True
    fa_url: 10.10.10.2
    api_token: e31060a7-21fc-e277-6240-25983c6c4592
    state: copy
t
(t
AnsibleModule(t
get_systemtpurefa_argument_spec(tdatetimecC`s1y|j|jd�SWntk
r,dSXdS(sReturn Protection Group or NonetnameN(t
get_pgrouptparamst	ExceptiontNone(tmoduletarray((sU/usr/lib/python2.7/site-packages/ansible/modules/storage/purestorage/purefa_pgsnap.pyR�s
cC`s_yF|j|jd�}x)|dD]}||jdkr$|Sq$WWntk
rZdSXdS(s&Return Protection Group Volume or NoneR
tvolumestrestoreN(RRRR(RRtpgrouptvolume((sU/usr/lib/python2.7/site-packages/ansible/modules/storage/purestorage/purefa_pgsnap.pytget_pgroupvolume�s
cC`syy`|jdd|jdd|jd}x.|jdt�D]}|d|krA|SqAWWntk
rtdSXdS(s#Return iReplicated Snapshot or NoneR
t.tsuffixRtsnapN(Rtlist_volumestTrueRR(RRtsnapnameR((sU/usr/lib/python2.7/site-packages/ansible/modules/storage/purestorage/purefa_pgsnap.pytget_rpgsnapshot�s+
cC`szya|jdd|jd}x>|j|jddtdt�D]}|d|krB|SqBWWntk
rudSXdS(s+Return Snapshot (active or deleted) or NoneR
RRRtpendingN(RRRRR(RRRR((sU/usr/lib/python2.7/site-packages/ansible/modules/storage/purestorage/purefa_pgsnap.pytget_pgsnapshot�s)
c
C`s	t}|js�y�|jdr�|j|jd�dd
k	r�|jd|jdd|jddtd|jdd|jd	�n7|jd|jdd|jddtd|jd�Wq�tk
r�|jd
dj|jd��q�Xn|j	d|�d
S(s Create Protection Group SnapshottnowR
ttargetstsourceRRtapply_retentiont
replicate_nowtremotetmsgsSnapshot of pgroup {0} failed.tchangedN(
Rt
check_modeRRRtcreate_pgroup_snapshotRt	fail_jsontformatt	exit_json(RRR)((sU/usr/lib/python2.7/site-packages/ansible/modules/storage/purestorage/purefa_pgsnap.pytcreate_pgsnapshot�s 	-



'cC`s6t}|js"d|jdkr]t||�d
kr�|jddj|jd��q�n8t||�d
kr�|jddj|jd��n|jdd|jdd|jd}y(|j||jd	d
|jd
�Wq"t	k
r|jddj||jd��q"Xn|j
d|�d
S(s*Restore a Protection Group Snapshot Volumet:R
R(sDSelected restore snapshot {0} does not exist in the Protection GroupRsBSelected restore volume {0} does not exist in the Protection GroupRRttargett	overwrites%Failed to restore {0} from pgroup {1}R)N(RR*RRRR,R-Rtcopy_volumeRR.(RRR)R((sU/usr/lib/python2.7/site-packages/ansible/modules/storage/purestorage/purefa_pgsnap.pytrestore_pgsnapvolume�s	&#+(
*cC`st}|jd|�dS(s Update Protection Group SnapshotR)N(RR.(RRR)((sU/usr/lib/python2.7/site-packages/ansible/modules/storage/purestorage/purefa_pgsnap.pytupdate_pgsnapshot�scC`s�t}|js�|jdd|jd}y_|j|�|jdr�y|j|�Wq�tk
r�|jddj|��q�XnWq�tk
r�|jddj|��q�Xn|jd|�d	S(
s! Delete Protection Group SnapshotR
RRt	eradicateR(sFailed to eradicate pgroup {0}sFailed to delete pgroup {0}R)N(	RR*Rtdestroy_pgroupteradicate_pgroupRR,R-R.(RRR)R((sU/usr/lib/python2.7/site-packages/ansible/modules/storage/purestorage/purefa_pgsnap.pytdelete_pgsnapshot�s	


$
 cC`s�t�}|jtdtdddt�dtdd�dtdd�dtddd	t�d
tdd�dtddd	t�dtddd	t�d
tddd	t�dtddd	t�dtddd	dddddg��
�ddddgfg}t|d|dt�}|jddkrdtt	j
�t	ddddddd�j��}|jdd�|jd<n|jd
r�|jdr�|jd|jd
<n|jd}t
|�}t||�}|dkr|jddj|jd��nt||�}|dkr3t||�n�|dkrV|rVt||�nj|dkrx|rxt||�nH|dkr�|r�t||�n&|dkr�|r�|jdt�n|jdt�dS(NR
ttypetstrtrequiredRRR2tbooltdefaultR1R6R"R%R'tstatetpresenttchoicestabsenttcopytrequired_iftsupports_check_modessnap-i�iiRtR(s$Protection Group {0} does not exist.R)(RtupdatetdictRtFalseR	RRR;Rtutcnowt
total_secondstreplaceR
RR,R-R!R4R/R5R9R.(t
argument_specRDRRR?RRtpgsnap((sU/usr/lib/python2.7/site-packages/ansible/modules/storage/purestorage/purefa_pgsnap.pytmain�sL	(		8
#t__main__N(t
__future__RRRR:t
__metaclass__tANSIBLE_METADATAt
DOCUMENTATIONtEXAMPLEStRETURNtansible.module_utils.basicR	tansible.module_utils.pureR
RRRRRR!R/R4R5R9ROt__name__(((sU/usr/lib/python2.7/site-packages/ansible/modules/storage/purestorage/purefa_pgsnap.pyt<module>s*


D2									1

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