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