Go to main content

Using Puppet to Perform Configuration Management in Oracle® Solaris 11.3

Exit Print View

Updated: September 2018
 
 

Using Puppet to Configure ZFS File Systems

The following example shows how you could define ZFS file system configuration in a Puppet manifest by using the zfs resource type.

Example 5  Configuring ZFS File Systems With Puppet

You would first display a list of all of the attributes that you can declare for the zfs resource type as follows:

# 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, you would 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