You can use regex for that Here is an piece of my code for doing that. In my case [environment, 1 letter][collo, 2 letters] if $hostname =~ /^(.)(..)/ { $global_env = $1 $location = $2 } Steven Date: Wed, 24 Oct 2012 07:14:50 -0700 From: paolo.sup...@gmail.com To: puppet-users@googlegroups.com Subject: [Puppet Users] puppet facter variable substring
Hi I have a serires of servers that their hostname (not FQDN) is built in the same manner [header, 3 letters][collo, 4 letters][environment, 3 letters][number, 4 digits]. There's no specific separator between each part of hostname. Is there way I can extract the collo part of the hostname in puppet? TIA Paolo -- You received this message because you are subscribed to the Google Groups "Puppet Users" group. To view this discussion on the web visit https://groups.google.com/d/msg/puppet-users/-/M8d-zyzlHw8J. 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. -- 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.