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

�
�Udac@`s�ddlmZmZmZeZidd6dgd6dd6ZdZd	Zd
Z	ddl
Z
ddlZddlZddl
mZdd
lmZddlmZydddlmZddlmZddlmZddlmZddlmZddlmZWnqek
r}ddlmZddlmZddlmZddlmZddlmZddlmZnXyddl m!Z!Wn9ek
r�yddl"m!Z!Wq�ek
r�q�XnXdefd��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(e,fd)��YZ-d*e-fd+��YZ.d,e)fd-��YZ/d.�Z0e1d/kr�e0�ndS(0i(tabsolute_importtdivisiontprint_functions1.1tmetadata_versiontpreviewtstatust	certifiedtsupported_bys�
---
module: bigip_ucs
short_description: Manage upload, installation and removal of UCS files
description:
   - Manage upload, installation and removal of UCS files.
version_added: 2.4
options:
  include_chassis_level_config:
    description:
      - During restore of the UCS file, include chassis level configuration
        that is shared among boot volume sets. For example, cluster default
        configuration.
    type: bool
  ucs:
    description:
      - The path to the UCS file to install. The parameter must be
        provided if the C(state) is either C(installed) or C(activated).
        When C(state) is C(absent), the full path for this parameter will be
        ignored and only the filename will be used to select a UCS for removal.
        Therefore you could specify C(/mickey/mouse/test.ucs) and this module
        would only look for C(test.ucs).
    type: str
  force:
    description:
      - If C(yes) will upload the file every time and replace the file on the
        device. If C(no), the file will only be uploaded if it does not already
        exist. Generally should be C(yes) only in cases where you have reason
        to believe that the image was corrupted during upload.
    type: bool
    default: no
  no_license:
    description:
      - Performs a full restore of the UCS file and all the files it contains,
        with the exception of the license file. The option must be used to
        restore a UCS on RMA devices (Returned Materials Authorization).
    type: bool
  no_platform_check:
    description:
      - Bypasses the platform check and allows a UCS that was created using a
        different platform to be installed. By default (without this option),
        a UCS created from a different platform is not allowed to be installed.
    type: bool
  passphrase:
    description:
      - Specifies the passphrase that is necessary to load the specified UCS file.
    type: str
  reset_trust:
    description:
      - When specified, the device and trust domain certs and keys are not
        loaded from the UCS. Instead, a new set is regenerated.
    type: bool
  state:
    description:
      - When C(installed), ensures that the UCS is uploaded and installed,
        on the system. When C(present), ensures that the UCS is uploaded.
        When C(absent), the UCS will be removed from the system. When
        C(installed), the uploading of the UCS is idempotent, however the
        installation of that configuration is not idempotent.
    type: str
    choices:
      - absent
      - installed
      - present
    default: present
notes:
   - Only the most basic checks are performed by this module. Other checks and
     considerations need to be taken into account. See the following URL.
     https://support.f5.com/kb/en-us/solutions/public/11000/300/sol11318.html
   - This module does not handle devices with the FIPS 140 HSM
   - This module does not handle BIG-IPs systems on the 6400, 6800, 8400, or
     8800 hardware platform.
   - This module does not verify that the new or replaced SSH keys from the
     UCS file are synchronized between the BIG-IP system and the SCCP
   - This module does not support the 'rma' option
   - This module does not support restoring a UCS archive on a BIG-IP 1500,
     3400, 4100, 6400, 6800, or 8400 hardware platform other than the system
     from which the backup was created
   - The UCS restore operation restores the full configuration only if the
     hostname of the target system matches the hostname on which the UCS
     archive was created. If the hostname does not match, only the shared
     configuration is restored. You can ensure hostnames match by using
     the C(bigip_hostname) Ansible module in a task before using this module.
   - This module does not support re-licensing a BIG-IP restored from a UCS
   - This module does not support restoring encrypted archives on replacement
     RMA units.
extends_documentation_fragment: f5
author:
  - Tim Rupp (@caphrim007)
  - Wojciech Wypior (@wojtek0806)
s/
- name: Upload UCS
  bigip_ucs:
    ucs: /root/bigip.localhost.localdomain.ucs
    state: present
    provider:
      server: lb.mydomain.com
      user: admin
      password: secret
  delegate_to: localhost

- name: Install (upload, install) UCS.
  bigip_ucs:
    ucs: /root/bigip.localhost.localdomain.ucs
    state: installed
    provider:
      server: lb.mydomain.com
      user: admin
      password: secret
  delegate_to: localhost

- name: Install (upload, install) UCS without installing the license portion
  bigip_ucs:
    ucs: /root/bigip.localhost.localdomain.ucs
    state: installed
    no_license: yes
    provider:
      server: lb.mydomain.com
      user: admin
      password: secret
  delegate_to: localhost

- name: Install (upload, install) UCS except the license, and bypassing the platform check
  bigip_ucs:
    ucs: /root/bigip.localhost.localdomain.ucs
    state: installed
    no_license: yes
    no_platform_check: yes
    provider:
      server: lb.mydomain.com
      user: admin
      password: secret
  delegate_to: localhost

- name: Install (upload, install) UCS using a passphrase necessary to load the UCS
  bigip_ucs:
    ucs: /root/bigip.localhost.localdomain.ucs
    state: installed
    passphrase: MyPassphrase1234
    provider:
      server: lb.mydomain.com
      user: admin
      password: secret
  delegate_to: localhost

- name: Remove uploaded UCS file
  bigip_ucs:
    ucs: bigip.localhost.localdomain.ucs
    state: absent
    provider:
      server: lb.mydomain.com
      user: admin
      password: secret
  delegate_to: localhost
s
# only common fields returned
N(t
AnsibleModule(t	iteritems(tLooseVersion(tF5RestClient(t
F5ModuleError(tAnsibleF5Parameters(tf5_argument_spec(ttmos_version(tupload_file(tOrderedDictt
ParameterscB`s eZiZgZgZgZRS((t__name__t
__module__tapi_mapt
updatablestreturnablestapi_attributes(((sH/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_ucs.pyR�st
ApiParameterscB`seZRS((RR(((sH/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_ucs.pyR�stModuleParameterscB`s�eZd�Zed��Zed��Zed��Zed��Zed��Zed��Z	ed��Z
ed��ZRS(	cC`sI|j|tk	r|j|S|jdkrEtdj|���ndS(Nt	installeds+"{0}" parameters requires "installed" state(t_valuestTruetstateRtformat(tselft	parameter((sH/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_ucs.pyt_check_required_if�s
cC`stjj|j�S(N(tostpathtbasenametucs(R ((sH/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_ucs.pyR%�scC`s6i|jd6|jd6|jd6|jd6|jd6S(Nsinclude-chassis-level-configs
no-licensesno-platform-checkt
passphrasesreset-trust(tinclude_chassis_level_configt
no_licensetno_platform_checkR'treset_trust(R ((sH/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_ucs.pytoptions�s



cC`s|jd�|jdS(NR+(R"R(R ((sH/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_ucs.pyR+�s
cC`s|jd�|jdS(NR'(R"R(R ((sH/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_ucs.pyR'�s
cC`s|jd�|jdS(NR*(R"R(R ((sH/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_ucs.pyR*�s
cC`s|jd�|jdS(NR)(R"R(R ((sH/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_ucs.pyR)s
cC`s|jd�|jdS(NR((R"R(R ((sH/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_ucs.pyR(s
cC`s�dj|j�}tt|jj�dd���}xit|�D][\}}|tksC|dkrmqCqC|dkr�|d||f7}qC|d|7}qCW|S(Ns$tmsh load sys ucs /var/local/ucs/{0}tkeycS`s|dS(Ni((tt((sH/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_ucs.pyt<lambda>sR's %s %ss %s(	RR%RtsortedR,titemsR	tFalsetNone(R tcmdR,tktv((sH/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_ucs.pytinstall_commands$(RRR"tpropertyR%R,R+R'R*R)R(R7(((sH/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_ucs.pyR�s	
tChangescB`seZd�ZRS(cC`sXi}y:x$|jD]}t||�||<qW|j|�}Wntk
rSnX|S(N(Rtgetattrt_filter_paramst	Exception(R tresultt
returnable((sH/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_ucs.pyt	to_returns
(RRR?(((sH/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_ucs.pyR9stReportableChangescB`seZRS((RR(((sH/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_ucs.pyR@'st
UsableChangescB`seZRS((RR(((sH/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_ucs.pyRA+st
ModuleManagercB`s#eZd�Zd�Zd�ZRS(cO`s7||_|jdd�|_t|jj�|_dS(Ntmodule(tkwargstgetR3RCRtparamstclient(R targsRD((sH/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_ucs.pyt__init__0s	cC`s7|j�rt|j�}nt|j�}|j�S(N(t
is_version_v1t	V1ManagerRDt	V2Managertexec_module(R tmanager((sH/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_ucs.pyRM5scC`s3t|j�}t|�td�kr+tStSdS(sDChecks to see if the TMOS version is less than 12.1.0

        Versions prior to 12.1.0 have a bug which prevents the REST
        API from properly listing any UCS files when you query the
        /mgmt/tm/sys/ucs endpoint. Therefore you need to do everything
        through tmsh over REST.

        :return: Bool
        s12.1.0N(RRGR
RR2(R tversion((sH/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_ucs.pyRJ=s
(RRRIRMRJ(((sH/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_ucs.pyRB/s		t
DifferencecB`seZRS((RR(((sH/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_ucs.pyRPNstBaseManagercB`s�eZd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Z	d�Z
d	�Zd
�Zd�Z
d�Zd
�ZRS(cO`sR|jdd�|_t|jj�|_td|jj�|_t�|_	dS(NRCRF(
RER3RCRRFRGRtwantRAtchanges(R RHRD((sH/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_ucs.pyRISscC`sK|jdg�}x2|D]*}|jjjd|dd|d�qWdS(Nt
__warningstmsgRO(tpopRGRCt	deprecate(R R=twarningstwarning((sH/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_ucs.pyt_announce_deprecationsYs


cC`s�t}t�}|jj}|dkr6|j�}n|dkrQ|j�}ntd|jj��}|j�}|j	|�|j	td|��|j
|�|S(NtpresentRtabsentRFtchanged(spresents	installed(R2tdictRRRR[R\R@RSR?tupdateRZ(R R]R=Rt
reportableRS((sH/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_ucs.pyRMas	

cC`s$|j�r|j�S|j�SdS(N(texistsR_tcreate(R ((sH/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_ucs.pyR[rs
cC`sd|jjr |jjrtStS|jjr@|j�|j�S|jjdkr\|j	�StSdS(NR(
RCt
check_modeRRtforceRR2tremoveRbRtinstall_on_device(R ((sH/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_ucs.pyR_xs


cC`sX|jjrtS|j�|j�s5td��n|jjdkrT|j�ntS(NsFailed to upload the UCS fileR(	RCRcRtcreate_on_deviceRaRRRRRf(R ((sH/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_ucs.pyRb�s

cC`s|j�r|j�StS(N(RaReR2(R ((sH/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_ucs.pyR\�s
cC`s|j�}|rtStS(N(t_update_changed_optionsRR2(R R=((sH/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_ucs.pyt
should_update�scC`s9|jjrtS|j�|j�r5td��ntS(NsFailed to delete the UCS file(RCRcRtremove_from_deviceRaR(R ((sH/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_ucs.pyRe�s
cC`s^tjd�xJtdd�D]9}y|jj�PWqtk
rUtjd�qXqWdS(Niii<i(ttimetsleeptrangeRGt	reconnectR<(R tx((sH/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_ucs.pytwait_for_rest_api_restart�s


cC`s�d}x�|dkr�tjd�y�tdddd�}dj|jjd	|jjd
�}|jjj|d|�}y|j�}Wn%t	k
r�}t
t|���nXd|kr|ddkrd|kr�t
|d��qt
|j��nWnt
k
r}q	nXd|kr,q	n|d}|j|�r]t
dj|���n|j|�r�|j|�r�|d7}q	q�nd}q	WdS(NiiitcommandtruntutilCmdArgss-c "tmsh show sys mcp-state"s!https://{0}:{1}/mgmt/tm/util/bashtservertserver_porttjsontcodei�i�tmessaget
commandResults[Failed to reload the configuration. This may be due to a cross-version incompatibility. {0}i(i�i�(RkRlR^RRGtprovidertapitpostRvt
ValueErrorRtstrtcontentR<t%_is_config_reloading_failed_on_devicet&_is_config_reloading_success_on_devicet&_is_config_reloading_running_on_device(R tnoopsRFturitresptoutputtexR=((sH/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_ucs.pytwait_for_configuration_reload�s@
	


	cC`s&d}tj||�}|r"tStS(Ns9Last Configuration Load Status\s+full-config-load-succeed(tretsearchRR2(R R�tsucceedtmatches((sH/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_ucs.pyR��s
cC`s&d}tj||�}|r"tStS(NsRunning Phase\s+running(R�R�RR2(R R�trunningR�((sH/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_ucs.pyR��s
cC`s&d}tj||�}|r"tStS(Ns8Last Configuration Load Status\s+base-config-load-failed(R�R�RR2(R R�tfailedR�((sH/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_ucs.pyR��s
(RRRIRZRMR[R_RbR\RiReRpR�R�R�R�(((sH/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_ucs.pyRQRs					
	
						+		RKcB`sDeZdZd�Zd�Zd�Zd�Zd�Zd�ZRS(sManager class for V1 product

    V1 products include versions of BIG-IP < 12.1.0, but >= 12.0.0.

    These versions had a number of API deficiencies. These include, but
    are not limited to,

      * UCS collection endpoint listed no items
      * No API to upload UCS files

    cC`sddj|jjd|jjd�}yt|j|||�Wntk
r_td��nXdS(Ns1https://{0}:{1}/mgmt/shared/file-transfer/uploadsRtRusFailed to upload the file.(RRGRzRR(R Rtnameturl((sH/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_ucs.pytupload_file_to_device�s

cC`sd}d}|j|jj|jj�dj|jjd|jjd�}tdddd	j|||jj��}|jjj	|d
|�}y|j
�}Wn%tk
r�}tt
|���nXd|kr|ddkrd
|krt|d
��qt|j��ntS(Ns/var/local/ucss/var/config/rest/downloadss%https://{0}:{1}/mgmt/tm/util/unix-mv/RtRuRqRrRss{0}/{2} {1}/{2}RvRwi�Rx(R�RRR&R%RRGRzR^R{R|RvR}RR~RR(R tremote_patht
tpath_nameR�RHR�tresponseR�((sH/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_ucs.pyRgs(
c	C`s8g}tdddd�}dj|jjd|jjd�}|jjj|d|�}y|j�}Wn%tk
r�}tt	|���nXd	|kr�|d	dkr�d|kr�t|d��q�t|j
��nd
|kr4|d
jd�}g|D]}|j�^q}t
t|��}n|S(NRqRrRss-c "tmsh list sys ucs"s!https://{0}:{1}/mgmt/tm/util/bashRtRuRvRwi�i�RxRys
(i�i�(R^RRGRzR{R|RvR}RR~Rtsplittstriptlisttset(	R R=RFR�R�R�R�tlinesRo((sH/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_ucs.pytread_current_from_device s(	
cC`s&|j�}|jj|kr"tStS(N(R�RRR%RR2(R t
collection((sH/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_ucs.pyRa9scC`s tddddj|jj��}dj|jjd|jjd�}|jjj|d|�}y|j�}Wn%t	k
r�}t
t|���nXd	|kr�|d	dkr�d|kr�t
|d��q�t
|j��nd
|krdj|jj�|d
krt
SntS(NRqRrRss-c "tmsh delete sys ucs {0}"s!https://{0}:{1}/mgmt/tm/util/bashRtRuRvRwi�i�RxRys{0} is deleted(i�i�(R^RRRR%RGRzR{R|RvR}RR~RRR2(R RFR�R�R�R�((sH/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_ucs.pyRj?s$
cC`sXy�tddddj|jj��}dj|jjd|jjd�}|jjj|d|�}y|j�}Wn%t	k
r�}t
t|���nXd	|kr�|d	dkr�d|kr�t
|d��q�t
|j��nWnOt
k
r?}d
t|�krq@dt|�kr*q@t
t|���nX|j�|j�tS(NRqRrRss-c "{0}"s!https://{0}:{1}/mgmt/tm/util/bashRtRuRvRwi�i�RxsConnection abortedtTimeoutException(i�i�(R^RRRR7RGRzR{R|RvR}RR~RR<RpR�R(R RFR�R�R�R�((sH/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_ucs.pyRfVs0


(	RRt__doc__R�RgR�RaRjRf(((sH/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_ucs.pyRK�s					RLcB`s eZdZd�Zd�ZRS(s�Manager class for V2 product

    V2 products include versions of BIG-IP >= 12.1.0 but < 13.0.0.

    These versions fixed the collection bug in V1, but had yet to add the
    ability to upload files using a dedicated UCS upload API.

    cC`sg}dj|jjd|jjd�}|jjj|�}y|j�}Wn%tk
rx}tt|���nXd|kr�|ddkr�d|kr�t|d��q�t|j	��n|jdg�}x/|D]'}|j
tjj
|dd	��q�W|S(
Ns https://{0}:{1}/mgmt/tm/sys/ucs/RtRuRwi�RxR1tapiRawValuestfilename(RRGRzR{RERvR}RR~RtappendR#R$R%(R R=R�R�R�R�R1titem((sH/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_ucs.pyR��s"

%cC`s&|j�}|jj|kr"tStS(N(R�RRR%RR2(R R�((sH/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_ucs.pyRa�s(RRR�R�Ra(((sH/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_ucs.pyRLxs	tArgumentSpeccB`seZd�ZRS(cC`s�t|_tdtdddd�dtdd�dtdd�dtdd�d	td
t�dtdd�dtdd
dddd
g�dtdt��}i|_|jjt�|jj|�dS(NRdttypetbooltdefaulttnoR(R)R*R'tno_logR+RR[tchoicesR\RR&trequired(Rtsupports_check_modeR^t
argument_specR_R(R R�((sH/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_ucs.pyRI�s(						(RRRI(((sH/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_ucs.pyR��scC`s�t�}td|jd|j�}y,td|�}|j�}|j|�Wn)tk
r{}|jdt	|��nXdS(NR�R�RCRU(
R�RR�R�RBRMt	exit_jsonRt	fail_jsonR~(tspecRCtmmtresultsR�((sH/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_ucs.pytmain�s		t__main__(2t
__future__RRRR�t
__metaclass__tANSIBLE_METADATAt
DOCUMENTATIONtEXAMPLEStRETURNR#R�Rktansible.module_utils.basicRtansible.module_utils.sixR	tdistutils.versionR
t%library.module_utils.network.f5.bigipRt&library.module_utils.network.f5.commonRR
Rt(library.module_utils.network.f5.icontrolRRtImportErrort%ansible.module_utils.network.f5.bigipt&ansible.module_utils.network.f5.commont(ansible.module_utils.network.f5.icontroltcollectionsRtordereddictRRRR9R@RAtobjectRBRPRQRKRLR�R�R(((sH/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_ucs.pyt<module>sb


\B


?��'	

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