You can use facter in Puppet to get information about the host. There are a few facts that expose this information. Example below:
root@maxwell:~# facter | grep sdb blockdevice_sdb_model => LITEONIT LSS-32L blockdevice_sdb_size => 32017047552 blockdevice_sdb_vendor => ATA blockdevices => sda,sdb partitions => {"sda1"=>{"size"=>"1953092", "mount"=>"/boot/efi", "filesystem"=>"vfat"}, "sda2"=>{"uuid"=>"a15943d2-64b8-4b75-93dd-abaadc6d5d9d", "size"=>"974819328", "filesystem"=>"crypto_LUKS"}, "sdb1"=>{"size"=>"1048576", "filesystem"=>"vfat"}, "sdb2"=>{"uuid"=>"a1816270-320a-4756-9a2b-0d39eeda71c3", "size"=>"499712", "mount"=>"/boot", "filesystem"=>"ext2"}, "sdb3"=>{"uuid"=>"3758b8a8-1b62-4cf5-9622-0e1027061792", "size"=>"60981248", "filesystem"=>"crypto_LUKS"}} You'll of course want to be very careful that puppet doesn't wipe out your running installation. Something like $pvs = delete_at($blockdevices, 0) physical_volume { $pvs: ensure => present, } Note that this code has not been tested and is super dangerous. Cheers, Spencer Thanks, Spencer On Wed, Nov 19, 2014 at 5:15 PM, Kalai A <illiyama...@gmail.com> wrote: > Hi, > > I have below linux script > > cre_disk=$(ls /dev/sd[b-z]) > > for disk in $cre_isk > do > pvcreate $i > done > > > My understanding from the above code is, it is checking the sdb,sdc..sdz > disk file. > if it exist, then do physical volume creation. > > what my requirement is, need to convert the above linux into puppet(lvm > creation). > I know the command for physical volume creation > > physical volume{'/dev/sdb': > ensure => 'present' > } > > > I am not sure how to check the physical disk (cre_disk=$(ls /dev/sd[b-z])). > is there any resource available or puppet would take care without any > resource. > > -- > You received this message because you are subscribed to the Google Groups > "Puppet Developers" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to puppet-dev+unsubscr...@googlegroups.com. > To view this discussion on the web visit > https://groups.google.com/d/msgid/puppet-dev/6c65ac5e-ab9b-41f3-af14-90bbaebaaf3d%40googlegroups.com > <https://groups.google.com/d/msgid/puppet-dev/6c65ac5e-ab9b-41f3-af14-90bbaebaaf3d%40googlegroups.com?utm_medium=email&utm_source=footer> > . > For more options, visit https://groups.google.com/d/optout. > -- Spencer Krum (619)-980-7820 -- You received this message because you are subscribed to the Google Groups "Puppet Developers" group. To unsubscribe from this group and stop receiving emails from it, send an email to puppet-dev+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/puppet-dev/CADt6FWOvr%3D2i1vku7pXEVLUyZSv81V6YW84k%2BKYvnJb1hwxzKA%40mail.gmail.com. For more options, visit https://groups.google.com/d/optout.