Anons79 Mini Shell

Directory : /lib/python2.7/site-packages/ansible/modules/web_infrastructure/
Upload File :
Current File : //lib/python2.7/site-packages/ansible/modules/web_infrastructure/ejabberd_user.pyc

�
�Udac@`s�ddlmZmZmZeZidd6dgd6dd6ZdZd	Zdd
l	Z	ddl
mZdefd
��YZ
defd��YZd�Zedkr�e�nd
S(i(tabsolute_importtdivisiontprint_functions1.1tmetadata_versiontpreviewtstatust	communitytsupported_bys�
---
module: ejabberd_user
version_added: "1.5"
author: "Peter Sprygada (@privateip)"
short_description: Manages users for ejabberd servers
requirements:
    - ejabberd with mod_admin_extra
description:
    - This module provides user management for ejabberd servers
options:
    username:
        description:
            - the name of the user to manage
        required: true
    host:
        description:
            - the ejabberd host associated with this username
        required: true
    password:
        description:
            - the password to assign to the username
        required: false
    logging:
        description:
            - enables or disables the local syslog facility for this module
        required: false
        default: false
        type: bool
    state:
        description:
            - describe the desired state of the user to be managed
        required: false
        default: 'present'
        choices: [ 'present', 'absent' ]
notes:
    - Password parameter is required for state == present only
    - Passwords must be stored in clear text for this release
    - The ejabberd configuration file must include mod_admin_extra as a module.
s5
# Example playbook entries using the ejabberd_user module to manage users state.

- name: create a user if it does not exist
  ejabberd_user:
    username: test
    host: server
    password: password

- name: delete a user if it exists
  ejabberd_user:
    username: test
    host: server
    state: absent
N(t
AnsibleModuletEjabberdUserExceptioncB`seZdZRS(s. Base exception for EjabberdUser class object (t__name__t
__module__t__doc__(((sT/usr/lib/python2.7/site-packages/ansible/modules/web_infrastructure/ejabberd_user.pyR	MstEjabberdUsercB`sbeZdZd�Zed��Zed��Zd�Zd�Zd�Z	d�Z
d�ZRS(	s This object represents a user resource for an ejabberd server.   The
    object manages user creation and deletion using ejabberdctl.  The following
    commands are currently supported:
        * ejabberdctl register
        * ejabberdctl deregister
    cC`sv||_|jjd�|_|jjd�|_|jjd�|_|jjd�|_|jjd�|_dS(Ntloggingtstatethosttusernametpassword(tmoduletparamstgetRRRtusertpwd(tselfR((sT/usr/lib/python2.7/site-packages/ansible/modules/web_infrastructure/ejabberd_user.pyt__init__Zs	cC`s^y7|j|j|jg}|jd|�\}}}Wn tk
rYd\}}}nX|S(s� This method will check the current user and see if the password has
        changed.   It will return True if the user does not match the supplied
        credentials and False if it does not
        tcheck_passwordisrequired attribute(s) missingN(iNsrequired attribute(s) missing(RRRtrun_commandR	tNone(Rtoptionstrctoutterr((sT/usr/lib/python2.7/site-packages/ansible/modules/web_infrastructure/ejabberd_user.pytchangedbs
cC`sey1|j|jg}|jd|�\}}}Wn tk
rSd\}}}nXtt|��S(s� This method will check to see if the supplied username exists for
        host specified.  If the user exists True is returned, otherwise False
        is returned
        t
check_accountisrequired attribute(s) missingN(iNsrequired attribute(s) missing(RRRR	Rtbooltint(RRRRR ((sT/usr/lib/python2.7/site-packages/ansible/modules/web_infrastructure/ejabberd_user.pytexistsos
cC`s:|jr6tjd|jj�tjtj|�ndS(s? This method will log information to the local syslog facility s
ansible-%sN(RtsyslogtopenlogRt_namet
LOG_NOTICE(Rtentry((sT/usr/lib/python2.7/site-packages/ansible/modules/web_infrastructure/ejabberd_user.pytlog|s	cC`sYt|�st�nd|}|dj|�7}|jd|�|jj|j��S(sw This method will run the any command specified and return the
        returns using the Ansible common module
        sejabberdctl %s t scommand: %s(tallR	tjoinR+RRtsplit(RtcmdR((sT/usr/lib/python2.7/site-packages/ansible/modules/web_infrastructure/ejabberd_user.pyR�s	
cC`sgy7|j|j|jg}|jd|�\}}}Wn tk
rYd\}}}nX|||fS(sM The update method will update the credentials for the user provided
        tchange_passwordisrequired attribute(s) missingN(iNsrequired attribute(s) missing(RRRRR	R(RRRRR ((sT/usr/lib/python2.7/site-packages/ansible/modules/web_infrastructure/ejabberd_user.pytupdate�s
cC`sgy7|j|j|jg}|jd|�\}}}Wn tk
rYd\}}}nX|||fS(sa The create method will create a new user on the host with the
        password provided
        tregisterisrequired attribute(s) missingN(iNsrequired attribute(s) missing(RRRRR	R(RRRRR ((sT/usr/lib/python2.7/site-packages/ansible/modules/web_infrastructure/ejabberd_user.pytcreate�s
cC`say1|j|jg}|jd|�\}}}Wn tk
rSd\}}}nX|||fS(s> The delete method will delete the user from the host
        t
unregisterisrequired attribute(s) missingN(iNsrequired attribute(s) missing(RRRR	R(RRRRR ((sT/usr/lib/python2.7/site-packages/ansible/modules/web_infrastructure/ejabberd_user.pytdelete�s
(R
RRRtpropertyR!R%R+RR2R4R6(((sT/usr/lib/python2.7/site-packages/ansible/modules/web_infrastructure/ejabberd_user.pyR
Rs	

			
	cC`stdtdtdddd�dtdddd�dtdddddt�d	tdd
dd
dg�d
tdtdd��dt�}t|�}d}tdt�}|jdkr"|jr�|jr�|j	dt�n|j
�\}}}|dkr|jd|d|�qq�n�|jd
kr�|jsn|jrV|j	dt�n|j�\}}}n=|j
r�|jr�|j	dt�n|j�\}}}n|dk	r�|dkr�|jd|d|�q�n|dkr�t|d<n
t|d<|j	|�dS(Nt
argument_specRtdefaultttypetstrRRtno_logRtpresenttchoicestabsentRR#tsupports_check_modeR!itmsgR(RtdictRtTruetFalseR
RR%t
check_modet	exit_jsonR6t	fail_jsonR4R!R2(RtobjRtresultRR ((sT/usr/lib/python2.7/site-packages/ansible/modules/web_infrastructure/ejabberd_user.pytmain�sB							

t__main__(t
__future__RRRR:t
__metaclass__tANSIBLE_METADATAt
DOCUMENTATIONtEXAMPLESR&tansible.module_utils.basicRt	ExceptionR	tobjectR
RJR
(((sT/usr/lib/python2.7/site-packages/ansible/modules/web_infrastructure/ejabberd_user.pyt<module>s


*\	-

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