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

�
�Udac@`s�ddlmZmZmZeZidd6dgd6dd6ZdZd	Zd
Z	ddl
Z
ddlmZyTdd
l
mZddlmZddlmZddlmZddlmZWnaek
r%dd
lmZddlmZddlmZddlmZddlmZnXdefd��YZdefd��YZdefd��YZd�Zedkr�e�ndS(i(tabsolute_importtdivisiontprint_functions1.1tmetadata_versiontstableinterfacetstatust	certifiedtsupported_bys�	
---
module: bigip_device_trust
short_description: Manage the trust relationships between BIG-IPs
description:
  - Manage the trust relationships between BIG-IPs. Devices, once peered, cannot
    be updated. If updating is needed, the peer must first be removed before it
    can be re-added to the trust.
version_added: 2.5
options:
  peer_server:
    description:
      - The peer address to connect to and trust for synchronizing configuration.
        This is typically the management address of the remote device, but may
        also be a Self IP.
    type: str
    required: True
  peer_hostname:
    description:
      - The hostname that you want to associate with the device. This value will
        be used to easily distinguish this device in BIG-IP configuration.
      - When trusting a new device, if this parameter is not specified, the value
        of C(peer_server) will be used as a default.
    type: str
  peer_user:
    description:
      - The API username of the remote peer device that you are trusting. Note
        that the CLI user cannot be used unless it too has an API account. If this
        value is not specified, then the value of C(user), or the environment
        variable C(F5_USER) will be used.
    type: str
  peer_password:
    description:
      - The password of the API username of the remote peer device that you are
        trusting. If this value is not specified, then the value of C(password),
        or the environment variable C(F5_PASSWORD) will be used.
    type: str
  type:
    description:
      - Specifies whether the device you are adding is a Peer or a Subordinate.
        The default is C(peer).
      - The difference between the two is a matter of mitigating risk of
        compromise.
      - A subordinate device cannot sign a certificate for another device.
      - In the case where the security of an authority device in a trust domain
        is compromised, the risk of compromise is minimized for any subordinate
        device.
      - Designating devices as subordinate devices is recommended for device
        groups with a large number of member devices, where the risk of compromise
        is high.
    type: str
    choices:
      - peer
      - subordinate
    default: peer
  state:
    description:
      - When C(present), ensures the specified devices are trusted.
      - When C(absent), removes the device trusts.
    type: str
    choices:
      - absent
      - present
    default: present
extends_documentation_fragment: f5
author:
  - Tim Rupp (@caphrim007)
s�
- name: Add trusts for all peer devices to Active device
  bigip_device_trust:
    peer_server: "{{ item.ansible_host }}"
    peer_hostname: "{{ item.inventory_hostname }}"
    peer_user: "{{ item.bigip_username }}"
    peer_password: "{{ item.bigip_password }}"
    provider:
      server: lb.mydomain.com
      user: admin
      password: secret
  loop: hostvars
  when: inventory_hostname in groups['master']
  delegate_to: localhost
s
peer_server:
  description: The remote IP address of the trusted peer.
  returned: changed
  type: str
  sample: 10.0.2.15
peer_hostname:
  description: The remote hostname used to identify the trusted peer.
  returned: changed
  type: str
  sample: test-bigip-02.localhost.localdomain
N(t
AnsibleModule(tF5RestClient(t
F5ModuleError(tAnsibleF5Parameters(tf5_argument_spec(tis_valid_ipt
ParameterscB`s�eZidd6dd6dd6dd6dd	6Zd
ddddd	gZddgZgZd�Zed��Zed
��Z	ed��Z
RS(t
peer_hostnamet
deviceNamettypetcaDevicetpeer_servertdevicet	peer_usertusernamet
peer_passwordtpasswordtnamecC`s]i}y>x$|jD]}t||�||<qW|j|�}|SWntk
rX|SXdS(N(treturnablestgetattrt_filter_paramst	Exception(tselftresultt
returnable((sQ/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_device_trust.pyt	to_return�s
cC`sE|jddkrdSt|jd�r5|jdStd��dS(NRs:The provided 'peer_server' parameter is not an IP address.(t_valuestNoneR
R
(R((sQ/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_device_trust.pyR�scC`sF|jddkr|jStjd�}|jd|jd�}|S(NRs[^a-zA-Z0-9.\-_]t_(R"R#Rtretcompiletsub(RtregexR((sQ/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_device_trust.pyR�s
cC`s|jddkrtStS(NRtpeer(R"tTruetFalse(R((sQ/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_device_trust.pyR�s(t__name__t
__module__tapi_maptapi_attributesRt
updatablesR!tpropertyRRR(((sQ/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_device_trust.pyR�s$
		

t
ModuleManagercB`steZd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Z	d�Z
d	�Zd
�Zd�Z
RS(cO`s[|jdd�|_t|jj�|_d|_td|jj�|_t�|_	dS(Ntmoduletparams(
tgetR#R3R	R4tclientthaveRtwanttchanges(Rtargstkwargs((sQ/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_device_trust.pyt__init__�s
	cC`sji}xBtjD]7}t|j|�dk	rt|j|�||<qqW|rftd|�|_ndS(NR4(RRRR8R#R9(Rtchangedtkey((sQ/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_device_trust.pyt_set_changed_options�scC`s�t}t�}|jj}|dkr6|j�}n|dkrQ|j�}n|jj�}|j|�|jtd|��|S(NtpresenttabsentR=(	R+tdictR8tstateR@RAR9R!tupdate(RR=RRCR9((sQ/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_device_trust.pytexec_module�s	
cC`sm|jjr|jS|jjjdd�r>|jjjd�S|jjjdd�ri|jjjd�SdS(NR(R8RtproviderR5R#R3R4(R((sQ/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_device_trust.pytprovided_password�scC`sj|jjr|jS|jjjdd�r;|jjd�S|jjjdd�rf|jjjd�SdS(Ntuser(R8RRFR5R#R3R4(R((sQ/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_device_trust.pytprovided_username�scC`s|j�rtS|j�SdS(N(texistsR+tcreate(R((sQ/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_device_trust.pyR@�scC`s�|j�|jjdkr<|jji|j�d6�n|jjdkrn|jji|j�d6�n|jjdkr�|jji|jj	d6�n|j
jr�tS|j
�tS(NRRR(R?R8RR#RDRIRRGRRR3t
check_modeR*tcreate_on_device(R((sQ/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_device_trust.pyRK�s
   
cC`s|j�r|j�StS(N(RJtremoveR+(R((sQ/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_device_trust.pyRAs
cC`sk|jjrtS|jjdkrB|jji|jjd6�n|j�|j	�rgt
d��ntS(NRs"Failed to remove the trusted peer.(R3RLR*R8RR#RDRtremove_from_deviceRJR
(R((sQ/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_device_trust.pyRNs 
cC`sdj|jjd|jjd�}|jjj|�}y|j�}Wn%tk
rr}tt|���nXd|kr�|ddkr�d|kr�t|d��q�t|j	��nxD|dD]8}y|d|j
jkr�tSWq�t
k
rq�Xq�WtS(	Ns!https://{0}:{1}/mgmt/tm/cm/devicetservertserver_porttcodei�tmessagetitemstmanagementIp(tformatR6RFtapiR5tjsont
ValueErrorR
tstrtcontentR8RR*tKeyErrorR+(RturitresptresponsetexR((sQ/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_device_trust.pyRJs&

cC`s�|jj�}|jidd6dd6�dj|jjd|jjd�}|jjj|d|�}y|j�}Wn%t	k
r�}t
t|���nXd	|kr�|d	d
kr�d|kr�t
|d��q�t
|j��ndS(NtruntcommandtRootRs(https://{0}:{1}/mgmt/tm/cm/add-to-trust/RPRQRXRRi�i�RS(i�i�(
R8t
api_paramsRDRVR6RFRWtpostRXRYR
RZR[(RR4R]R^R_R`((sQ/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_device_trust.pyRM's 	
cC`s|jj�}|jidd6|jjd6|jjd6�dj|jjd|jjd�}|jjj|d|�}y|j	�}Wn%t
k
r�}tt|���nXd	|kr|d	d
krd|kr�t|d��qt|j
��ndS(NRaRbRRs-https://{0}:{1}/mgmt/tm/cm/remove-from-trust/RPRQRXRRi�i�RS(i�i�(R8RdRDRRVR6RFRWReRXRYR
RZR[(RR4R]R^R_R`((sQ/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_device_trust.pyRO=s"	

(R,R-R<R?RERGRIR@RKRARNRJRMRO(((sQ/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_device_trust.pyR2�s									
		tArgumentSpeccB`seZd�ZRS(cC`s�t|_tdtdt�dt�dt�dtdt�dtdd	d
gdd	�dtdd
dd
dg��}i|_|jjt�|jj|�dS(NRtrequiredRRRtno_logRtchoicesR)tsubordinatetdefaultRCR@RA(R*tsupports_check_modeRBt
argument_specRDR(RRm((sQ/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_device_trust.pyR<Vs					(R,R-R<(((sQ/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_device_trust.pyRfUscC`s�t�}td|jd|j�}y,td|�}|j�}|j|�Wn)tk
r{}|jdt	|��nXdS(NRmRlR3tmsg(
RfRRmRlR2REt	exit_jsonR
t	fail_jsonRZ(tspecR3tmmtresultsR`((sQ/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_device_trust.pytmainks		t__main__(t
__future__RRRRt
__metaclass__tANSIBLE_METADATAt
DOCUMENTATIONtEXAMPLEStRETURNR%tansible.module_utils.basicRt%library.module_utils.network.f5.bigipR	t&library.module_utils.network.f5.commonR
RRt)library.module_utils.network.f5.ipaddressR
tImportErrort%ansible.module_utils.network.f5.bigipt&ansible.module_utils.network.f5.commont)ansible.module_utils.network.f5.ipaddressRtobjectR2RfRtR,(((sQ/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_device_trust.pyt<module>s6


E

;�	

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