amogh patel
2014-Oct-29  16:15 UTC
[Puppet Users] Filesystem mounting in sequence with puppet
Hi Puppet Users,
I've a requirement to create filesystem and mount 10 disks. For that,
I've
created this define and calling that define with hash. I need to mount 
these disks in sequence like below:
/dev/sdb1                         917G   72M  870G   1% /data/01
/dev/sdc1                         917G   72M  870G   1% /data/02
/dev/sdd1                         917G   72M  870G   1% /data/03
/dev/sde1                         917G   72M  870G   1% /data/04
/dev/sdf1                         917G   72M  870G   1% /data/05
/dev/sdg1                         917G   72M  870G   1% /data/06
/dev/sdh1                         917G   72M  870G   1% /data/07
/dev/sdi1                         917G   72M  870G   1% /data/08
/dev/sdj1                         917G   72M  870G   1% /data/09
/dev/sdk1                         917G   72M  870G   1% /data/10
But when I run puppet, it mounts in random order. Any suggestions please.
Here is the snippets of my code:
Define:
define base::fsdef (
  $mountpoint,
  $pdisk = $title
) {
  filesystem { $pdisk :
    ensure  => present,
    fs_type => 'ext4',
    options => '-b 4096',
  }
  file { $mountpoint :
    ensure  => directory,
    owner   => 'root',
    group   => 'root,
    mode    => '0755',
    require => Filesystem[$pdisk],
  }
  mount { "fstab_${pdisk}" :
    ensure  => mounted,
    name    => $mountpoint,
    device  => $pdisk,
    fstype  => 'ext4',
    options => 'defaults',
    atboot  => true,
    dump    => '1',
    pass    => '2',
    require => File[$mountpoint]
  }
}
Define call:
  $fs_hash = {
    '/dev/sdb1' => { mountpoint => '/data/01'},
    '/dev/sdc1' => { mountpoint => '/data/02'},
    '/dev/sdd1' => { mountpoint => '/data/03'},
    '/dev/sde1' => { mountpoint => '/data/04'},
    '/dev/sdf1' => { mountpoint => '/data/05'},
    '/dev/sdg1' => { mountpoint => '/data/06'},
    '/dev/sdh1' => { mountpoint => '/data/07'},
    '/dev/sdi1' => { mountpoint => '/data/08'},
    '/dev/sdj1' => { mountpoint => '/data/09'},
    '/dev/sdk1' => { mountpoint => '/data/10'},
   }
  create_resources(base::fsdef, $fs_hash)
-- 
You received this message because you are subscribed to the Google Groups
"Puppet Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to puppet-users+unsubscribe@googlegroups.com.
To view this discussion on the web visit
https://groups.google.com/d/msgid/puppet-users/500cc487-1346-41ad-8055-8cd194f139f9%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.