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_utility_license.pyo

�
�Udac@`s�ddlmZmZmZeZidd6dgd6dd6ZdZd	Zd
Z	ddl
Z
ddlmZyDdd
l
mZddlmZddlmZddlmZWnQek
rdd
lmZddlmZddlmZddlmZnXdefd��YZdefd��YZdefd��YZdefd��YZdefd��YZdefd��YZdefd��YZdefd ��YZd!efd"��YZd#�Z e!d$kr�e �ndS(%i(tabsolute_importtdivisiontprint_functions1.1tmetadata_versiontpreviewtstatust	certifiedtsupported_bys�
---
module: bigiq_utility_license
short_description: Manage utility licenses on a BIG-IQ
description:
  - Manages utility licenses on a BIG-IQ. Utility licenses are one form of licenses
    that BIG-IQ can distribute. These licenses, unlike regkey licenses, do not require
    a pool to be created before creation. Additionally, when assigning them, you assign
    by offering instead of key.
version_added: 2.6
options:
  license_key:
    description:
      - The license key to install and activate.
    type: str
    required: True
  accept_eula:
    description:
      - A key that signifies that you accept the F5 EULA for this license.
      - A copy of the EULA can be found here https://askf5.f5.com/csp/article/K12902
      - This is required when C(state) is C(present).
    type: bool
  state:
    description:
      - The state of the utility license on the system.
      - When C(present), guarantees that the license exists.
      - When C(absent), removes the license from the system.
    type: str
    choices:
      - absent
      - present
    default: present
requirements:
  - BIG-IQ >= 5.3.0
extends_documentation_fragment: f5
author:
  - Tim Rupp (@caphrim007)
s
- name: Add a utility license to the system
  bigiq_utility_license:
    license_key: XXXXX-XXXXX-XXXXX-XXXXX-XXXXX
    accept_eula: yes
    state: present
    provider:
      user: admin
      password: secret
      server: lb.mydomain.com
  delegate_to: localhost

- name: Remove a utility license from the system
  bigiq_utility_license:
    license_key: XXXXX-XXXXX-XXXXX-XXXXX-XXXXX
    state: absent
    provider:
      user: admin
      password: secret
      server: lb.mydomain.com
  delegate_to: localhost
s
# only common fields returned
N(t
AnsibleModule(tF5RestClient(t
F5ModuleError(tAnsibleF5Parameters(tf5_argument_spect
ParameterscB`s9eZidd6ZdgZdgZdgZd�ZRS(tlicense_keytregKeycC`sXi}y:x$|jD]}t||�||<qW|j|�}Wntk
rSnX|S(N(treturnablestgetattrt_filter_paramst	Exception(tselftresultt
returnable((sT/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigiq_utility_license.pyt	to_returnrs
(t__name__t
__module__tapi_maptapi_attributesRt
updatablesR(((sT/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigiq_utility_license.pyR
as
			t
ApiParameterscB`seZRS((RR(((sT/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigiq_utility_license.pyR}stModuleParameterscB`seZRS((RR(((sT/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigiq_utility_license.pyR�stChangescB`seZd�ZRS(cC`sXi}y:x$|jD]}t||�||<qW|j|�}Wntk
rSnX|S(N(RRRR(RRR((sT/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigiq_utility_license.pyR�s
(RRR(((sT/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigiq_utility_license.pyR�st
UsableChangescB`seZRS((RR(((sT/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigiq_utility_license.pyR �stReportableChangescB`seZed��ZRS(cC`sdS(N(tNone(R((sT/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigiq_utility_license.pyR�s(RRtpropertyR(((sT/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigiq_utility_license.pyR!�st
DifferencecB`s&eZdd�Zd�Zd�ZRS(cC`s||_||_dS(N(twantthave(RR%R&((sT/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigiq_utility_license.pyt__init__�s	cC`s9yt||�}|SWntk
r4|j|�SXdS(N(RtAttributeErrort_Difference__default(RtparamR((sT/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigiq_utility_license.pytcompare�s

cC`sQt|j|�}y&t|j|�}||kr7|SWntk
rL|SXdS(N(RR%R&R((RR*tattr1tattr2((sT/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigiq_utility_license.pyt	__default�s
N(RRR"R'R+R)(((sT/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigiq_utility_license.pyR$�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|jd|jj�|_t�|_	t
�|_dS(Ntmoduletclienttparams(tgetR"R0R	R2R1RR%RR&R tchanges(Rtargstkwargs((sT/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigiq_utility_license.pyR'�s
!cC`sji}xBtjD]7}t|j|�dk	rt|j|�||<qqW|rftd|�|_ndS(NR2(R
RRR%R"R R4(Rtchangedtkey((sT/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigiq_utility_license.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(NR2(R$R%R&R
RtdictR+R"t
isinstancetupdateR R4tTruetFalse(RtdiffRR7tktchange((sT/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigiq_utility_license.pyt_update_changed_options�s		
cC`s|j�}|rtStS(N(RBR=R>(RR((sT/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigiq_utility_license.pyt
should_update�scC`s�t}t�}|jj}|dkr6|j�}n|dkrQ|j�}ntd|jj��}|j�}|j	|�|j	td|��|j
|�|S(NtpresenttabsentR2R7(R>R:R%tstateRDRER!R4RR<t_announce_deprecations(RR7RRFt
reportableR4((sT/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigiq_utility_license.pytexec_module�s	

cC`sH|jdg�}x/|D]'}|jjd|dd|d�qWdS(Nt
__warningstmsgtversion(tpopR0t	deprecate(RRtwarningstwarning((sT/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigiq_utility_license.pyRG�s


cC`s|j�rtS|j�SdS(N(texistsR>tcreate(R((sT/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigiq_utility_license.pyRD�scC`s�dj|jjd|jjd|jj�}|jjj|�}y|j�}Wn%tk
r{}t	t
|���nX|jdkr�|ddkr�tSd|kr�|ddkr�d	|kr�t	|d	��q�t	|j
��ntS(
NsWhttps://{0}:{1}/mgmt/cm/device/licensing/pool/utility/licenses/?$filter=regKey+eq+'{2}'tservertserver_porti�t
totalItemsitcodei�tmessage(tformatR1tproviderR%RtapiR3tjsont
ValueErrorR
tstrRR>t_contentR=(Rturitresptresponsetex((sT/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigiq_utility_license.pyRQ�s 

cC`sC|jjrtS|j�|j�|j�r?td��ntS(NsFailed to delete the resource.(R0t
check_modeR=tremove_from_devicetwait_for_removalRQR
(R((sT/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigiq_utility_license.pytremove
s

cC`sx|j�|jjrtS|jjtkr;td��n|j�|j	�|j
�|j�sttd��ntS(NscTo add a license, you must accept its EULA. Please see the module documentation for a link to this.sFailed to activate the license.(R9R0RcR=R%taccept_eulaR>R
tcreate_on_devicet#wait_for_initial_license_activationt#wait_for_utility_license_activationRQ(R((sT/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigiq_utility_license.pyRRs



cC`s�|jj�}dj|jjd|jjd�}|jj|d<d|d<|jjj|d|�}y|j	�}Wn%t
k
r�}tt|���nXd|kr�|dd	kr�d
|kr�t|d
��q�t|j
��ndS(Ns@https://{0}:{1}/mgmt/cm/device/licensing/pool/initial-activationRSRTtnametACTIVATING_AUTOMATICRR[RVi�RW(R4t
api_paramsRXR1RYR%RRZtpostR[R\R
R]R^(RR2R_R`RaRb((sT/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigiq_utility_license.pyRh's

cC`sId}x<|dkrD|j�s.|d7}nd}tjd�q	WdS(Niii(RQttimetsleep(Rtcount((sT/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigiq_utility_license.pyRe=s
c
C`s�d}dj|jjd|jjd|jj�}xx|dkr�|jjj|�}y|j�}Wn%tk
r�}t	t
|���nXd|kr�|ddkr�d|kr�t	|d��q�t	|j��n|d	d
kr�|d7}n�|d	dkrp|d
jddj|jjd|jjd��}|jjj
|dtd	dd|d��n/|d	dkr�t	t
|d���nd}tjd�q8WdS(NisDhttps://{0}:{1}/mgmt/cm/device/licensing/pool/initial-activation/{2}RSRTiRVi�RWRtREADYit%ACTIVATING_AUTOMATIC_NEED_EULA_ACCEPTtselfLinkshttps://localhostshttps://{0}:{1}R[t"ACTIVATING_AUTOMATIC_EULA_ACCEPTEDteulaTexttACTIVATION_FAILED(RXR1RYR%RRZR3R[R\R
R]R^treplacetpatchR:RoRp(RRqR_R`RaRb((sT/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigiq_utility_license.pyRiGs<




cC`s?d}dj|jjd|jjd|jj�}x|dkr:|jjj|�}y|j�}Wn%tk
r�}t	t
|���nXd|kr�|ddkr�d	|kr�t	|d	��q�t	|j��n|d
dkr�|d7}n/|d
d
kr$t	t
|d	���nd}tj
d�q8WdS(NisBhttps://{0}:{1}/mgmt/cm/device/licensing/pool/utility/licenses/{2}RSRTiRVi�i�RWRRriRw(i�i�(RXR1RYR%RRZR3R[R\R
R]R^RoRp(RRqR_R`RaRb((sT/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigiq_utility_license.pyRjps*


cC`s|j�r|j�StS(N(RQRfR>(R((sT/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigiq_utility_license.pyRE�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��ndS(NsBhttps://{0}:{1}/mgmt/cm/device/licensing/pool/utility/licenses/{2}RSRTRVi�RW(RXR1RYR%RRZtdeleteR[R\R
R]R^(RR_R`RaRb((sT/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigiq_utility_license.pyRd�s

(RRR'R9RBRCRIRGRDRQRfRRRhReRiRjRERd(((sT/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigiq_utility_license.pyR/�s 													
	)		tArgumentSpeccB`seZd�ZRS(cC`s�t|_tdtdtdt�dtdd�dtdd	d
d	dg��}i|_|jjt�|jj|�dd	dggg|_dS(NRtrequiredtno_logRgttypetboolRFtdefaultRDtchoicesRE(R=tsupports_check_modeR:t
argument_specR<Rtrequired_if(RR�((sT/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigiq_utility_license.pyR'�s		(RRR'(((sT/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigiq_utility_license.pyR{�scC`s�t�}td|jd|jd|j�}t|j�}y,td|�}|j�}|j	|�Wn)t
k
r�}|jdt|��nXdS(NR�R�R�R0RK(
R{RR�R�R�R	R2R/RIt	exit_jsonR
t	fail_jsonR](tspecR0R1tmmtresultsRb((sT/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigiq_utility_license.pytmain�s			t__main__("t
__future__RRRR~t
__metaclass__tANSIBLE_METADATAt
DOCUMENTATIONtEXAMPLEStRETURNRotansible.module_utils.basicRt%library.module_utils.network.f5.bigiqR	t&library.module_utils.network.f5.commonR
RRtImportErrort%ansible.module_utils.network.f5.bigiqt&ansible.module_utils.network.f5.commonR
RRRR R!tobjectR$R/R{R�R(((sT/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigiq_utility_license.pyt<module>s>


'
�	

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