Anons79 Mini Shell

Directory : /lib/python2.7/site-packages/ansible/modules/network/f5/
Upload File :
Current File : //lib/python2.7/site-packages/ansible/modules/network/f5/bigip_device_ha_group.pyc

�
�Udac@`s�ddlmZmZmZeZidd6dgd6dd6ZdZd	Zd
Z	ddl
mZddlm
Z
dd
lmZddlmZy�ddlmZddlmZddlmZddlmZddlmZddlmZddlmZddlmZWn�ek
r�ddlmZddlmZddlmZddlmZddlmZddlmZddlmZddlmZnXdefd��YZ de fd��YZ!de fd��YZ"de fd��YZ#de#fd ��YZ$d!e#fd"��YZ%d#e&fd$��YZ'd%e&fd&��YZ(d'e&fd(��YZ)d)�Z*e+d*kr�e*�nd+S(,i(tabsolute_importtdivisiontprint_functions1.1tmetadata_versiontpreviewtstatust	certifiedtsupported_bys�
---
module: bigip_device_ha_group
short_description: Manage HA group settings on a BIG-IP system
description:
  - Manage HA group settings on a BIG-IP system.
version_added: 2.8
options:
  name:
    description:
      - Name of the HA group to create/manage.
    type: str
    required: True
  enable:
    description:
      - When set to C(no) the system disables the ha score feature.
    type: bool
    default: yes
  description:
    description:
      - User created HA group description.
    type: str
  active_bonus:
    description:
      - Specifies the extra value to be added to the active unit's ha score.
      - When system creates HA group this value is set to C(10) by the system.
    type: int
  pools:
    description:
      - Specifies pools to contribute to the ha score.
      - The pools must exist on the BIG-IP otherwise the operation will fail.
    type: list
    suboptions:
      pool_name:
        description:
          - The pool name which is used to contribute to the ha score.
          - Referencing pool can be done in the full path format for example, C(/Common/pool_name).
          - When pool is referenced in full path format, the C(partition) parameter is ignored.
        type: str
        required: True
      attribute:
        description:
          - The pool attribute that contributes to the ha score.
        type: str
        choices:
          - percent-up-members
        default: 'percent-up-members'
      weight:
        description:
          - Maximum value the selected pool attribute contributes to the ha score.
        type: int
        required: True
      minimum_threshold:
        description:
          - Below this value the selected pool attribute contributes nothing to the ha score.
          - This value must be greater than the number of pool members present in the pool.
          - In TMOS versions 12.x this attribute is named C(threshold) however it has been deprecated
            in versions 13.x and above.
          - Specifying this attribute in the module running against v12.x will keep the same behavior
            as if C(threshold) option was set.
        type: int
      partition:
        description:
          - Device partition where the specified pool exists.
          - This parameter is ignored if the C(pool_name) is specified in full path format.
        type: str
        default: Common
  trunks:
    description:
      - Specifies trunks to contribute to the ha score.
      - The trunks must exist on the BIG-IP otherwise the operation will fail.
    type: list
    suboptions:
      trunk_name:
        description:
          - The trunk name which is used to contribute to the ha score.
        type: str
        required: True
      attribute:
        description:
          - The trunk attribute that contributes to the ha score.
        type: str
        choices:
          - percent-up-members
        default: 'percent-up-members'
      weight:
        description:
          - Maximum value the selected trunk attribute contributes to the ha score.
        type: int
        required: True
      minimum_threshold:
        description:
          - Below this value the selected trunk attribute contributes nothing to the ha score.
          - This value must be greater than the number of trunk members.
          - In TMOS versions 12.x this attribute is named C(threshold) however it has been deprecated
            in versions 13.x and above.
          - Specifying this attribute in the module running against v12.x will keep the same behavior
            as if C(threshold) option was set.
        type: int
  state:
    description:
      - When C(present), ensures that the resource exists.
      - When C(absent), ensures the resource is removed.
    type: str
    choices:
      - present
      - absent
    default: present
notes:
  - This module does not support atomic removal of HA group objects.
extends_documentation_fragment: f5
author:
  - Wojciech Wypior (@wojtek0806)
s�
- name: Create HA group no members, not active
  bigip_device_ha_group:
    name: foo_ha
    description: empty_foo
    active_bonus: 20
    enable: no
    provider:
      password: secret
      server: lb.mydomain.com
      user: admin
  delegate_to: localhost

- name: Create HA group with pools and trunks
  bigip_device_ha_group:
    name: baz_ha
    description: non_empty_baz
    active_bonus: 15
    pools:
      - pool_name: foopool
        weight: 30
        minimum_threshold: 1
    trunks:
      - trunk_name: footrunk
        weight: 70
        minimum_threshold: 2
    provider:
      password: secret
      server: lb.mydomain.com
      user: admin
  delegate_to: localhost

- name: Create HA group pools using full_path format
  bigip_device_ha_group:
    name: bar_ha
    description: non_empty_bar
    active_bonus: 12
    pools:
      - pool_name: /Baz/foopool
        weight: 30
        minimum_threshold: 1
    provider:
      password: secret
      server: lb.mydomain.com
      user: admin
  delegate_to: localhost

- name: Remove HA group
  bigip_device_ha_group:
    name: foo_ha
    state: absent
    provider:
      password: secret
      server: lb.mydomain.com
      user: admin
  delegate_to: localhost
s�
name:
  description: Name of the HA group.
  returned: changed
  type: str
  sample: foo_HA
enable:
  description: Enables or disables HA score feature.
  returned: changed
  type: bool
  sample: yes
description:
  description: User created HA group description.
  returned: changed
  type: str
  sample: Some Group
active_bonus:
  description: The extra value to be added to the active unit's ha score.
  returned: changed
  type: int
  sample: 20
pools:
  description: The pools to contribute to the ha score.
  returned: changed
  type: complex
  contains:
    pool_name:
      description: The pool name which is used to contribute to the ha score.
      returned: changed
      type: str
      sample: foo_pool
    attribute:
      description: The pool attribute that contributes to the ha score.
      returned: changed
      type: str
      sample: percent-up-members
    weight:
      description: Maximum value the selected pool attribute contributes to the ha score.
      returned: changed
      type: int
      sample: 40
    minimum_threshold:
      description: Below this value the selected pool attribute contributes nothing to the ha score.
      returned: changed
      type: int
      sample: 2
    partition:
      description: Device partition where the specified pool exists.
      returned: changed
      type: str
      sample: Common
  sample: hash/dictionary of values
trunks:
  description: The trunks to contribute to the ha score.
  returned: changed
  type: complex
  contains:
    trunk_name:
      description: The trunk name which is used to contribute to the ha score.
      returned: changed
      type: str
      sample: foo_trunk
    attribute:
      description: The trunk attribute that contributes to the ha score.
      returned: changed
      type: str
      sample: percent-up-members
    weight:
      description: Maximum value the selected trunk attribute contributes to the ha score.
      returned: changed
      type: int
      sample: 40
    minimum_threshold:
      description: Below this value the selected trunk attribute contributes nothing to the ha score.
      returned: changed
      type: int
      sample: 2
  sample: hash/dictionary of values
(tLooseVersion(t
AnsibleModule(tenv_fallback(t	iteritems(tF5RestClient(t
F5ModuleError(tAnsibleF5Parameters(tfq_name(ttransform_name(tflatten_boolean(tf5_argument_spec(ttmos_versiont
ParameterscB`s`eZidd6ZddddddgZdddddddgZddddddgZRS(tactive_bonustactiveBonustdescriptiontpoolsttrunkstenabledtdisabledtname(t__name__t
__module__tapi_maptapi_attributestreturnablest
updatables(((sT/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_device_ha_group.pyR%s*
		t
ApiParameterscB`s&eZed��Zed��ZRS(cC`s't|jd�}|dkr#tSdS(NRtyes(Rt_valuestTruetNone(tselftresult((sT/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_device_ha_group.pyRHscC`s't|jd�}|dkr#tSdS(NRR$(RR%R&R'(R(R)((sT/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_device_ha_group.pyROs(RRtpropertyRR(((sT/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_device_ha_group.pyR#GstModuleParameterscB`sVeZed��Zed��Zed��Zed��Zd�Zd�ZRS(cC`s't|jd�}|dkr#tSdS(NtenableR$(RR%R&R'(R(R)((sT/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_device_ha_group.pyRXscC`s't|jd�}|dkr#tSdS(NR,tno(RR%R&R'(R(R)((sT/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_device_ha_group.pyR_scC`s�|j�}t�}|jddkr,dSx�|jdD]�}t�}t|d|d�|d<|j|d�|d<d|kr�|d|d<nd|kr�|r�|d|d<q�|d|d	<n|j|j|��q:W|S(
NRt	partitiont	pool_nameRtweightt	attributetminimum_thresholdtminimumThresholdt	threshold(	t_is_v13_and_abovetlistR%R'tdictRt_handle_weighttappendt_filter_params(R(t
version_13R)titemtpool((sT/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_device_ha_group.pyRfs 		cC`s�|j�}t�}|jddkr,dSx�|jdD]�}t�}|d|d<|j|d�|d<d|kr�|d|d<nd|kr�|r�|d|d<q�|d|d<n|j|j|��q:W|S(	NRt
trunk_nameRR0R1R2R3R4(R5R6R%R'R7R8R9R:(R(R;R)R<ttrunk((sT/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_device_ha_group.pyRzs 		cC`s/t|j�}t|�td�kr+tStS(Ns13.0.0(RtclientRR&tFalse(R(tversion((sT/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_device_ha_group.pyR5�scC`s+|dks|dkr'td��n|S(Ni
ids.Weight value must be in the range: '10 - 100'.(R
(R(R0((sT/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_device_ha_group.pyR8�s(	RRR*RRRRR5R8(((sT/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_device_ha_group.pyR+Ws	tChangescB`seZd�ZRS(cC`sXi}y:x$|jD]}t||�||<qW|j|�}Wntk
rSnX|S(N(R!tgetattrR:t	Exception(R(R)t
returnable((sT/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_device_ha_group.pyt	to_return�s
(RRRG(((sT/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_device_ha_group.pyRC�st
UsableChangescB`seZRS((RR(((sT/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_device_ha_group.pyRH�stReportableChangescB`sMeZddddddgZed��Zed��Zed��ZRS(	RR,RRRRcC`sJt|jd�}t|jd�}|dkr6dS|dkrFdSdS(NRRR$R-(RR%R'(R(RR((sT/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_device_ha_group.pyR,�scC`s�t�}|jddkr dSx�|jdD]�}t�}|d|d<|d|d<d|krv|d|d<nd|kr�|d|d<nd|kr�|d|d<n|j|�q.W|S(	NRRR/R0R1R3R2R4(R6R%R'R7R9(R(R)R<R=((sT/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_device_ha_group.pyR�s		cC`s�t�}|jddkr dSx�|jdD]�}t�}|d|d<|d|d<d|krv|d|d<nd|kr�|d|d<nd|kr�|d|d<n|j|�q.W|S(	NRRR>R0R1R3R2R4(R6R%R'R7R9(R(R)R<R?((sT/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_device_ha_group.pyR�s		(RRR!R*R,RR(((sT/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_device_ha_group.pyRI�s	
t
DifferencecB`sVeZdd�Zd�Zd�Zd�Zd�Zed��Z	ed��Z
RS(cC`s||_||_dS(N(twantthave(R(RKRL((sT/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_device_ha_group.pyt__init__�s	cC`s9yt||�}|SWntk
r4|j|�SXdS(N(RDtAttributeErrort_Difference__default(R(tparamR)((sT/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_device_ha_group.pytcompare�s

cC`sQt|j|�}y&t|j|�}||kr7|SWntk
rL|SXdS(N(RDRKRLRN(R(RPtattr1tattr2((sT/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_device_ha_group.pyt	__default�s
cC`s\g}xO|D]G}gt|�D]$\}}t|�t|�f^q }||7}q
W|S(N(Rtstr(R(titemsR)txtktvttmp((sT/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_device_ha_group.pytto_tuple�s

7cC`s�|gkr|dkrdS|dkr,dS|dkr<|S|j|�}|j|�}t|�jt|��rydS|SdS(N(R'R[tsettissubset(R(RKRLtwth((sT/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_device_ha_group.pyt_diff_complex_itemsscC`s"|j|jj|jj�}|S(N(R`RKRRL(R(R)((sT/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_device_ha_group.pyRscC`s"|j|jj|jj�}|S(N(R`RKRRL(R(R)((sT/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_device_ha_group.pyRsN(RRR'RMRQROR[R`R*RR(((sT/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_device_ha_group.pyRJ�s					t
ModuleManagercB`s�eZd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Z	d�Z
d	�Zd
�Zd�Z
d�Zd
�Zd�Zd�ZRS(cO`sg|jdd�|_t|jj�|_td|jjd|j�|_t�|_	t
�|_dS(NtmoduletparamsR@(tgetR'RbRRcR@R+RKR#RLRHtchanges(R(targstkwargs((sT/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_device_ha_group.pyRMs
!cC`sji}xBtjD]7}t|j|�dk	rt|j|�||<qqW|rftd|�|_ndS(NRc(RR!RDRKR'RHRe(R(tchangedtkey((sT/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_device_ha_group.pyt_set_changed_options"scC`s�t|j|j�}tj}t�}xX|D]P}|j|�}|dkrUq.q.t|t�rt|j	|�q.|||<q.W|r�t
d|�|_tSt
S(NRc(RJRKRLRR"R7RQR't
isinstancetupdateRHReR&RA(R(tdiffR"RhRXtchange((sT/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_device_ha_group.pyt_update_changed_options*s		
cC`sK|jdg�}x2|D]*}|jjjd|dd|d�qWdS(Nt
__warningstmsgRB(tpopR@Rbt	deprecate(R(R)twarningstwarning((sT/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_device_ha_group.pyt_announce_deprecations<s


cC`s�t}t�}|jj}|dkr6|j�}n|dkrQ|j�}ntd|jj��}|j�}|j	|�|j	td|��|j
|�|S(NtpresenttabsentRcRh(RAR7RKtstateRwRxRIReRGRlRv(R(RhR)Ryt
reportableRe((sT/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_device_ha_group.pytexec_moduleDs	

cC`s$|j�r|j�S|j�SdS(N(texistsRltcreate(R(((sT/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_device_ha_group.pyRwUs
cC`s|j�r|j�StS(N(R|tremoveRA(R(((sT/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_device_ha_group.pyRx[s
cC`s|j�}|rtStS(N(RoR&RA(R(R)((sT/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_device_ha_group.pyt
should_update`scC`s=|j�|_|j�stS|jjr/tS|j�tS(N(tread_current_from_deviceRLRRARbt
check_modeR&tupdate_on_device(R(((sT/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_device_ha_group.pyRlfs
cC`s9|jjrtS|j�|j�r5td��ntS(NsFailed to delete the resource.(RbR�R&tremove_from_deviceR|R
(R(((sT/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_device_ha_group.pyR~os
cC`s(|j�|jjrtS|j�tS(N(RjRbR�R&tcreate_on_device(R(((sT/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_device_ha_group.pyR}ws


cC`s�dj|jjd|jjd|jj�}|jjj|�}y|j�}Wntk
rht	SX|j
dks�d|kr�|ddkr�t	StS(Ns(https://{0}:{1}/mgmt/tm/sys/ha-group/{2}tservertserver_porti�tcode(tformatR@tproviderRKRtapiRdtjsont
ValueErrorRARR&(R(turitresptresponse((sT/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_device_ha_group.pyR|~s


+cC`s�|jj�}|jj|d<dj|jjd|jjd�}|jjj|d|�}y|j	�}Wn%t
k
r�}tt|���nXd|kr�|dd
kr�d	|kr�t|d	��q�t|j
��ntS(NRs%https://{0}:{1}/mgmt/tm/sys/ha-group/R�R�R�R�i�i�tmessage(i�i�(Ret
api_paramsRKRR�R@R�R�tpostR�R�R
RUtcontentR&(R(RcR�R�R�tex((sT/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_device_ha_group.pyR��s
cC`s�|jj�}dj|jjd|jjd|jj�}|jjj|d|�}y|j	�}Wn%t
k
r�}tt|���nXd|kr�|ddkr�d|kr�t|d��q�t|j
��ndS(Ns(https://{0}:{1}/mgmt/tm/sys/ha-group/{2}R�R�R�R�i�R�(ReR�R�R@R�RKRR�tpatchR�R�R
RUR�(R(RcR�R�R�R�((sT/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_device_ha_group.pyR��s

cC`sjdj|jjd|jjd|jj�}|jjj|�}|jdkrWtSt	|j
��dS(Ns(https://{0}:{1}/mgmt/tm/sys/ha-group/{2}R�R�i�(R�R@R�RKRR�tdeleteRR&R
R�(R(R�R�((sT/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_device_ha_group.pyR��s

cC`s�dj|jjd|jjd|jj�}|jjj|�}y|j�}Wn%tk
r{}t	t
|���nXd|kr�|ddkr�d|kr�t	|d��q�t	|j��ntd|�S(Ns(https://{0}:{1}/mgmt/tm/sys/ha-group/{2}R�R�R�i�R�Rc(
R�R@R�RKRR�RdR�R�R
RUR�R#(R(R�R�R�R�((sT/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_device_ha_group.pyR��s

(RRRMRjRoRvR{RwRxRRlR~R}R|R�R�R�R�(((sT/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_device_ha_group.pyRas 																tArgumentSpeccB`seZd�ZRS(c C`s�t|_tdtdt�dtdddd�dt�d	tdd
�dtddd
ddtdtdt�dtddgdd�dtdtdd
�dtdd
�dtdddtdgf���dtddd
ddtdtdt�dtddgdd�dtdtdd
�dtdd
���dtdddddg��}i|_|jjt�|jj|�dS(NRtrequiredR,ttypetbooltdefaultR$RRtintRR6telementsR7toptionsR/R1tchoicesspercent-up-membersR0R2R.tCommontfallbacktF5_PARTITIONRR>RyRwRx(R&tsupports_check_modeR7R
t
argument_specRlR(R(R�((sT/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_device_ha_group.pyRM�s^															(RRRM(((sT/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_device_ha_group.pyR��scC`s�t�}td|jd|j�}y,td|�}|j�}|j|�Wn)tk
r{}|jdt	|��nXdS(NR�R�RbRq(
R�R	R�R�RaR{t	exit_jsonR
t	fail_jsonRU(tspecRbtmmtresultsR�((sT/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_device_ha_group.pytmains		t__main__N(,t
__future__RRRR�t
__metaclass__tANSIBLE_METADATAt
DOCUMENTATIONtEXAMPLEStRETURNtdistutils.versionRtansible.module_utils.basicR	R
tansible.module_utils.sixRt%library.module_utils.network.f5.bigipRt&library.module_utils.network.f5.commonR
RRRRRt(library.module_utils.network.f5.icontrolRtImportErrort%ansible.module_utils.network.f5.bigipt&ansible.module_utils.network.f5.commont(ansible.module_utils.network.f5.icontrolRR#R+RCRHRItobjectRJRaR�R�R(((sT/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_device_ha_group.pyt<module>sR


s:P
"E95�J	

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