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/bigiq_application_http.pyo

�
�Udac@`s?ddlmZmZmZeZidd6dgd6dd6ZdZd	Zd
Z	ddl
Z
ddlmZdd
l
mZydddlmZddlmZddlmZddlmZddlmZddlmZWnqek
rUddlmZddlmZddlmZddlmZddlmZddlmZnXdefd��YZdefd��YZdefd��YZ defd��YZ!de!fd��YZ"de!fd��YZ#d e$fd!��YZ%d"e$fd#��YZ&d$e$fd%��YZ'd&�Z(e)d'kr;e(�ndS((i(tabsolute_importtdivisiontprint_functions1.1tmetadata_versiontpreviewtstatust	certifiedtsupported_bys
---
module: bigiq_application_http
short_description: Manages BIG-IQ HTTP applications
description:
  - Manages BIG-IQ applications used for load balancing an HTTP application on
    port 80 on BIG-IP.
version_added: 2.6
options:
  name:
    description:
      - Name of the new application.
    type: str
    required: True
  description:
    description:
      - Description of the application.
    type: str
  servers:
    description:
      - A list of servers that the application is hosted on.
      - If you are familiar with other BIG-IP setting, you might also refer to this
        list as the list of pool members.
      - When creating a new application, at least one server is required.
    suboptions:
      address:
        description:
          - The IP address of the server.
        type: str
        required: True
      port:
        description:
          - The port of the server.
          - When creating a new application and specifying a server, if this parameter
            is not provided, the default of C(80) will be used.
        type: str
        default: 80
    type: list
  inbound_virtual:
    description:
      - Settings to configure the virtual which will receive the inbound connection.
      - This virtual will be used to host the HTTP endpoint of the application.
    suboptions:
      address:
        description:
          - Specifies destination IP address information to which the virtual server
            sends traffic.
          - This parameter is required when creating a new application.
        type: str
        required: True
      netmask:
        description:
          - Specifies the netmask to associate with the given C(destination).
          - This parameter is required when creating a new application.
        type: str
        required: True
      port:
        description:
          - The port that the virtual listens for connections on.
          - When creating a new application, if this parameter is not specified, the
            default value of C(80) will be used.
        type: str
        default: 80
    type: dict
  service_environment:
    description:
      - Specifies the name of service environment that the application will be
        deployed to.
      - When creating a new application, this parameter is required.
      - The service environment type will be discovered by this module automatically.
        Therefore, it is crucial that you maintain unique names for items in the
        different service environment types (at this time, SSGs and BIGIPs).
    type: str
  add_analytics:
    description:
      - Collects statistics of the BIG-IP that the application is deployed to.
      - This parameter is only relevant when specifying a C(service_environment) which
        is a BIG-IP; not an SSG.
    type: bool
    default: no
  state:
    description:
      - The state of the resource on the system.
      - When C(present), guarantees that the resource exists with the provided attributes.
      - When C(absent), removes the resource from the system.
    type: str
    choices:
      - absent
      - present
    default: present
  wait:
    description:
      - If the module should wait for the application to be created, deleted or updated.
    type: bool
    default: yes
extends_documentation_fragment: f5
notes:
  - This module does not support updating of your application (whether deployed or not).
    If you need to update the application, the recommended practice is to remove and
    re-create.
  - This module will not work on BIGIQ version 6.1.x or greater.
author:
  - Tim Rupp (@caphrim007)
s
- name: Load balance an HTTP application on port 80 on BIG-IP
  bigiq_application_http:
    name: my-app
    description: Redirect HTTP to HTTPS
    service_environment: my-ssg
    servers:
      - address: 1.2.3.4
        port: 8080
      - address: 5.6.7.8
        port: 8080
    inbound_virtual:
      name: foo
      address: 2.2.2.2
      netmask: 255.255.255.255
      port: 443
    provider:
      password: secret
      server: lb.mydomain.com
      user: admin
    state: present
  delegate_to: localhost
sd
description:
  description: The new description of the application of the resource.
  returned: changed
  type: str
  sample: My application
service_environment:
  description: The environment which the service was deployed to.
  returned: changed
  type: str
  sample: my-ssg1
inbound_virtual_destination:
  description: The destination of the virtual that was created.
  returned: changed
  type: str
  sample: 6.7.8.9
inbound_virtual_netmask:
  description: The network mask of the provided inbound destination.
  returned: changed
  type: str
  sample: 255.255.255.0
inbound_virtual_port:
  description: The port the inbound virtual address listens on.
  returned: changed
  type: int
  sample: 80
servers:
  description: List of servers, and their ports, that make up the application.
  type: complex
  returned: changed
  contains:
    address:
      description: The IP address of the server.
      returned: changed
      type: str
      sample: 2.3.4.5
    port:
      description: The port that the server listens on.
      returned: changed
      type: int
      sample: 8080
  sample: hash/dictionary of values
N(tLooseVersion(t
AnsibleModule(tF5RestClient(t
F5ModuleError(tAnsibleF5Parameters(tf5_argument_spec(tis_valid_ip(t
bigiq_versiont
Parametersc
B`s�eZidd6dd6dd6dd6dd	6d
d6Zdd
ddddd	dgZdd
dddddddd
g
Zdd
ddddddd
g	ZRS(ttemplate_referencettemplateReferencetsub_pathtsubPatht
ssg_referencetssgReferencetconfig_set_namet
configSetNametdefault_device_referencetdefaultDeviceReferencet
add_analyticstaddAnalyticst	resourcestdescriptiontserverstinbound_virtual(t__name__t
__module__tapi_maptapi_attributestreturnablest
updatables(((sU/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigiq_application_http.pyR�s
	t
ApiParameterscB`seZRS((R!R"(((sU/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigiq_application_http.pyR'�stModuleParameterscB`sbeZed��Zed��Zed��Zed��Zed��Zed��ZRS(cC`sdS(Ntprofile_http((tself((sU/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigiq_application_http.pythttp_profile�scC`s|jS(N(tname(R*((sU/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigiq_application_http.pyR�scC`s|jS(N(R,(R*((sU/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigiq_application_http.pyR�scC`sd}dj|jjd|jjd|�}|jjj|�}y|j�}Wn%tk
r{}tt|���nX|j	dkr�|ddkr�td��nMd	|kr�|d	d
kr�d|kr�t|d��q�t|j
��ntd|d
dd�}|S(Ns%name+eq+'Default-f5-HTTP-lb-template'sMhttps://{0}:{1}/mgmt/cm/global/templates/?$filter={2}&$top=1&$select=selfLinktservertserver_porti�t
totalItemsis&No default HTTP LB template was found.tcodei�tmessagetlinktitemstselfLink(tformattclienttprovidertapitgettjsont
ValueErrorRtstrRt_contenttdict(R*tfilterturitresptresponsetextresult((sU/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigiq_application_http.pyR�s(

	cC`s;t|j�r$dj|j�}ndj|j�}dj|jjd|jjd|�}|jjj|�}y|j�}Wn%tk
r�}t	t
|���nX|jdkr�|ddkr�dSd	|kr|d	d
krd|kr
t	|d��qt	|j
��ntd|d
dd�}|S(Nsaddress+eq+'{0}'shostname+eq+'{0}'szhttps://{0}:{1}/mgmt/shared/resolver/device-groups/cm-adccore-allbigipDevices/devices/?$filter={2}&$top=1&$select=selfLinkR-R.i�R/iR0i�R1R2R3R4(Rtservice_environmentR5R6R7R8R9R:R;RR<RtNoneR=R>(R*R?R@RARBRCRD((sU/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigiq_application_http.pyRs*

	cC`sdj|j�}dj|jjd|jjd|�}|jjj|�}y|j�}Wn%tk
r�}tt	|���nX|j
dkr�|ddkr�dSd|kr�|dd	kr�d
|kr�t|d
��q�t|j��nt
d|ddd
�}|S(Ns
name+eq+'{0}'sYhttps://{0}:{1}/mgmt/cm/cloud/service-scaling-groups/?$filter={2}&$top=1&$select=selfLinkR-R.i�R/iR0i�R1R2R3R4(R5RER6R7R8R9R:R;RR<RRFR=R>(R*R?R@RARBRCRD((sU/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigiq_application_http.pyR7s&

	(	R!R"tpropertyR+RRRRR(((sU/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigiq_application_http.pyR(�stChangescB`seZd�ZRS(cC`sXi}y:x$|jD]}t||�||<qW|j|�}Wntk
rSnX|S(N(R%tgetattrt_filter_paramst	Exception(R*RDt
returnable((sU/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigiq_application_http.pyt	to_returnRs
(R!R"RM(((sU/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigiq_application_http.pyRHQst
UsableChangescB`s�eZed��Zed��Zed��Zed��Zed��Zed��Zed��Z	ed��Z
ed��ZRS(	cC`s]t�}|j|j�|j|j�|j|j�|j|j�|j|j�|S(N(R>tupdateR+thttp_monitortvirtualtpooltnodes(R*RD((sU/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigiq_application_http.pyR^s	c
C`sdt�}tdtddd|jdd|jdd|jjd	d
��d|j�g|d<|S(
Nt
parametersR,RQtdestinationAddresstaddresstmasktnetmasktdestinationPorttportiPtsubcollectionResourcessltm:virtual::b487671f29ba(R>R R9tprofiles(R*RD((sU/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigiq_application_http.pyRQhs	

cC`s6itdt��gd6tdt��gd6}|S(NRTsprofiles:9448fe71611esprofiles:03a4950ab656(R>(R*RD((sU/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigiq_application_http.pyR\xscC`s5t�}tdtdd�d|j�g|d<|S(NRTR,tpool_0R[sltm:pool:9a593d17495b(R>tpool_members(R*RD((sU/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigiq_application_http.pyRR�s		cC`s�t�}g|d<xu|jD]j}tdtd|jdd�dtddj|d�d	d
j|d����}|dj|�qW|S(Nsmembers:5109c66dfbacRTRZiPt
nodeReferenceR2s%#/resources/ltm:node:9e76a6323321/{0}RVtfullPaths# {0}(R>RR9R5tappend(R*RDtxtmember((sU/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigiq_application_http.pyR^�s	
cC`s,t�}tdtdd��g|d<|S(NRTR,R)sltm:profile:http:03a4950ab656(R>(R*RD((sU/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigiq_application_http.pyR+�s
	cC`s,t�}tdtdd��g|d<|S(NRTR,smonitor-httpsltm:monitor:http:ea4346e49cdf(R>(R*RD((sU/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigiq_application_http.pyRP�s
	c	C`sbt�}g|d<xH|jD]=}tdtd|dd|d��}|dj|�qW|S(Nsltm:node:9e76a6323321RTR,RV(R>RRa(R*RDRbttmp((sU/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigiq_application_http.pyRS�s	

cC`s$g|jD]}|d^q
}|S(NRV(R(R*RbRD((sU/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigiq_application_http.pytnode_addresses�s (R!R"RGRRQR\RRR^R+RPRSRe(((sU/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigiq_application_http.pyRN]s

tReportableChangescB`seZRS((R!R"(((sU/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigiq_application_http.pyRf�st
DifferencecB`s&eZdd�Zd�Zd�ZRS(cC`s||_||_dS(N(twantthave(R*RhRi((sU/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigiq_application_http.pyt__init__�s	cC`s9yt||�}|SWntk
r4|j|�SXdS(N(RItAttributeErrort_Difference__default(R*tparamRD((sU/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigiq_application_http.pytcompare�s

cC`sQt|j|�}y&t|j|�}||kr7|SWntk
rL|SXdS(N(RIRhRiRk(R*Rmtattr1tattr2((sU/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigiq_application_http.pyt	__default�s
N(R!R"RFRjRnRl(((sU/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigiq_application_http.pyRg�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`sm|jdd�|_t|jj�|_td|jj�|_|j|j_t�|_	t
�|_dS(Ntmoduletparams(R9RFRsR
RtR6R(RhR'RiRNtchanges(R*targstkwargs((sU/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigiq_application_http.pyRj�scC`sji}xBtjD]7}t|j|�dk	rt|j|�||<qqW|rftd|�|_ndS(NRt(RR%RIRhRFRNRu(R*tchangedtkey((sU/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigiq_application_http.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(NRt(RgRhRiRR&R>RnRFt
isinstanceRORNRutTruetFalse(R*tdiffR&Rxtktchange((sU/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigiq_application_http.pyt_update_changed_options�s		
cC`s|j�}|rtStS(N(R�R|R}(R*RD((sU/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigiq_application_http.pyt
should_updatescC`s:t|j�}t|�td�kr6td��ndS(Ns6.1.0s2Module supports only BIGIQ version 6.0.x or lower.(RR6RR(R*tversion((sU/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigiq_application_http.pytcheck_bigiq_versionscC`s�|j�t}t�}|jj}|dkr@|j�}n|dkr[|j�}ntd|jj	��}|j	�}|j
|�|j
td|��|j|�|S(NtpresenttabsentRtRx(R�R}R>RhtstateR�R�RfRuRMROt_announce_deprecations(R*RxRDR�t
reportableRu((sU/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigiq_application_http.pytexec_modules
	

cC`sK|jdg�}x2|D]*}|jjjd|dd|d�qWdS(Nt
__warningstmsgR�(tpopR6Rst	deprecate(R*RDtwarningstwarning((sU/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigiq_application_http.pyR�.s


cC`s|j�rtS|j�SdS(N(texistsR}tcreate(R*((sU/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigiq_application_http.pyR�6scC`s�dj|jjd|jjd|jj�}|jjj|�}y|j�}Wn%tk
r{}t	t
|���nX|jdkr�d|kr�d|dkr�|dddkr�tSt
S(Nsbhttps://{0}:{1}/mgmt/ap/query/v1/tenants/default/reports/AllApplicationsList?$filter=name+eq+'{2}'R-R.i�RDR/i(R5R6R7RhR,R8R9R:R;RR<RR}R|(R*R@RARBRC((sU/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigiq_application_http.pyR�<s

?cC`sW|jjrtS|j�}|jjrS|j|�|j�rStd��qSntS(NsFailed to delete the resource.(	Rst
check_modeR|tremove_from_deviceRhtwaittwait_for_apply_template_taskR�R(R*t	self_link((sU/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigiq_application_http.pytremoveKs
cC`s,|jjdkr(|jjdkr(tStS(N(RhRRFRR|R}(R*((sU/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigiq_application_http.pythas_no_service_environmentUs$cC`s�|jjdkr!td��n|jjdkrBtd��n|jjdkrctd��n|j�|j�r�tdj|jj���n|j	j
r�tS|j�}|jj
r�|j|�|j�s�td��q�ntS(NsJA 'service_environment' must be specified when creating a new application.sFAt least one 'servers' item is needed when creating a new application.sGAn 'inbound_virtual' must be specified when creating a new application.s8The specified 'service_environment' ({0}) was not found.sFailed to deploy application.(RhRERFRRR RzR�R5RsR�R|tcreate_on_deviceR�R�R�(R*R�((sU/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigiq_application_http.pyR�Zs,

cC`s�|jj�}d|d<dj|jjd|jjd�}|jjj|d|�}y|j�}Wn%tk
r�}t	t
|���nXd|kr�|ddkr�d	|kr�t	|d	��q�t	|j��n|d
S(NtCREATEtmodes3https://{0}:{1}/mgmt/cm/global/tasks/apply-templateR-R.R:R0i�R1R4(Rut
api_paramsR5R6R7R8tpostR:R;RR<R=(R*RtR@RARBRC((sU/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigiq_application_http.pyR�ys

cC`s|j�r|j�StS(N(R�R�R}(R*((sU/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigiq_application_http.pyR��s
cC`s�td|jjdd�}dj|jjd|jjd�}|jjj|d|�}y|j�}Wn%t	k
r�}t
t|���nXd|kr�|dd	kr�d
|kr�t
|d
��q�t
|j��n|dS(NRR�tDELETEs3https://{0}:{1}/mgmt/cm/global/tasks/apply-templateR-R.R:R0i�R1R4(
R>RhR,R5R6R7R8R�R:R;RR<R=(R*RtR@RARBRC((sU/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigiq_application_http.pyR��s 	
cC`s�dj|jjd|jjd�}|jd|�}x�tr�|jjj|�}y|j�}Wn%tk
r�}t	t
|���nX|ddkr�|jdd�dkr�tSd	|kr�t	|d	��ntj
d
�q;WdS(Nshttps://{0}:{1}R-R.shttps://localhostRtFINISHEDtcurrentSteptDONEterrorMessagei(R5R6R7treplaceR|R8R9R:R;RR<RFttimetsleep(R*R�thostR@RARBRC((sU/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigiq_application_http.pyR��s
	((R!R"RjRzR�R�R�R�R�R�R�R�R�R�R�R�R�R�(((sU/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigiq_application_http.pyRr�s 										
					tArgumentSpeccB`seZd�ZRS(cC`s t|_tdtdt�dt�dtdddtdtdt�d	td
d���dtdd
dtdtdt�dtdt�d	td
d���dt�dtddd
d�dtd
ddddg�dtddd
d��}i|_|jjt�|jj|�dS(NR,trequiredRRttypetlisttoptionsRVRZtdefaultiPR R>RXRERtbooltnoR�R�tchoicesR�R�tyes(R|tsupports_check_modeR>t
argument_specROR
(R*R�((sU/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigiq_application_http.pyRj�s0				(R!R"Rj(((sU/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigiq_application_http.pyR��scC`s�t�}td|jd|j�}y,td|�}|j�}|j|�Wn)tk
r{}|jdt	|��nXdS(NR�R�RsR�(
R�R	R�R�RrR�t	exit_jsonRt	fail_jsonR<(tspecRstmmtresultsRC((sU/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigiq_application_http.pytmain�s		t__main__(*t
__future__RRRR�t
__metaclass__tANSIBLE_METADATAt
DOCUMENTATIONtEXAMPLEStRETURNR�tdistutils.versionRtansible.module_utils.basicR	t%library.module_utils.network.f5.bigiqR
t&library.module_utils.network.f5.commonRRR
t)library.module_utils.network.f5.ipaddressRt(library.module_utils.network.f5.icontrolRtImportErrort%ansible.module_utils.network.f5.bigiqt&ansible.module_utils.network.f5.commont)ansible.module_utils.network.f5.ipaddresst(ansible.module_utils.network.f5.icontrolRR'R(RHRNRftobjectRgRrR�R�R!(((sU/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigiq_application_http.pyt<module>sH


i,
au�"	

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