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

�
�Udac@`sSddlmZmZmZeZidd6dgd6dd6ZdZd	Zd
Z	ddl
mZddl
mZytdd
l
mZddlmZddlmZddlmZddlmZddlmZddlmZWn�ek
ridd
lmZddlmZddlmZddlmZddlmZddlmZddlmZnXdefd��YZdefd��YZdefd��YZdefd��YZdefd��YZdefd��YZ d e!fd!��YZ"d"e!fd#��YZ#d$e!fd%��YZ$d&�Z%e&d'krOe%�nd(S()i(tabsolute_importtdivisiontprint_functions1.1tmetadata_versiontpreviewtstatust	certifiedtsupported_bys#
---
module: bigip_smtp
short_description: Manages SMTP settings on the BIG-IP
description:
  - Allows configuring of the BIG-IP to send mail via an SMTP server by
    configuring the parameters of an SMTP server.
version_added: 2.6
options:
  name:
    description:
      - Specifies the name of the SMTP server configuration.
    type: str
    required: True
  partition:
    description:
      - Device partition to manage resources on.
    type: str
    default: Common
  smtp_server:
    description:
      - SMTP server host name in the format of a fully qualified domain name.
      - This value is required when create a new SMTP configuration.
    type: str
  smtp_server_port:
    description:
      - Specifies the SMTP port number.
      - When creating a new SMTP configuration, the default is C(25) when
        C(encryption) is C(none) or C(tls). The default is C(465) when C(ssl) is selected.
    type: int
  local_host_name:
    description:
      - Host name used in SMTP headers in the format of a fully qualified
        domain name. This setting does not refer to the BIG-IP system's hostname.
    type: str
  from_address:
    description:
      - Email address that the email is being sent from. This is the "Reply-to"
        address that the recipient sees.
    type: str
  encryption:
    description:
      - Specifies whether the SMTP server requires an encrypted connection in
        order to send mail.
    type: str
    choices:
      - none
      - ssl
      - tls
  authentication:
    description:
      - Credentials can be set on an SMTP server's configuration even if that
        authentication is not used (think staging configs or emergency changes).
        This parameter acts as a switch to make the specified C(smtp_server_username)
        and C(smtp_server_password) parameters active or not.
      - When C(yes), the authentication parameters will be active.
      - When C(no), the authentication parameters will be inactive.
    type: bool
  smtp_server_username:
    description:
      - User name that the SMTP server requires when validating a user.
    type: str
  smtp_server_password:
    description:
      - Password that the SMTP server requires when validating a user.
    type: str
  state:
    description:
      - When C(present), ensures that the SMTP configuration exists.
      - When C(absent), ensures that the SMTP configuration does not exist.
    type: str
    choices:
      - present
      - absent
    default: present
  update_password:
    description:
      - Passwords are stored encrypted, so the module cannot know if the supplied
        C(smtp_server_password) is the same or different than the existing password.
        This parameter controls the updating of the C(smtp_server_password)
        credential.
      - When C(always), will always update the password.
      - When C(on_create), will only set the password for newly created SMTP server
        configurations.
    type: str
    choices:
      - always
      - on_create
    default: always
extends_documentation_fragment: f5
author:
  - Tim Rupp (@caphrim007)
s�
- name: Create a base SMTP server configuration
  bigip_smtp:
    name: my-smtp
    smtp_server: 1.1.1.1
    smtp_server_username: mail-admin
    smtp_server_password: mail-secret
    local_host_name: smtp.mydomain.com
    from_address: [email protected]
    state: present
    provider:
      user: admin
      password: secret
      server: lb.mydomain.com
  delegate_to: localhost
sQ
smtp_server:
  description: The new C(smtp_server) value of the SMTP configuration.
  returned: changed
  type: str
  sample: mail.mydomain.com
smtp_server_port:
  description: The new C(smtp_server_port) value of the SMTP configuration.
  returned: changed
  type: int
  sample: 25
local_host_name:
  description: The new C(local_host_name) value of the SMTP configuration.
  returned: changed
  type: str
  sample: smtp.mydomain.com
from_address:
  description: The new C(from_address) value of the SMTP configuration.
  returned: changed
  type: str
  sample: [email protected]
encryption:
  description: The new C(encryption) value of the SMTP configuration.
  returned: changed
  type: str
  sample: tls
authentication:
  description: Whether the authentication parameters are active or not.
  returned: changed
  type: bool
  sample: yes
(t
AnsibleModule(tenv_fallback(tF5RestClient(t
F5ModuleError(tAnsibleF5Parameters(tf5_argument_spec(ttransform_name(tis_valid_hostname(tis_valid_ipt
Parametersc	B`s�eZi	dd6dd6dd6dd6dd	6d
d6dd
6dd6dd6Zddddd	dd
ddg	Zdddddd
ddgZdddddd
ddgZRS(tsmtp_server_usernametusernametsmtp_server_passwordtpasswordEncryptedtlocal_host_namet
localHostNametsmtp_servertsmtpServerHostNametsmtp_server_porttsmtpServerPortt
encryptiontencryptedConnectiontauthentication_enabledtauthenticationEnabledtauthentication_disabledtauthenticationDisabledtfrom_addresstfromAddresstauthentication(t__name__t
__module__tapi_maptapi_attributestreturnablest
updatables(((sI/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_smtp.pyR�sF
		t
ApiParameterscB`seZRS((R%R&(((sI/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_smtp.pyR+�stModuleParameterscB`sDeZed��Zed��Zed��Zed��ZRS(cC`s|jddkrdSt|jd�r5|jdSt|jd�rYt|jd�Stdjt|jd����dS(NRsFThe provided 'local_host_name' value {0} is not a valid IP or hostname(t_valuestNoneRRtstrRtformat(tself((sI/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_smtp.pyR�scC`s,|jddkrdS|jdr(tSdS(NR$(R-R.tTrue(R1((sI/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_smtp.pyR�s
cC`s,|jddkrdS|jds(tSdS(NR$(R-R.R2(R1((sI/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_smtp.pyR �s
cC`s(|jddkrdSt|jd�S(NR(R-R.tint(R1((sI/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_smtp.pyRs(R%R&tpropertyRRR R(((sI/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_smtp.pyR,�stChangescB`seZd�ZRS(cC`sXi}y:x$|jD]}t||�||<qW|j|�}Wntk
rSnX|S(N(R)tgetattrt_filter_paramst	Exception(R1tresultt
returnable((sI/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_smtp.pyt	to_returns
(R%R&R;(((sI/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_smtp.pyR5
st
UsableChangescB`seZRS((R%R&(((sI/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_smtp.pyR<stReportableChangescB`s&eZed��Zed��ZRS(cC`sdS(N(R.(R1((sI/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_smtp.pyRscC`sdS(N(R.(R1((sI/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_smtp.pyR"s(R%R&R4RR(((sI/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_smtp.pyR=st
DifferencecB`sDeZdd�Zd�Zd�Zed��Zed��ZRS(cC`s||_||_dS(N(twantthave(R1R?R@((sI/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_smtp.pyt__init__(s	cC`s9yt||�}|SWntk
r4|j|�SXdS(N(R6tAttributeErrort_Difference__default(R1tparamR9((sI/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_smtp.pytcompare,s

cC`sQt|j|�}y&t|j|�}||kr7|SWntk
rL|SXdS(N(R6R?R@RB(R1RDtattr1tattr2((sI/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_smtp.pyt	__default3s
cC`s |jjdkrdS|jjS(Nt	on_create(R?tupdate_passwordR.R(R1((sI/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_smtp.pyR<scC`sx|jjr:|jj|jjkr:td|jj�Sn|jjrt|jj|jjkrttd|jj�SndS(NRtauthentication_disable(R?RR@tdictR (R1((sI/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_smtp.pyR$BsN(	R%R&R.RARERCR4RR$(((sI/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_smtp.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.RNR
ROtclientR,R?R+R@R<tchanges(R1targstkwargs((sI/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_smtp.pyRAQs
cC`sji}xBtjD]7}t|j|�dk	rt|j|�||<qqW|rftd|�|_ndS(NRO(RR)R6R?R.R<RR(R1tchangedtkey((sI/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_smtp.pyt_set_changed_optionsXs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(NRO(R>R?R@RR*RLRER.t
isinstancetupdateR<RRR2tFalse(R1tdiffR*RUtktchange((sI/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_smtp.pyt_update_changed_options`s		
cC`s|j�}|rtStS(N(R^R2RZ(R1R9((sI/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_smtp.pyt
should_updaterscC`s�t}t�}|jj}|dkr6|j�}n|dkrQ|j�}ntd|jj��}|j�}|j	|�|j	td|��|j
|�|S(NtpresenttabsentRORU(RZRLR?tstateR`RaR=RRR;RYt_announce_deprecations(R1RUR9Rbt
reportableRR((sI/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_smtp.pytexec_modulexs	

cC`sK|jdg�}x2|D]*}|jjjd|dd|d�qWdS(Nt
__warningstmsgtversion(tpopRQRNt	deprecate(R1R9twarningstwarning((sI/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_smtp.pyRc�s


cC`s$|j�r|j�S|j�SdS(N(texistsRYtcreate(R1((sI/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_smtp.pyR`�s
cC`s|j�r|j�StS(N(RmtremoveRZ(R1((sI/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_smtp.pyRa�s
cC`s=|j�|_|j�stS|jjr/tS|j�tS(N(tread_current_from_deviceR@R_RZRNt
check_modeR2tupdate_on_device(R1((sI/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_smtp.pyRY�s
cC`s9|jjrtS|j�|j�r5td��ntS(NsFailed to delete the resource.(RNRqR2tremove_from_deviceRmR(R1((sI/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_smtp.pyRo�s
cC`s(|j�|jjrtS|j�tS(N(RWRNRqR2tcreate_on_device(R1((sI/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_smtp.pyRn�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/sys/smtp-server/{2}tservertserver_porti�tcode(R0RQtproviderRR?t	partitiontnametapiRPtjsont
ValueErrorRZRR2(R1turitresptresponse((sI/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_smtp.pyRm�s


+cC`s�|jj�}|jj|d<|jj|d<dj|jjd|jjd�}|jjj|d|�}y|j	�}Wn%t
k
r�}tt|���nXd|kr�|ddkr�d
|kr�t|d
��q�t|j
��ndS(NRzRys(https://{0}:{1}/mgmt/tm/sys/smtp-server/RuRvR|Rwi�i�tmessage(i�i�(R?t
api_paramsRzRyR0RQRxR{tpostR|R}RR/tcontent(R1ROR~RR�tex((sI/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_smtp.pyRt�s
cC`s�|jj�}dj|jjd|jjdt|jj|jj��}|jjj	|d|�}y|j
�}Wn%tk
r�}tt
|���nXd|kr�|ddkr�d|kr�t|d��q�t|j��ndS(Ns+https://{0}:{1}/mgmt/tm/sys/smtp-server/{2}RuRvR|Rwi�R�(R?R�R0RQRxRRyRzR{tpatchR|R}RR/R�(R1ROR~RR�R�((sI/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_smtp.pyRr�s

cC`sjdj|jjd|jjdt|jj|jj��}|jjj|�}|j	dkrft
SdS(Ns+https://{0}:{1}/mgmt/tm/sys/smtp-server/{2}RuRvi�(R0RQRxRR?RyRzR{tdeleteRR2(R1R~R((sI/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_smtp.pyRs�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/sys/smtp-server/{2}RuRvRwi�R�RO(R0RQRxRR?RyRzR{RPR|R}RR/R�R+(R1R~RR�R�((sI/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_smtp.pyRp�s

(R%R&RARWR^R_ReRcR`RaRYRoRnRmRtRrRsRp(((sI/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_smtp.pyRMPs 																
tArgumentSpeccB`seZd�ZRS(cC`st|_tdtdt�dt�dtdd�dtdt�d	tdt�d
t�dtdd
ddg�dtdddddg�dt�dtdd�dtdddtdgf�dtdddddg��}i|_|jjt�|jj|�dS(NRztrequiredRRttypeR3Rtno_logRRRtchoicestnonetsslttlsRJtdefaulttalwaysRIR"R$tboolRytCommontfallbacktF5_PARTITIONRbR`Ra(R2tsupports_check_modeRLR	t
argument_specRYR
(R1R�((sI/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_smtp.pyRA	s.					(R%R&RA(((sI/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_smtp.pyR�scC`s�t�}td|jd|j�}y,td|�}|j�}|j|�Wn)tk
r{}|jdt	|��nXdS(NR�R�RNRg(
R�RR�R�RMRet	exit_jsonRt	fail_jsonR/(tspecRNtmmtresultsR�((sI/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_smtp.pytmain's		t__main__N('t
__future__RRRR�t
__metaclass__tANSIBLE_METADATAt
DOCUMENTATIONtEXAMPLEStRETURNtansible.module_utils.basicRR	t%library.module_utils.network.f5.bigipR
t&library.module_utils.network.f5.commonRRR
RRt)library.module_utils.network.f5.ipaddressRtImportErrort%ansible.module_utils.network.f5.bigipt&ansible.module_utils.network.f5.commont)ansible.module_utils.network.f5.ipaddressRR+R,R5R<R=tobjectR>RMR�R�R%(((sI/usr/lib/python2.7/site-packages/ansible/modules/network/f5/bigip_smtp.pyt<module>sJ


^!
0%
)�	

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