�
�Udac @` s� d d l m Z m Z m Z e Z i d d 6d g d 6d d 6Z d Z d Z d
Z d d l
m Z d d l m
Z
m Z d
Z d � Z d � Z d � Z d � Z d � Z d � Z d � Z d � Z d � Z d � Z d � Z e d k r� e � n d S( i ( t absolute_importt divisiont print_functions 1.1t metadata_versiont previewt statust communityt supported_bys
---
module: purefa_pg
version_added: '2.4'
short_description: Manage protection groups on Pure Storage FlashArrays
description:
- Create, delete or modify protection groups on Pure Storage FlashArrays.
- If a protection group exists and you try to add non-valid types, eg. a host
to a volume protection group the module will ignore the invalid types.
- Protection Groups on Offload targets are supported.
author:
- Pure Storage Ansible Team (@sdodsley) <[email protected]>
options:
pgroup:
description:
- The name of the protection group.
type: str
required: true
state:
description:
- Define whether the protection group should exist or not.
type: str
default: present
choices: [ absent, present ]
volume:
description:
- List of existing volumes to add to protection group.
type: list
host:
description:
- List of existing hosts to add to protection group.
type: list
hostgroup:
description:
- List of existing hostgroups to add to protection group.
type: list
eradicate:
description:
- Define whether to eradicate the protection group on delete and leave in trash.
type : bool
default: 'no'
enabled:
description:
- Define whether to enabled snapshots for the protection group.
type : bool
default: 'yes'
target:
description:
- List of remote arrays or offload target for replication protection group
to connect to.
- Note that all replicated protection groups are asynchronous.
- Target arrays or offload targets must already be connected to the source array.
- Maximum number of targets per Protection Group is 4, assuming your
configuration supports this.
type: list
version_added: '2.8'
extends_documentation_fragment:
- purestorage.fa
s�
- name: Create new local protection group
purefa_pg:
pgroup: foo
fa_url: 10.10.10.2
api_token: e31060a7-21fc-e277-6240-25983c6c4592
- name: Create new replicated protection group
purefa_pg:
pgroup: foo
target:
- arrayb
- arrayc
fa_url: 10.10.10.2
api_token: e31060a7-21fc-e277-6240-25983c6c4592
- name: Create new replicated protection group to offload target and remote array
purefa_pg:
pgroup: foo
target:
- offload
- arrayc
fa_url: 10.10.10.2
api_token: e31060a7-21fc-e277-6240-25983c6c4592
- name: Create new protection group with snapshots disabled
purefa_pg:
pgroup: foo
enabled: false
fa_url: 10.10.10.2
api_token: e31060a7-21fc-e277-6240-25983c6c4592
- name: Delete protection group
purefa_pg:
pgroup: foo
eradicate: true
fa_url: 10.10.10.2
api_token: e31060a7-21fc-e277-6240-25983c6c4592
state: absent
- name: Eradicate protection group foo on offload target where source array is arrayA
purefa_pg:
pgroup: "arrayA:foo"
target: offload
eradicate: true
fa_url: 10.10.10.2
api_token: e31060a7-21fc-e277-6240-25983c6c4592
state: absent
- name: Create protection group for hostgroups
purefa_pg:
pgroup: bar
hostgroup:
- hg1
- hg2
fa_url: 10.10.10.2
api_token: e31060a7-21fc-e277-6240-25983c6c4592
- name: Create protection group for hosts
purefa_pg:
pgroup: bar
host:
- host1
- host2
fa_url: 10.10.10.2
api_token: e31060a7-21fc-e277-6240-25983c6c4592
- name: Create replicated protection group for volumes
purefa_pg:
pgroup: bar
volume:
- vol1
- vol2
target: arrayb
fa_url: 10.10.10.2
api_token: e31060a7-21fc-e277-6240-25983c6c4592
t
( t
AnsibleModule( t
get_systemt purefa_argument_specs 1.16c C` s{ g } y | j � } Wn t k
r* d SXxI t d t | � � D]2 } | | d d k rA | j | | d � qA qA W| S( s Get Offload Targetsi R t connectedt nameN( t list_offloadt Exceptiont Nonet ranget lent append( t arrayt targetst target_detailst targetcnt( ( sQ /usr/lib/python2.7/site-packages/ansible/modules/storage/purestorage/purefa_pg.pyt get_targets� s
c C` s\ g } | j � } xC t d t | � � D], } | | d r( | j | | d � q( q( W| S( s Get Connected Arraysi R t
array_name( t list_array_connectionsR R R ( R t arrayst
array_detailst arraycnt( ( sQ /usr/lib/python2.7/site-packages/ansible/modules/storage/purestorage/purefa_pg.pyt
get_arrays� s c C` s� d } d | j d k rj x� | j d t d d � D]1 } | d | j d k r2 | d r2 | } Pq2 q2 WnH xE | j d t � D]1 } | d | j d k r} | d r} | } Pq} q} W| S( s Get Protection Groupt :t pgroupt pendingt ont *R
t time_remainingN( R t paramst list_pgroupst True( t moduleR R t pgrp( ( sQ /usr/lib/python2.7/site-packages/ansible/modules/storage/purestorage/purefa_pg.pyt get_pending_pgroup� s !!c C` s� d } d | j d k rZ xv | j d d � D]'