Using Puppet to Configure ZFS File Systems
The following example shows how to use the zfs
resource type to
define a ZFS file system configuration in a Puppet manifest.
Example 5-2 Configuring ZFS File Systems With Puppet
Display the following list of the attributes (or parameters) that you can declare
for the zfs
resource type:
# puppet describe zfs
zfs
===
Manage zfs. Create destroy and set properties on zfs instances.
**Autorequires:** If Puppet is managing the zpool at the root of this zfs
instance, the zfs resource will autorequire it. If Puppet is managing any
parent zfs instances, the zfs resource will autorequire them.
Parameters
----------
- **aclinherit**
The aclinherit property. Valid values are `discard`, `noallow`,
`restricted`, `passthrough`, `passthrough-x`.
- **aclmode**
The aclmode property. Valid values are `discard`, `groupmask`,
`passthrough`.
- **atime**
The atime property. Valid values are `on`, `off`.
- **canmount**
The canmount property. Valid values are `on`, `off`, `noauto`.
- **checksum**
The checksum property. Valid values are `on`, `off`, `fletcher2`,
`fletcher4`, `sha256`.
- **compression**
The compression property. Valid values are `on`, `off`, `lzjb`, `gzip`,
`gzip-[1-9]`, `zle`.
- **copies**
The copies property. Valid values are `1`, `2`, `3`.
- **dedup**
The dedup property. Valid values are `on`, `off`.
- **devices**
The devices property. Valid values are `on`, `off`.
- **ensure**
The basic property that the resource should be in.
Valid values are `present`, `absent`.
.
.
.
Next, declare the zfs
resource type, with the following parameters,
in the manifest. Note that an additional attribute called readonly
has been added and it is set to on
.
zfs { 'rpool/test': ensure => 'present', readonly => 'on', }
You would verify the configuration by running the following commands on the node:
# zfs list rpool/test NAME USED AVAIL REFER MOUNTPOINT rpool/test 31K 31.8G 31K /rpool/test # zfs get readonly rpool/test NAME PROPERTY VALUE SOURCE rpool/test readonly on local