mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-07-27 07:01:22 -07:00
add createparent option to zfs create
This commit is contained in:
parent
7ccd958ffd
commit
ac3614527d
1 changed files with 8 additions and 3 deletions
|
@ -250,7 +250,7 @@ class Zfs(object):
|
||||||
if self.module.check_mode:
|
if self.module.check_mode:
|
||||||
self.changed = True
|
self.changed = True
|
||||||
return
|
return
|
||||||
properties=self.properties
|
properties = self.properties
|
||||||
volsize = properties.pop('volsize', None)
|
volsize = properties.pop('volsize', None)
|
||||||
volblocksize = properties.pop('volblocksize', None)
|
volblocksize = properties.pop('volblocksize', None)
|
||||||
if "@" in self.name:
|
if "@" in self.name:
|
||||||
|
@ -260,6 +260,10 @@ class Zfs(object):
|
||||||
|
|
||||||
cmd = [self.module.get_bin_path('zfs', True)]
|
cmd = [self.module.get_bin_path('zfs', True)]
|
||||||
cmd.append(action)
|
cmd.append(action)
|
||||||
|
|
||||||
|
if createparent:
|
||||||
|
cmd.append('-p')
|
||||||
|
|
||||||
if volblocksize:
|
if volblocksize:
|
||||||
cmd.append('-b %s' % volblocksize)
|
cmd.append('-b %s' % volblocksize)
|
||||||
if properties:
|
if properties:
|
||||||
|
@ -271,7 +275,7 @@ class Zfs(object):
|
||||||
cmd.append(self.name)
|
cmd.append(self.name)
|
||||||
(rc, err, out) = self.module.run_command(' '.join(cmd))
|
(rc, err, out) = self.module.run_command(' '.join(cmd))
|
||||||
if rc == 0:
|
if rc == 0:
|
||||||
self.changed=True
|
self.changed = True
|
||||||
else:
|
else:
|
||||||
self.module.fail_json(msg=out)
|
self.module.fail_json(msg=out)
|
||||||
|
|
||||||
|
@ -345,6 +349,7 @@ def main():
|
||||||
'checksum': {'required': False, 'choices':['on', 'off', 'fletcher2', 'fletcher4', 'sha256']},
|
'checksum': {'required': False, 'choices':['on', 'off', 'fletcher2', 'fletcher4', 'sha256']},
|
||||||
'compression': {'required': False, 'choices':['on', 'off', 'lzjb', 'gzip', 'gzip-1', 'gzip-2', 'gzip-3', 'gzip-4', 'gzip-5', 'gzip-6', 'gzip-7', 'gzip-8', 'gzip-9', 'lz4', 'zle']},
|
'compression': {'required': False, 'choices':['on', 'off', 'lzjb', 'gzip', 'gzip-1', 'gzip-2', 'gzip-3', 'gzip-4', 'gzip-5', 'gzip-6', 'gzip-7', 'gzip-8', 'gzip-9', 'lz4', 'zle']},
|
||||||
'copies': {'required': False, 'choices':['1', '2', '3']},
|
'copies': {'required': False, 'choices':['1', '2', '3']},
|
||||||
|
'createparent': {'required': False, 'choices':['on', 'off']},
|
||||||
'dedup': {'required': False, 'choices':['on', 'off']},
|
'dedup': {'required': False, 'choices':['on', 'off']},
|
||||||
'devices': {'required': False, 'choices':['on', 'off']},
|
'devices': {'required': False, 'choices':['on', 'off']},
|
||||||
'exec': {'required': False, 'choices':['on', 'off']},
|
'exec': {'required': False, 'choices':['on', 'off']},
|
||||||
|
@ -396,7 +401,7 @@ def main():
|
||||||
result['name'] = name
|
result['name'] = name
|
||||||
result['state'] = state
|
result['state'] = state
|
||||||
|
|
||||||
zfs=Zfs(module, name, properties)
|
zfs = Zfs(module, name, properties)
|
||||||
|
|
||||||
if state == 'present':
|
if state == 'present':
|
||||||
if zfs.exists():
|
if zfs.exists():
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue