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

�
�Udac@`sddlmZmZmZeZidd6dgd6dd6ZdZd	Zd
Z	ddl
mZddl
mZyTdd
l
mZddlmZddlmZddlmZddlmZWnaek
r)dd
lmZddlmZddlmZddlmZddlmZnXdefd��YZdefd��YZdefd��YZdefd��YZdefd��YZdefd��YZdefd��YZd efd!��YZd"efd#��YZ d$�Z!e"d%kre!�nd&S('i(tabsolute_importtdivisiontprint_functions1.1tmetadata_versiontpreviewtstatust	certifiedtsupported_bys�
---
module: bigip_cli_script
short_description: Manage CLI scripts on a BIG-IP
description:
  - Manages CLI scripts on a BIG-IP. CLI scripts, otherwise known as tmshell scripts
    or TMSH scripts allow you to create custom scripts that can run to manage objects
    within a BIG-IP.
version_added: 2.7
options:
  name:
    description:
      - Specifies the name of the script.
    type: str
    required: True
  content:
    description:
      - The content of the script.
      - This parameter is typically used in conjunction with Ansible's C(file), or
        template lookup plugins. If this sounds foreign to you, see the examples
        in this documentation.
    type: str
  description:
    description:
      - Description of the cli script.
    type: str
  partition:
    description:
      - Device partition to manage resources on.
    type: str
    default: Common
  state:
    description:
      - When C(present), ensures that the script exists.
      - When C(absent), ensures the script is removed.
    type: str
    default: present
    choices:
      - present
      - absent
extends_documentation_fragment: f5
author:
  - Tim Rupp (@caphrim007)
  - Wojciech Wypior (@wojtek0806)
s4
- name: Create a cli script from an existing file
  bigip_cli_script:
    name: foo
    content: "{{ lookup('file', '/absolute/path/to/cli/script.tcl') }}"
    provider:
      password: secret
      server: lb.mydomain.com
      user: admin
  delegate_to: localhost

- name: Create a cli script from a jinja template representing a cli script
  bigip_cli_script:
    name: foo
    content: "{{ lookup('template', '/absolute/path/to/cli/script.tcl') }}"
    provider:
      password: secret
      server: lb.mydomain.com
      user: admin
  delegate_to: localhost
s�
param1:
  description: The new param1 value of the resource.
  returned: changed
  type: bool
  sample: true
param2:
  description: The new param2 value of the resource.
  returned: changed
  type: str
  sample: Foo is bar
(t
AnsibleModule(tenv_fallback(tF5RestClient(t
F5ModuleError(tAnsibleF5Parameters(tf5_argument_spec(ttransform_namet
ParameterscB`s@eZidd6dd6ZddgZddgZddgZRS(tcontenttapiAnonymoustchecksumtscriptChecksumtdescription(t__name__t
__module__tapi_maptapi_attributestreturnablest
updatables(((sO/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_cli_script.pyRqs
		t
ApiParameterscB`s&eZed��Zed��ZRS(cC`sdS(Nttrue((tself((sO/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_cli_script.pytignore_verification�scC`s|jdj�S(NR(t_valueststrip(R((sO/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_cli_script.pyR�s(RRtpropertyRR(((sO/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_cli_script.pyR�stModuleParameterscB`s5eZed��Zed��Zed��ZRS(cC`sdS(NR((R((sO/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_cli_script.pyR�scC`s(|jddkrdS|jdj�S(NR(RtNoneR (R((sO/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_cli_script.pyR�scC`s9|jddkrdS|jddkr.dS|jdS(NRtnonet(R$R%(RR#(R((sO/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_cli_script.pyR�s
(RRR!RRR(((sO/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_cli_script.pyR"�stChangescB`seZd�ZRS(cC`sXi}y:x$|jD]}t||�||<qW|j|�}Wntk
rSnX|S(N(Rtgetattrt_filter_paramst	Exception(Rtresultt
returnable((sO/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_cli_script.pyt	to_return�s
(RRR,(((sO/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_cli_script.pyR&�st
UsableChangescB`seZRS((RR(((sO/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_cli_script.pyR-�stReportableChangescB`seZRS((RR(((sO/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_cli_script.pyR.�st
DifferencecB`sDeZdd�Zd�Zd�Zed��Zed��ZRS(cC`s||_||_dS(N(twantthave(RR0R1((sO/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_cli_script.pyt__init__�s	cC`s9yt||�}|SWntk
r4|j|�SXdS(N(R'tAttributeErrort_Difference__default(RtparamR*((sO/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_cli_script.pytcompare�s

cC`sQt|j|�}y&t|j|�}||kr7|SWntk
rL|SXdS(N(R'R0R1R3(RR5tattr1tattr2((sO/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_cli_script.pyt	__default�s
cC`sX|jjdkrdS|jjdkr2|jjS|jj|jjkrT|jjSdS(N(R0RR#R1(R((sO/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_cli_script.pyR�s
cC`sd|jjdkrdS|jjdkr>|jjdkr>dS|jj|jjkr`|jjSdS(NR%(R0RR#R1(R((sO/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_cli_script.pyR�s$N(	RRR#R2R6R4R!RR(((sO/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_cli_script.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`s^|jdd�|_t|jj�|_td|jj�|_t�|_	t
�|_dS(Ntmoduletparams(tgetR#R;R
R<tclientR"R0RR1R-tchanges(Rtargstkwargs((sO/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_cli_script.pyR2�s
cC`sji}xBtjD]7}t|j|�dk	rt|j|�||<qqW|rftd|�|_ndS(NR<(RRR'R0R#R-R?(Rtchangedtkey((sO/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_cli_script.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(NR<(R/R0R1RRtdictR6R#t
isinstancetupdateR-R?tTruetFalse(RtdiffRRBtktchange((sO/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_cli_script.pyt_update_changed_options�s		
cC`s|j�}|rtStS(N(RMRHRI(RR*((sO/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_cli_script.pyt
should_updatescC`s�t}t�}|jj}|dkr6|j�}n|dkrQ|j�}ntd|jj��}|j�}|j	|�|j	td|��|j
|�|S(NtpresenttabsentR<RB(RIRER0tstateRORPR.R?R,RGt_announce_deprecations(RRBR*RQt
reportableR?((sO/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_cli_script.pytexec_module	s	

cC`sK|jdg�}x2|D]*}|jjjd|dd|d�qWdS(Nt
__warningstmsgtversion(tpopR>R;t	deprecate(RR*twarningstwarning((sO/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_cli_script.pyRRs


cC`s$|j�r|j�S|j�SdS(N(texistsRGtcreate(R((sO/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_cli_script.pyRO"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/cli/script/{2}tservertserver_porti�tcode(tformatR>tproviderRR0t	partitiontnametapiR=tjsont
ValueErrorRIRRH(Rturitresptresponse((sO/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_cli_script.pyR\(s


+cC`s�|j�|_|j�stS|jjr/tS|jj�}d|krvd|krv|jj	i|jj
d6�nd|kr�d|kr�|jj	i|jjd6�n|j�tS(NRR(
tread_current_from_deviceR1RNRIR;t
check_modeRHR?t
api_paramsRGRRtupdate_on_device(RR<((sO/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_cli_script.pyRG7s  
cC`s9|jjrtS|j�|j�r5td��ntS(NsFailed to delete the resource.(R;RlRHtremove_from_deviceR\R(R((sO/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_cli_script.pytremoveMs
cC`s(|j�|jjrtS|j�tS(N(RDR;RlRHtcreate_on_device(R((sO/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_cli_script.pyR]Us


cC`s�|jj�}|jj|d<|jj|d<dj|jjd|jjd�}|jjj	|d|�}y|j
�}Wn%tk
r�}tt
|���nXd|kr�|ddkr�d
|kr�t|d
��q�t|j��ndS(NRdRcs#https://{0}:{1}/mgmt/tm/cli/script/R^R_RfR`i�i�tmessage(i�i�(R?RmR0RdRcRaR>RbRetpostRfRgRtstrR(RR<RhRiRjtex((sO/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_cli_script.pyRq\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/cli/script/{2}R^R_RfR`i�Rr(R?RmRaR>RbRR0RcRdRetpatchRfRgRRtR(RR<RhRiRjRu((sO/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_cli_script.pyRnps

cC`s|j�r|j�StS(N(R\RpRI(R((sO/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_cli_script.pyRP�s
cC`sjdj|jjd|jjdt|jj|jj��}|jjj|�}|j	dkrft
SdS(Ns&https://{0}:{1}/mgmt/tm/cli/script/{2}R^R_i�(RaR>RbRR0RcRdRetdeleteRRH(RRhRi((sO/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_cli_script.pyRo�s

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/cli/script/{2}R^R_R`i�RrR<(RaR>RbRR0RcRdReR=RfRgRRtRR(RRhRiRjRu((sO/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_cli_script.pyRk�s

(RRR2RDRMRNRTRRROR\RGRpR]RqRnRPRoRk(((sO/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_cli_script.pyR:�s 															
tArgumentSpeccB`seZd�ZRS(cC`s�t|_tdtdt�dt�dt�dtddddd	g�d
tdddtd
gf��}i|_|jjt�|jj|�dS(NRdtrequiredRRRQtdefaultROtchoicesRPRctCommontfallbacktF5_PARTITION(RHtsupports_check_modeRER	t
argument_specRGR
(RR�((sO/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_cli_script.pyR2�s				(RRR2(((sO/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_cli_script.pyRx�scC`s�t�}td|jd|j�}y,td|�}|j�}|j|�Wn)tk
r{}|jdt	|��nXdS(NR�RR;RV(
RxRR�RR:RTt	exit_jsonRt	fail_jsonRt(tspecR;tmmtresultsRu((sO/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_cli_script.pytmain�s		t__main__N(#t
__future__RRRttypet
__metaclass__tANSIBLE_METADATAt
DOCUMENTATIONtEXAMPLEStRETURNtansible.module_utils.basicRR	t%library.module_utils.network.f5.bigipR
t&library.module_utils.network.f5.commonRRR
RtImportErrort%ansible.module_utils.network.f5.bigipt&ansible.module_utils.network.f5.commonRRR"R&R-R.tobjectR/R:RxR�R(((sO/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_cli_script.pyt<module>sB


.


(�	

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