�
�Udac @` s� d d l m Z m Z m Z e Z i d d 6d g d 6d d 6Z d Z d Z d
Z d d l
Z
d d l Z d d l m
Z
d d
l m Z d d l m Z d � Z e d k r� e � n d S( i ( t absolute_importt divisiont print_functions 1.1t metadata_versiont previewt statust communityt supported_bys
---
module: cobbler_sync
version_added: '2.7'
short_description: Sync Cobbler
description:
- Sync Cobbler to commit changes.
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'
author:
- Dag Wieers (@dagwieers)
todo:
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).
s�
- name: Commit Cobbler changes
cobbler_sync:
host: cobbler01
username: cobbler
password: MySuperSecureP4sswOrd
run_once: yes
delegate_to: localhost
s
# Default return values
N( t
AnsibleModule( t
xmlrpc_client( t to_textc C` s� t d t d t d d d d � d t d d � d t d d d d
� d t d d d t � d
t d d d t � d t d d d t � � d t � } | j d } | j d } | j d } | j d
} | j d } | r� d n d | j d <| s| r� d n d | j d <n t d t � } t j j � } d } | suy t j � } Wn t k
ret j
t _ quXt j t _
n d j | j � } | r�t j | d | �}
n t j | � }
y |
j | | � } Wn~ t j k
r} | j d d j d | d t | � | j � � n; t k
rJ} | j d d j d | d t | � � � n X| j s�y |
j | � Wq�t k
r�} | j d d j d t | � � � q�Xn t j j � | }
| j d |
j | � d S( Nt
argument_spect hostt typet strt defaults 127.0.0.1t portt intt usernamet cobblert passwordt no_logt use_sslt boolt validate_certst supports_check_modet httpst httpt protot 443t 80t changeds# {proto}://{host}:{port}/cobbler_apit contextt msgs<