On Wednesday, October 29, 2014 11:15:45 AM UTC-5, amogh patel wrote: > > 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: >
Why does the sequence in which they are mounted matter? You do know that given the properties you specify, at system boot these filesystems will be mounted in parallel (which is likely to complete in random order), right? > > /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) > Why in the world are you creating a hash in your manifest and passing it to create_resources()? Ordinary resource declarations are clearer when all the resources and their parameters are statically known. For instance: base::fsdef { '/dev/sdb1': mountpoint => '/data/01'; '/dev/sdc1': mountpoint => '/data/02', require => Base::Fsdef[ '/dev/sdb1']; '/dev/sdd1': mountpoint => '/data/03', require => Base::Fsdef[ '/dev/sdc1']; '/dev/sde1': mountpoint => '/data/04', require => Base::Fsdef[ '/dev/sdd1']; '/dev/sdf1': mountpoint => '/data/05', require => Base::Fsdef[ '/dev/sde1']; '/dev/sdg1': mountpoint => '/data/06', require => Base::Fsdef[ '/dev/sdf1']; '/dev/sdh1': mountpoint => '/data/07', require => Base::Fsdef[ '/dev/sdg1']; '/dev/sdi1': mountpoint => '/data/08', require => Base::Fsdef[ '/dev/sdh1']; '/dev/sdj1': mountpoint => '/data/09', require => Base::Fsdef[ '/dev/sdi1']; '/dev/sdk1': mountpoint => '/data/10', require => Base::Fsdef[ '/dev/sdj1']; } That particular implementation also includes relationship declarations (in the form of require parameters) that will cause Puppet to manage those mounts in the order listed, in case you really do need that. There are other ways to set up such relationships, too. Note that this also means that if any of the mount resources fails then Puppet will not manage any of the subsequent ones (another difference from the system's at boot time). John -- 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+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/puppet-users/587c32e7-a14e-4fc4-9755-5ae67a1a8d4e%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.