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

�
�Udac@`s?ddlmZmZmZeZidd6dgd6dd6ZdZd	Zd
Z	ddl
Z
ddlZddlm
Z
dd
lmZyDddlmZddlmZddlmZddlmZWnQek
r!ddlmZddlmZddlmZddlmZnXyddlmZeZWnek
rUeZnXdefd��YZdefd��YZdefd��YZ defd��YZ!de!fd��YZ"de!fd��YZ#de$fd ��YZ%d!e$fd"��YZ&d#e$fd$��YZ'd%�Z(e)d&kr;e(�ndS('i(tabsolute_importtdivisiontprint_functions1.1tmetadata_versiontstableinterfacetstatust	certifiedtsupported_bys
---
module: bigip_configsync_action
short_description: Perform different actions related to config-sync
description:
  - Allows one to run different config-sync actions. These actions allow
    you to manually sync your configuration across multiple BIG-IPs when
    those devices are in an HA pair.
version_added: 2.4
options:
  device_group:
    description:
      - The device group that you want to perform config-sync actions on.
    type: str
    required: True
  sync_device_to_group:
    description:
      - Specifies that the system synchronizes configuration data from this
        device to other members of the device group. In this case, the device
        will do a "push" to all the other devices in the group. This option
        is mutually exclusive with the C(sync_group_to_device) option.
    type: bool
  sync_most_recent_to_device:
    description:
      - Specifies that the system synchronizes configuration data from the
        device with the most recent configuration. In this case, the device
        will do a "pull" from the most recently updated device. This option
        is mutually exclusive with the C(sync_device_to_group) options.
    type: bool
  overwrite_config:
    description:
      - Indicates that the sync operation overwrites the configuration on
        the target.
    type: bool
    default: no
notes:
  - Requires the objectpath Python package on the host. This is as easy as
    C(pip install objectpath).
extends_documentation_fragment: f5
author:
  - Tim Rupp (@caphrim007)
  - Wojciech Wypior (@wojtek0806)
s
- name: Sync configuration from device to group
  bigip_configsync_action:
    device_group: foo-group
    sync_device_to_group: yes
    provider:
      server: lb.mydomain.com
      user: admin
      password: secret
  delegate_to: localhost

- name: Sync configuration from most recent device to the current host
  bigip_configsync_action:
    device_group: foo-group
    sync_most_recent_to_device: yes
    provider:
      server: lb.mydomain.com
      user: admin
      password: secret
  delegate_to: localhost

- name: Perform an initial sync of a device to a new device group
  bigip_configsync_action:
    device_group: new-device-group
    sync_device_to_group: yes
    provider:
      server: lb.mydomain.com
      user: admin
      password: secret
  delegate_to: localhost
s
# only common fields returned
N(t
AnsibleModule(t
BOOLEANS_TRUE(tF5RestClient(t
F5ModuleError(tAnsibleF5Parameters(tf5_argument_spec(tTreet
ParameterscB`seZgZgZRS((t__name__t
__module__tapi_attributestreturnables(((sV/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_configsync_action.pyRwst
ApiParameterscB`seZRS((RR(((sV/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_configsync_action.pyR|stModuleParameterscB`s\eZed��Zed��Zed��Zed��Zed��Zd�ZRS(cC`s|jr
dSdSdS(Nsto-groups
from-group(tsync_device_to_group(tself((sV/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_configsync_action.pyt	direction�s	cC`s|j|jd�}|S(NR(t
_cast_to_boolt_values(Rtresult((sV/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_configsync_action.pyR�scC`s|j|jd�}|S(Ntsync_group_to_device(RR(RR((sV/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_configsync_action.pyR�scC`s|jr
dSdSdS(Nsforce-full-load-pusht(toverwrite_config(R((sV/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_configsync_action.pytforce_full_push�s	cC`s|j|jd�}|S(NR(RR(RR((sV/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_configsync_action.pyR�scC`s(|dkrdS|tkr tStSdS(N(tNoneR	tTruetFalse(Rtvalue((sV/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_configsync_action.pyR�s
(	RRtpropertyRRRRRR(((sV/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_configsync_action.pyR�stChangescB`seZd�ZRS(cC`sXi}y:x$|jD]}t||�||<qW|j|�}Wntk
rSnX|S(N(Rtgetattrt_filter_paramst	Exception(RRt
returnable((sV/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_configsync_action.pyt	to_return�s
(RRR*(((sV/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_configsync_action.pyR%�st
UsableChangescB`seZRS((RR(((sV/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_configsync_action.pyR+�stReportableChangescB`seZRS((RR(((sV/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_configsync_action.pyR,�st
DifferencecB`seZRS((RR(((sV/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_configsync_action.pyR-�st
ModuleManagercB`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(Ntmoduletparams(
tgetR R/R
R0tclientRtwantR+tchanges(Rtargstkwargs((sV/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_configsync_action.pyt__init__�scC`sK|jdg�}x2|D]*}|jjjd|dd|d�qWdS(Nt
__warningstmsgtversion(tpopR2R/t	deprecate(RRtwarningstwarning((sV/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_configsync_action.pyt_announce_deprecations�s


cC`smt�}|j�}td|jj��}|j�}|j|�|jtd|��|j|�|S(NR0tchanged(tdicttpresentR,R4R*tupdateR?(RRR@t
reportableR4((sV/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_configsync_action.pytexec_module�s	

cC`sT|j�std��n|j�r6td��n|j�rFtS|j�SdS(Ns+The specified 'device_group' not not exist.sJThis device group needs an initial sync. Please use 'sync_device_to_group'(t_device_group_existsRt_sync_to_group_requiredtexistsR"texecute(R((sV/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_configsync_action.pyRB�scC`s,|j�}|dkr(|jjr(tStS(NsAwaiting Initial Sync(t_get_status_from_resourceR3RR!R"(RR((sV/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_configsync_action.pyRG�scC`s�dj|jjd|jjd|jj�}|jjj|�}y|j�}Wntk
rht	SX|j
dks�d|kr�|ddkr�t	StS(Ns+https://{0}:{1}/mgmt/tm/cm/device-group/{2}tservertserver_porti�tcode(tformatR2tproviderR3tdevice_grouptapiR1tjsont
ValueErrorR"RR!(Rturitresptresponse((sV/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_configsync_action.pyRF�s


+cC`s|j�|j�tS(N(texecute_on_devicet_wait_for_syncR!(R((sV/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_configsync_action.pyRI�s

cC`s$|j�}|dkrtStSdS(NsIn Sync(RJR!R"(RR((sV/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_configsync_action.pyRHscC`sdj|jj|jj|jj�}dj|jjd|jjd�}tddd|�}|jjj	|d|�}y|j
�}Wn%tk
r�}tt
|���nXd	|kr|d	d
krd|kr�t|d��qt|j��ndS(Nsconfig-sync {0} {1} {2}shttps://{0}:{1}/mgmt/tm/cmRKRLtcommandtruntutilCmdArgsRRRMi�tmessage(RNR3RRPRR2RORARQtpostRRRSRtstrtcontent(Rtsync_cmdRTR5RURVtex((sV/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_configsync_action.pyRW
s&		
	cC`s�x�tdd�D]�}tjd�|j�}|d
krW|j�}|j|�q|dkrfq|dkrvdS|dkr�td	��qt|��qWdS(Nii�isChanges PendingsAwaiting Initial SyncsNot All Devices SyncedsIn SynctDisconnectedsqOne or more devices are unreachable (disconnected). Resolve any communication problems before attempting to sync.(sChanges Pending(sAwaiting Initial SyncsNot All Devices Synced(trangettimetsleepRJt_get_details_from_resourcet_validate_pending_statusR(RtxRtdetails((sV/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_configsync_action.pyRX%s
cC`s�dj|jjd|jjd�}|jjj|�}y|j�}Wn%tk
rr}tt|���nXd|kr�|ddkr�d|kr�t|d��q�t|j	��n|S(Ns'https://{0}:{1}/mgmt/tm/cm/sync-status/RKRLRMi�R\(
RNR2RORQR1RRRSRR^R_(RRTRURVRa((sV/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_configsync_action.pytread_current_from_deviceGs
cC`sH|j�}|dj�}|j�\}}|dddd}|S(NtentriestnestedStatsRtdescription(Rjtcopytpopitem(RtresourceRktktvR((sV/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_configsync_action.pyRJYs
cC`si|j�}|dj�}tr1t|�}ntd��t|jd��}|ddd�}|S(NRksCobjectpath module required, install objectpath module to continue. s$..*["details"]["description"]i����(RjRntHAS_OBJPATHRRtlistRI(RRptstatsttreeRiR((sV/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_configsync_action.pyRf`s	cC`sKd}x>|D]6}tj||�}|r
t|jd���q
q
WdS(sOValidate the content of a pending sync operation

        This is a hack. The REST API is not consistent with its 'status' values
        so this method is here to check the returned strings from the operation
        and see if it reported any of these inconsistencies.

        :param details:
        :raises F5ModuleError:
        s!.*(?P<msg>Recommended\s+action.*)R9N(tretsearchRtgroup(RRitpattern1tdetailtmatches((sV/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_configsync_action.pyRgms


(RRR7R?RERBRGRFRIRHRWRXRjRJRfRg(((sV/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_configsync_action.pyR.�s										"			
tArgumentSpeccB`seZd�ZRS(cC`s�t|_tdtdd�dtdd�dtdddd�dtd	t��}i|_|jjt�|jj|�ddgg|_ddgg|_dS(
NRttypetbooltsync_most_recent_to_deviceRtdefaulttnoRPtrequired(	R"tsupports_check_modeRAR!t
argument_specRCR
trequired_one_oftmutually_exclusive(RR�((sV/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_configsync_action.pyR7s 					(RRR7(((sV/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_configsync_action.pyR}~sc	C`s�t�}td|jd|jd|jd|j�}y,td|�}|j�}|j|�Wn)t	k
r�}|j
dt|��nXdS(NR�R�R�R�R/R9(R}RR�R�R�R�R.REt	exit_jsonRt	fail_jsonR^(tspecR/tmmtresultsRa((sV/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_configsync_action.pytmain�s				t__main__(*t
__future__RRRR~t
__metaclass__tANSIBLE_METADATAt
DOCUMENTATIONtEXAMPLEStRETURNRwRdtansible.module_utils.basicRt)ansible.module_utils.parsing.convert_boolR	t%library.module_utils.network.f5.bigipR
t&library.module_utils.network.f5.commonRRR
tImportErrort%ansible.module_utils.network.f5.bigipt&ansible.module_utils.network.f5.commont
objectpathRR!RsR"RRRR%R+R,tobjectR-R.R}R�R(((sV/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_configsync_action.pyt<module>sL


, 



'�	

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