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

�
�Udac@`sSddlmZmZmZeZidd6dgd6dd6ZdZd	Zd
Z	ddl
mZddl
mZytdd
l
mZddlmZddlmZddlmZddlmZddlmZddlmZWn�ek
ridd
lmZddlmZddlmZddlmZddlmZddlmZddlmZnXdefd��YZdefd��YZdefd��YZdefd��YZdefd��YZdefd��YZd efd!��YZ d"efd#��YZ!d$efd%��YZ"d&�Z#e$d'krOe#�nd(S()i(tabsolute_importtdivisiontprint_functions1.1tmetadata_versiontpreviewtstatust	certifiedtsupported_bysS
---
module: bigip_device_traffic_group
short_description: Manages traffic groups on BIG-IP
description:
  - Supports managing traffic groups and their attributes on a BIG-IP.
version_added: 2.5
options:
  name:
    description:
      - The name of the traffic group.
    type: str
    required: True
  mac_address:
    description:
      - Specifies the floating Media Access Control (MAC) address associated with the floating IP addresses
        defined for a traffic group.
      - Primarily, a MAC masquerade address minimizes ARP communications or dropped packets as a result of failover.
      - A MAC masquerade address ensures that any traffic destined for a specific traffic group reaches an available
        device after failover, which happens because along with the traffic group, the MAC masquerade address floats
        to the available device.
      - Without a MAC masquerade address, the sending host must learn the MAC address for a newly-active device,
        either by sending an ARP request or by relying on the gratuitous ARP from the newly-active device.
      - To unset the MAC address, specify an empty value (C("")) to this parameter.
    type: str
    version_added: 2.6
  ha_order:
    description:
      - Specifies order in which you would like to assign devices for failover.
      - If you configure this setting, you must configure the setting on every traffic group in the device group.
      - The values should be device names of the devices that belong to the failover group configured beforehand.
      - The order in which the devices are placed as arguments to this parameter, determines their HA order
        on the device, in other words changing the order of the same elements will cause a change on the unit.
      - To disable an HA order failover method , specify an empty string value (C("")) to this parameter.
      - Disabling HA order will revert the device back to using Load Aware method as it is the default,
        unless C(ha_group) setting is also configured.
      - Device names will be prepended by a partition by the module, so you can provide either the full path format
        name C(/Common/bigip1) or just the name string C(bigip1).
    type: list
    version_added: 2.8
  ha_group:
    description:
      - Specifies a configured C(HA group) to be associated with the traffic group.
      - Once you create an HA group on a device and associate the HA group with a traffic group,
        you must create an HA group and associate it with that same traffic group on every device in the device group.
      - To disable an HA group failover method , specify an empty string value (C("")) to this parameter.
      - Disabling HA group will revert the device back to using C(Load Aware) method as it is the default,
        unless C(ha_order) setting is also configured.
      - The C(auto_failback) and C(auto_failback_time) are not compatible with C(ha_group).
    type: str
    version_added: 2.8
  ha_load_factor:
    description:
      - The value of the load the traffic-group presents the system relative to other traffic groups.
      - This parameter only takes effect when C(Load Aware) failover method is in use.
      - The correct value range is C(1 - 1000) inclusive.
    type: int
    version_added: 2.8
  auto_failback:
    description:
      - Specifies whether the traffic group fails back to the initial device specified in C(ha_order).
    type: bool
    version_added: 2.8
  auto_failback_time:
    description:
      - Specifies the number of seconds the system delays before failing back to the initial device
        specified in C(ha_order).
      - The correct value range is C(0 - 300) inclusive.
    type: int
    version_added: 2.8
  partition:
    description:
      - Device partition to manage resources on.
    type: str
    default: Common
  state:
    description:
      - When C(present), ensures that the traffic group exists.
      - When C(absent), ensures the traffic group is removed.
    type: str
    choices:
      - present
      - absent
    default: present
extends_documentation_fragment: f5
author:
  - Tim Rupp (@caphrim007)
  - Wojciech Wypior (@wojtek0806)
s
- name: Create a traffic group
  bigip_device_traffic_group:
    name: foo1
    state: present
    provider:
      user: admin
      password: secret
      server: lb.mydomain.com
  delegate_to: localhost

- name: Create a traffic group with ha_group failover
  bigip_device_traffic_group:
    name: foo2
    state: present
    ha_group: foo_HA_grp
    provider:
      user: admin
      password: secret
      server: lb.mydomain.com
  delegate_to: localhost

- name: Create a traffic group with ha_order failover
  bigip_device_traffic_group:
    name: foo3
    state: present
    ha_order:
      - /Common/bigip1.lab.local
      - /Common/bigip2.lab.local
    auto_failback: yes
    auto_failback_time: 40
    provider:
      user: admin
      password: secret
      server: lb.mydomain.com
  delegate_to: localhost

- name: Change traffic group ha_order to ha_group
  bigip_device_traffic_group:
    name: foo3
    state: present
    ha_group: foo_HA_grp
    ha_order: ""
    auto_failback: no
    provider:
      user: admin
      password: secret
      server: lb.mydomain.com
  delegate_to: localhost

- name: Remove traffic group
  bigip_device_traffic_group:
    name: foo
    state: absent
    provider:
      user: admin
      password: secret
      server: lb.mydomain.com
  delegate_to: localhost
s�
mac_address:
  description: The MAC masquerade address
  returned: changed
  type: str
  sample: "02:01:d7:93:35:08"
ha_group:
  description: The configured HA group associated with traffic group
  returned: changed
  type: str
  sample: foo_HA_grp
ha_order:
  description: Specifies the order in which the devices will failover
  returned: changed
  type: list
  sample: ['/Common/bigip1', '/Common/bigip2']
ha_load_factor:
  description: The value of the load the traffic-group presents the system relative to other traffic groups
  returned: changed
  type: int
  sample: 20
auto_failback:
  description: Specifies whether the traffic group fails back to the initial device specified in ha_order
  returned: changed
  type: bool
  sample: yes
auto_failback_time:
  description: Specifies the number of seconds the system delays before failing back
  returned: changed
  type: int
  sample: 60
(t
AnsibleModule(tenv_fallback(tF5RestClient(t
F5ModuleError(tAnsibleF5Parameters(tf5_argument_spec(tfq_name(ttransform_name(tflatten_booleant
ParameterscB`s�eZidd6dd6dd6dd6dd	6d
d6Zddddd	dgZdddddd
gZdddddd
gZRS(tmac_addresstmactha_groupthaGrouptha_orderthaOrdertha_load_factorthaLoadFactortauto_failback_timetautoFailbackTimet
auto_failbacktautoFailbackEnabled(t__name__t
__module__tapi_maptapi_attributestreturnablest
updatables(((sY/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_device_traffic_group.pyR�s2
		t
ApiParameterscB`seZRS((RR(((sY/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_device_traffic_group.pyR$stModuleParameterscB`sbeZed��Zed��Zed��Zed��Zed��Zed��ZRS(cC`s9|jddkrdS|jddkr.dS|jdS(NRttnone(t_valuestNone(tself((sY/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_device_traffic_group.pyRs
cC`sW|jddkrdS|jddkr.dS|jdkrLtd��n|jdS(NRR&R'ttrues?The auto_failback cannot be enabled when ha_group is specified.(R(R)RR(R*((sY/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_device_traffic_group.pyRscC`sX|jddkrdS|jd}|dks<|dkrTtdj|���n|S(NRii�sNInvalid ha_load_factor value, correct range is 1 - 1000, specified value: {0}.(R(R)Rtformat(R*tvalue((sY/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_device_traffic_group.pyRs
cC`sX|jddkrdS|jd}|dks<|dkrTtdj|���n|S(NRii,sQInvalid auto_failback_time value, correct range is 0 - 300, specified value: {0}.(R(R)RR,(R*R-((sY/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_device_traffic_group.pyR&s
cC`s7t|jd�}|dkr#dS|dkr3dSdS(NRtyesR+tnotfalse(RR(R)(R*tresult((sY/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_device_traffic_group.pyR0scC`s�|jddkrdSt|jd�dkri|jdddkri|jdkretd��ndSg|jdD]}t|j|�^qw}|S(NRiiR&R+s_Cannot enable auto failback when HA order list is empty, at least one device must be specified.R'(R(R)tlenRRRt	partition(R*R-R1((sY/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_device_traffic_group.pyR9s0,(	RRtpropertyRRRRRR(((sY/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_device_traffic_group.pyR%s

	tChangescB`seZd�ZRS(cC`s@i}x$|jD]}t||�||<qW|j|�}|S(N(R"tgetattrt_filter_params(R*R1t
returnable((sY/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_device_traffic_group.pyt	to_returnHs
(RRR9(((sY/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_device_traffic_group.pyR5Gst
UsableChangescB`seZRS((RR(((sY/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_device_traffic_group.pyR:PstReportableChangescB`sDeZed��Zed��Zed��Zed��ZRS(cC`s9|jddkrdS|jddkr.dS|jdS(NRR'R&(R(R)(R*((sY/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_device_traffic_group.pyRVs
cC`s9|jddkrdS|jddkr.dS|jdS(NRR'R&(R(R)(R*((sY/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_device_traffic_group.pyR^s
cC`s1|jd}|dkrdS|dkr-dSdS(NRR+R.R0R/(R(R)(R*R1((sY/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_device_traffic_group.pyRfs
cC`s9|jddkrdS|jddkr.dS|jdS(NRR'R&(R(R)(R*((sY/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_device_traffic_group.pyRos
(RRR4RRRR(((sY/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_device_traffic_group.pyR;Ts	t
DifferencecB`sSeZdd�Zd�Zd�Zed��Zed��Zed��Z	RS(cC`s||_||_dS(N(twantthave(R*R=R>((sY/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_device_traffic_group.pyt__init__ys	cC`s9yt||�}|SWntk
r4|j|�SXdS(N(R6tAttributeErrort_Difference__default(R*tparamR1((sY/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_device_traffic_group.pytcompare}s

cC`sQt|j|�}y&t|j|�}||kr7|SWntk
rL|SXdS(N(R6R=R>R@(R*RBtattr1tattr2((sY/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_device_traffic_group.pyt	__default�s
cC`s�|jjdkrdS|jjdkr>|jjdkr>dS|jj|jjkr�|jjdkr�|jjdkr�td��n|jjSdS(NR'R+R0sXThe auto_failback parameter on the device must disabled to use ha_group failover method.(R=RR)R>RR(R*((sY/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_device_traffic_group.pyR�s$$cC`sd|jjdkrdS|jjdkr>|jjdkr>dS|jj|jjkr`|jjSdS(NR'(R=RR)R>(R*((sY/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_device_traffic_group.pyR�s$cC`std��dS(NsIPartition cannot be changed for a traffic group. Only /Common is allowed.(R(R*((sY/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_device_traffic_group.pyR3�sN(
RRR)R?RCRAR4RRR3(((sY/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_device_traffic_group.pyR<xs			
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`s[|jdd�|_t|jj�|_d|_td|jj�|_t	�|_
dS(Ntmoduletparams(tgetR)RHR
RItclientR>R%R=R:tchanges(R*targstkwargs((sY/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_device_traffic_group.pyR?�s
	cC`sji}xBtjD]7}t|j|�dk	rt|j|�||<qqW|rftd|�|_ndS(NRI(RR"R6R=R)R:RL(R*tchangedtkey((sY/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_device_traffic_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(NRI(R<R=R>RR#tdictRCR)t
isinstancetupdateR:RLtTruetFalse(R*tdiffR#ROtktchange((sY/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_device_traffic_group.pyt_update_changed_options�s		
cC`sH|jdg�}x/|D]'}|jjd|dd|d�qWdS(Nt
__warningstmsgtversion(tpopRHt	deprecate(R*R1twarningstwarning((sY/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_device_traffic_group.pyt_announce_deprecations�s


cC`s�t}t�}|jj}|dkr6|j�}n|dkrQ|j�}ntd|jj��}|j�}|j	|�|j	td|��|j
|�|S(NtpresenttabsentRIRO(RVRRR=tstateRcRdR;RLR9RTRb(R*ROR1Ret
reportableRL((sY/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_device_traffic_group.pytexec_module�s	

cC`s$|j�r|j�S|j�SdS(N(texistsRTtcreate(R*((sY/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_device_traffic_group.pyRc�s
cC`s|j�r|j�StS(N(RhtremoveRV(R*((sY/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_device_traffic_group.pyRd�s
cC`s|j�}|rtStS(N(RZRURV(R*R1((sY/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_device_traffic_group.pyt
should_update�scC`s=|j�|_|j�stS|jjr/tS|j�tS(N(tread_current_from_deviceR>RkRVRHt
check_modeRUtupdate_on_device(R*((sY/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_device_traffic_group.pyRT�s
cC`s9|jjrtS|j�|j�r5td��ntS(NsFailed to delete the resource.(RHRmRUtremove_from_deviceRhR(R*((sY/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_device_traffic_group.pyRjs
cC`sX|j�|jjj�jd�dkr:td��n|jjrJtS|j	�tS(Nt/tcommons;Traffic groups can only be created in the /Common partition(
RQR=R3tlowertstripRRHRmRUtcreate_on_device(R*((sY/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_device_traffic_group.pyRi
s
!
cC`s�dj|jjd|jjdt|jj|jj��}|jjj|�}y|j	�}Wnt
k
rwtSX|jdks�d|kr�|ddkr�tSt
S(Ns,https://{0}:{1}/mgmt/tm/cm/traffic-group/{2}tservertserver_porti�tcode(R,RKtproviderRR=R3tnametapiRJtjsont
ValueErrorRVRRU(R*turitresptresponse((sY/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_device_traffic_group.pyRhs


+cC`s�|jj�}|jj|d<|jj|d<dj|jjd|jjd�}|jjj	|d|�}y|j
�}Wn%tk
r�}tt
|���nXd|kr�|ddkr�d
|kr�t|d
��q�t|j��n|dS(
NRyR3s)https://{0}:{1}/mgmt/tm/cm/traffic-group/RuRvR{Rwi�i�tmessagetselfLink(i�i�(RLt
api_paramsR=RyR3R,RKRxRztpostR{R|Rtstrtcontent(R*RIR}R~Rtex((sY/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_device_traffic_group.pyRt$s 
cC`s�|jj�}dj|jjd|jjdt|jj|jj��}|jj	j
|d|�}y|j�}Wn%tk
r�}t
t|���nXd|kr�|ddkr�d|kr�t
|d��q�t
|j��ndS(Ns,https://{0}:{1}/mgmt/tm/cm/traffic-group/{2}RuRvR{Rwi�R�(RLR�R,RKRxRR=R3RyRztpatchR{R|RR�R�(R*RIR}R~RR�((sY/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_device_traffic_group.pyRn9s

cC`s�dj|jjd|jjdt|jj|jj��}|jjj|�}y|j	�}Wn%t
k
r�}tt|���nXd|kr�|ddkr�d|kr�t|d��q�t|j
��ntd|�S(Ns,https://{0}:{1}/mgmt/tm/cm/traffic-group/{2}RuRvRwi�R�RI(R,RKRxRR=R3RyRzRJR{R|RR�R�R$(R*R}R~RR�((sY/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_device_traffic_group.pyRlLs

cC`sydj|jjd|jjdt|jj|jj��}|jjj|�}|j	dkrft
St|j��dS(Ns,https://{0}:{1}/mgmt/tm/cm/traffic-group/{2}RuRvi�(
R,RKRxRR=R3RyRztdeleteRRURR�(R*R}R((sY/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_device_traffic_group.pyRoas

(RRR?RQRZRbRgRcRdRkRTRjRiRhRtRnRlRo(((sY/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_device_traffic_group.pyRG�s 																tArgumentSpeccB`seZd�ZRS(cC`s�t|_tdtdt�dt�dtdd�dt�dtdd	�d
tdd�dtdd	�d
tdddddg�dtdddtdgf��	}i|_|jjt�|jj|�dS(NRytrequiredRRttypetlistRRtintRtboolRRetdefaultRctchoicesRdR3tCommontfallbacktF5_PARTITION(RUtsupports_check_modeRRR	t
argument_specRTR
(R*R�((sY/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_device_traffic_group.pyR?ns,								(RRR?(((sY/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_device_traffic_group.pyR�mscC`s�t�}td|jd|j�}y,td|�}|j�}|j|�Wn)tk
r{}|jdt	|��nXdS(NR�R�RHR\(
R�RR�R�RGRgt	exit_jsonRt	fail_jsonR�(tspecRHtmmtresultsR�((sY/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_device_traffic_group.pytmain�s		t__main__N(%t
__future__RRRR�t
__metaclass__tANSIBLE_METADATAt
DOCUMENTATIONtEXAMPLEStRETURNtansible.module_utils.basicRR	t%library.module_utils.network.f5.bigipR
t&library.module_utils.network.f5.commonRRR
RRRtImportErrort%ansible.module_utils.network.f5.bigipt&ansible.module_utils.network.f5.commonRR$R%R5R:R;tobjectR<RGR�R�R(((sY/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_device_traffic_group.pyt<module>sJ


Z=!
'@	$5�"	

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