Anons79 Mini Shell

Directory : /lib/python2.7/site-packages/ansible/modules/remote_management/cobbler/
Upload File :
Current File : //lib/python2.7/site-packages/ansible/modules/remote_management/cobbler/cobbler_system.pyo

�
�Udac/@`suddlmZmZmZeZidd6dgd6dd6ZdZd	Zd
Z	ddl
Z
ddlZddlZddl
mZdd
lmZddlmZddlmZeddddddddddddddddddd d!d"d#d$d%d&d'd(d)d*d+d,d-d.d/d0d0d1d1d2d2d3d3d4d5d6d7�Zd8�Zd9�Zed:krqe�ndS(;i(tabsolute_importtdivisiontprint_functions1.1tmetadata_versiontpreviewtstatust	communitytsupported_bys.
---
module: cobbler_system
version_added: '2.7'
short_description: Manage system objects in Cobbler
description:
- Add, modify or remove systems in Cobbler
options:
  host:
    description:
    - The name or IP address of the Cobbler system.
    default: 127.0.0.1
  port:
    description:
    - Port number to be used for REST connection.
    - The default value depends on parameter C(use_ssl).
  username:
    description:
    - The username to log in to Cobbler.
    default: cobbler
  password:
    description:
    - The password to log in to Cobbler.
    required: yes
  use_ssl:
    description:
    - If C(no), an HTTP connection will be used instead of the default HTTPS connection.
    type: bool
    default: 'yes'
  validate_certs:
    description:
    - If C(no), SSL certificates will not be validated.
    - This should only set to C(no) when used on personally controlled sites using self-signed certificates.
    type: bool
    default: 'yes'
  name:
    description:
    - The system name to manage.
  properties:
    description:
    - A dictionary with system properties.
  interfaces:
    description:
    - A list of dictionaries containing interface options.
  sync:
    description:
    - Sync on changes.
    - Concurrently syncing Cobbler is bound to fail.
    type: bool
    default: no
  state:
    description:
    - Whether the system should be present, absent or a query is made.
    choices: [ absent, present, query ]
    default: present
author:
- Dag Wieers (@dagwieers)
notes:
- Concurrently syncing Cobbler is bound to fail with weird errors.
- On python 2.7.8 and older (i.e. on RHEL7) you may need to tweak the python behaviour to disable certificate validation.
  More information at L(Certificate verification in Python standard library HTTP clients,https://access.redhat.com/articles/2039753).
s1
- name: Ensure the system exists in Cobbler
  cobbler_system:
    host: cobbler01
    username: cobbler
    password: MySuperSecureP4sswOrd
    name: myhost
    properties:
      profile: CentOS6-x86_64
      name_servers: [ 2.3.4.5, 3.4.5.6 ]
      name_servers_search: foo.com, bar.com
    interfaces:
      eth0:
        macaddress: 00:01:02:03:04:05
        ipaddress: 1.2.3.4
  delegate_to: localhost

- name: Enable network boot in Cobbler
  cobbler_system:
    host: bdsol-aci-cobbler-01
    username: cobbler
    password: ins3965!
    name: bdsol-aci51-apic1.cisco.com
    properties:
      netboot_enabled: yes
    state: present
  delegate_to: localhost

- name: Query all systems in Cobbler
  cobbler_system:
    host: cobbler01
    username: cobbler
    password: MySuperSecureP4sswOrd
    state: query
  register: cobbler_systems
  delegate_to: localhost

- name: Query a specific system in Cobbler
  cobbler_system:
    host: cobbler01
    username: cobbler
    password: MySuperSecureP4sswOrd
    name: '{{ inventory_hostname }}'
    state: query
  register: cobbler_properties
  delegate_to: localhost

- name: Ensure the system does not exist in Cobbler
  cobbler_system:
    host: cobbler01
    username: cobbler
    password: MySuperSecureP4sswOrd
    name: myhost
    state: absent
  delegate_to: localhost
s�
systems:
  description: List of systems
  returned: C(state=query) and C(name) is not provided
  type: list
system:
  description: (Resulting) information about the system we are working with
  returned: when C(name) is provided
  type: dict
N(t
AnsibleModule(t	iteritems(t
xmlrpc_client(tto_texttbondingoptstbonding_optst
bridgeoptstbridge_optstconnected_modetcnamestdhcptagtdhcp_tagtdnsnametdns_namet	ifgatewayt
if_gatewayt
interfacetypetinterface_typetinterfacemastertinterface_mastert	ipaddresst
ip_addresstipv6addresstipv6_addresstipv6defaultgatewaytipv6_default_gatewaytipv6mtutipv6_mtut
ipv6prefixtipv6_prefixtipv6secondariestipv6_secondariesutipv6staticroutestipv6_static_routest
macaddresstmac_addresst
managementtmtutnetmasktstatictstaticroutest
static_routest
virtbridgetvirt_bridgecC`sDt�}|r@|jtd|�|�}|r@|d}q@n|S(Ntnamei(tdicttfind_system(tconnR4ttokentsystemtsystems((s\/usr/lib/python2.7/site-packages/ansible/modules/remote_management/cobbler/cobbler_system.pyt	getsystem�s	c!C`s�tdtdtdddd�dtdd�d	tdddd
�dtdddt�d
tdddt�dtdddt�dtdd�dtdd�dtdd�dtdddt�dtddddddddg��dt�}|jd	}|jd}|jd}|jd
}|jd}|jd}|jd}|r]dnd|jd<|s�|r|dnd|jd<ntd t�}tjj�}	d}
|s�ytj	�}
Wnt
k
r�tjt_q�Xtj
t_nd!j|j�}|
r%tj|d"|
�}ntj|�}y|j||�}
Wn�tjk
r�}|jd#d$jd%|d&t|�|j��nAtk
r�}|jd#d'jd%|d&t|�|j��nXt|||
�}|dkr|r||d(<q|j�|d)<n�|dkr�|r�|j||
�}xgt|jd�D]�\}}||kr~|jd*j|��n|||krMy$|j||||
�t|d <Wq�tk
r�}|jd#d+j|||��q�XqMqMWn�|j|
�}|j|d||
�t|d <|jdr�xst|jd�D][\}}y|j||||
�WqAtk
r�}|jd#d+j|||��qAXqAWnt�}|jdr�x�t|jd�D]�\}}x�t|�D]�\}}|dkrq�n|tkr)|jd*j|��n|sL|d|t||krYt|d <n||d,j||�<q�Wq�W|d tkr�|j|d-||
�q�n|j r|d r|j!||
�qn>|dkr|r|j s�|j"||
�nt|d <qn|j ru|jdru|d ruy|j#|
�Wqutk
rq}|jd#d.jt|���quXn|d3kr�t|||
�|d(<|j$r�td/|d0|d(�|d1<q�ntjj�|	}|j%d2|j&|�dS(4Nt
argument_specthostttypetstrtdefaults	127.0.0.1tporttinttusernametcobblertpasswordtno_logtuse_ssltbooltvalidate_certsR4t
interfacesR5t
propertiestsynctstatetpresenttchoicestabsenttquerytsupports_check_modethttpsthttptprotot443t80tchangeds#{proto}://{host}:{port}/cobbler_apitcontexttmsgs<Failed to log in to Cobbler '{url}' as '{username}'. {error}turlterrors%Connection to '{url}' failed. {error}R9R:s.Property '{0}' is not a valid system property.s$Unable to change '{0}' to '{1}'. {2}s{0}-{1}tmodify_interfacesFailed to sync Cobbler. {0}tbeforetaftertdifftelapsed(RPRN('RR5tTruetFalsetparamstdatetimetutcnowtNonetssltcreate_unverified_contexttAttributeErrort_create_unverified_contextt_create_default_contextt _create_unverified_https_contextt_create_default_https_contexttformatR
tServerProxytServertlogintFaultt	fail_jsonRt	ExceptionR;tget_systemstget_system_handleR	twarnt
modify_systemt
new_systemtIFPROPS_MAPPINGt
check_modetsave_systemt
remove_systemRLt_difft	exit_jsontseconds(tmoduleRCRERARGRIR4RMtresulttstarttssl_contextR[R7R8teR9t	system_idtkeytvaluetinterface_propertiestdevicetvaluesRa((s\/usr/lib/python2.7/site-packages/ansible/modules/remote_management/cobbler/cobbler_system.pytmain�s�'	






	
12
 -

 *	
 #
	!&	#t__main__(t
__future__RRRR>t
__metaclass__tANSIBLE_METADATAt
DOCUMENTATIONtEXAMPLEStRETURNtcopyReRhtansible.module_utils.basicRtansible.module_utils.sixR	tansible.module_utils.six.movesR
tansible.module_utils._textRR5R{R;R�t__name__(((s\/usr/lib/python2.7/site-packages/ansible/modules/remote_management/cobbler/cobbler_system.pyt<module>sT


?9		
	�

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