I'm very confused about something. The definition below is used to set
up swap. The three definitions, lvm::swapvol_make, lvm::swapvol_on and
lvm::swapvol_fstab, where previously inside this definition, but I
broke them into separate defines as I realised that the more I use the
$ensure parameter on a resource, the more likely it was that I'd have
to perform certain functions multiple times.

Previously I could chain those three resources together with subscribe
and refreshonly. However, refreshonly only works with Exec {}
resources. So, now that they are in their own definitions, how do I do
this? I can't put the refreshonly in the definition, because a) I
don't think it will be in scope, and b) it makes the definition no
longer general in nature.

Doug.

define lvm::swapvol ( $ensure, $volume_group, $size, $pvdisk_count ) {

    case $ensure {

        'mounted': {
            #
            # Logical volumes.
            #
            lvm::logical_volume {
                #
                # Create a logical volume for swap.
                #
                "$name":
                    ensure       => present,
                    volume_group => "$volume_group",
                    size         => "$size",
                    pvdisk_count => "$pvdisk_count";
#                    require      => Lvm::Volume_group["$volume_group"];
            }

            lvm::swapvol_make {
                "$name":
                    volume_group => "$volume_group",
                    subscribe => Lvm::Logical_volume["$name"],
                    refreshonly => true;
            }

            lvm::swapvol_on {
                "$name":
                    volume_group => "$volume_group",
                    subscribe => Lvm::Swapvol_make["$name"],
                    refreshonly => true;
            }

            lvm::swapvol_fstab {
                "$name":
                    volume_group => "$volume_group",
                    subscribe => Lvm::Swapvol_on["$name"],
                    refreshonly => true;
            }

        }

        'umounted': {
        }

        'absent': {
        }

    }

}

-- 
You received this message because you are subscribed to the Google Groups 
"Puppet Users" group.
To post to this group, send email to puppet-users@googlegroups.com.
To unsubscribe from this group, send email to 
puppet-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/puppet-users?hl=en.

Reply via email to