Anons79 Mini Shell

Directory : /lib/python2.7/site-packages/ansible/modules/storage/zfs/
Upload File :
Current File : //lib/python2.7/site-packages/ansible/modules/storage/zfs/zfs.pyo

�
�Udac@`s�ddlmZmZmZeZidd6dgd6dd6ZdZd	Zdd
l	Z	ddl
mZdefd
��YZ
d�Zedkr�e�nd
S(i(tabsolute_importtdivisiontprint_functions1.1tmetadata_versiontpreviewtstatust	communitytsupported_bys/
---
module: zfs
short_description: Manage zfs
description:
  - Manages ZFS file systems, volumes, clones and snapshots
version_added: "1.1"
options:
  name:
    description:
      - File system, snapshot or volume name e.g. C(rpool/myfs).
    required: true
  state:
    description:
      - Whether to create (C(present)), or remove (C(absent)) a
        file system, snapshot or volume. All parents/children
        will be created/destroyed as needed to reach the desired state.
    choices: [ absent, present ]
    required: true
  origin:
    description:
      - Snapshot from which to create a clone.
  extra_zfs_properties:
    description:
      - A dictionary of zfs properties to be set.
      - See the zfs(8) man page for more information.
    version_added: "2.5"
author:
- Johan Wiren (@johanwiren)
s@
- name: Create a new file system called myfs in pool rpool with the setuid property turned off
  zfs:
    name: rpool/myfs
    state: present
    extra_zfs_properties:
      setuid: off

- name: Create a new volume called myvol in pool rpool.
  zfs:
    name: rpool/myvol
    state: present
    extra_zfs_properties:
      volsize: 10M

- name: Create a snapshot of rpool/myfs file system.
  zfs:
    name: rpool/myfs@mysnapshot
    state: present

- name: Create a new file system called myfs2 with snapdir enabled
  zfs:
    name: rpool/myfs2
    state: present
    extra_zfs_properties:
      snapdir: enabled

- name: Create a new file system by cloning a snapshot
  zfs:
    name: rpool/cloned_fs
    state: present
    origin: rpool/myfs@mysnapshot

- name: Destroy a filesystem
  zfs:
    name: rpool/myfs
    state: absent
N(t
AnsibleModuletZfscB`sYeZd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Z	d�Z
RS(	cC`s�||_||_||_t|_|jdt�|_|jdt�|_|j	d�dj	d�d|_
tj�ddk|_
|j�|_|j�|_dS(Ntzfstzpoolt/it@tSunOS(tmoduletnamet
propertiestFalsetchangedtget_bin_pathtTruetzfs_cmdt	zpool_cmdtsplittpooltostunamet
is_solarist
check_openzfst
is_openzfstcheck_enhanced_sharingtenhanced_sharing(tselfRRR((sC/usr/lib/python2.7/site-packages/ansible/modules/storage/zfs/zfs.pyt__init__\s				#cC`s�|jg}|jddg�|j|j�|jj|dt�\}}}|j�dj�d}|dkrztSt	|�dkr�tSt
S(Ntgettversiontcheck_rci����it-i�(RtextendtappendRRtrun_commandRt
splitlinesRtintR(R!tcmdtrctoutterrR$((sC/usr/lib/python2.7/site-packages/ansible/modules/storage/zfs/zfs.pyRhs!cC`s�|jr�|jr�|jg}|jddg�|j|j�|jj|dt�\}}}|j	�dj
�d}t|�dkr�tSntS(NR#R$R%i����ii"(
RRRR'R(RRR)RR*RR+R(R!R,R-R.R/R$((sC/usr/lib/python2.7/site-packages/ansible/modules/storage/zfs/zfs.pyRts!cC`sW|jddd|jg}|jjdj|��\}}}|dkrOtStSdS(Ntlists-ttallt i(RRRR)tjoinRR(R!R,R-R.R/((sC/usr/lib/python2.7/site-packages/ansible/modules/storage/zfs/zfs.pytexistss
$c
C`s�|jjrt|_dS|j}|jjjdd�}|jg}d|j	kr^d}n|rmd}nd}|j
|�|dkr�|dg7}n|rxu|j�D]d\}}|dkr�|d|g7}q�|d	kr�|d
|g7}q�|dd||fg7}q�Wn|r<|dkr<|j
|�n|j
|j	�|jjd
j
|��\}}}	|dkr�t|_n|jjd|	�dS(NtoriginR
tsnapshottclonetcreates-ptvolsizes-Vtvolblocksizes-bs-os%s="%s"R2itmsg(screateR7(Rt
check_modeRRRtparamsR#tNoneRRR(titemsR)R3t	fail_json(
R!RR5R,tactiontproptvalueR-R.R/((sC/usr/lib/python2.7/site-packages/ansible/modules/storage/zfs/zfs.pyR8�s8				
!$cC`s�|jjrt|_dS|jdd|jg}|jjdj|��\}}}|dkrmt|_n|jjd|�dS(Ntdestroys-RR2iR;(	RR<RRRRR)R3R@(R!R,R-R.R/((sC/usr/lib/python2.7/site-packages/ansible/modules/storage/zfs/zfs.pyRD�s	$cC`s�|jjrt|_dS|jd|dt|�|jg}|jj|�\}}}|dkrrt|_n|jjd|�dS(Ntsett=iR;(	RR<RRRtstrRR)R@(R!RBRCR,R-R.R/((sC/usr/lib/python2.7/site-packages/ansible/modules/storage/zfs/zfs.pytset_property�s	&cC`s[|j�}xH|jj�D]7\}}|j|d�|kr|j||�qqWdS(N(tget_current_propertiesRR?R#R>RH(R!tcurrent_propertiesRBRC((sC/usr/lib/python2.7/site-packages/ansible/modules/storage/zfs/zfs.pytset_properties_if_changed�sc
C`s|jddg}|jr+|dg7}n|d|jg7}|jjdj|��\}}}t�}xYg|j�D]}|jd�dd!^q{D](\}}}	|	d	kr�|||<q�q�W|jr�|j	d
d�|d<|j	dd�|d
<n|S(NR#s-Hs-eR1R2s	iitlocals	share.nfstsharenfss	share.smbtsharesmb(RR RRR)R3tdictR*RR#R>(
R!R,R-R.R/RtlRBRCtsource((sC/usr/lib/python2.7/site-packages/ansible/modules/storage/zfs/zfs.pyRI�s	$	?	(t__name__t
__module__R"RRR4R8RDRHRKRI(((sC/usr/lib/python2.7/site-packages/ansible/modules/storage/zfs/zfs.pyR	Zs					%			cC`s�tdtdtdddt�dtdddtddd	g�d
tdddd�dtdd
di��dt�}|jjd�}|jjd�}|jjd
�r�d|kr�|jdd�nxu|jdj�D]`\}}t|t	�r0|tkrd|jd|<qAd|jd|<q�||jd|<q�Wtd|d|�}t
|||jd�}|d	kr�|j�r�|j�q�|j
�n(|dkr�|j�r�|j�q�n|j|j�|j|d<|j|�dS(Nt
argument_specRttypeRGtrequiredtstatetchoicestabsenttpresentR5tdefaulttextra_zfs_propertiesROtsupports_check_modeR
R;s2cannot specify origin when operating on a snapshottontoffR(RRORR>R=R#R@R?t
isinstancetboolR	R4RKR8RDtupdateRRt	exit_json(RRWRRBRCtresultR
((sC/usr/lib/python2.7/site-packages/ansible/modules/storage/zfs/zfs.pytmain�s>!	 	


t__main__(t
__future__RRRRUt
__metaclass__tANSIBLE_METADATAt
DOCUMENTATIONtEXAMPLESRtansible.module_utils.basicRtobjectR	ReRR(((sC/usr/lib/python2.7/site-packages/ansible/modules/storage/zfs/zfs.pyt<module>s


'	2

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