Awesome, glad to hear that helped!

On Saturday, October 22, 2016, <aarb...@gmail.com> wrote:

> Thank you Rob.  I have it working using slice and some new variables.
>
> Here are my final scripts.
>
> Facter.add(:server_role) do
>   setcode do
>     ip_address = Facter.value(:ipaddress).tr('.', '')
>     ip_address = ip_address.to_i
>     host = Facter.value(:hostname)
>     if host[0,1] != "a"
>       server_role = 'workstation'
>     else
>       if ip_address.between?(1921680160, 1921680170)
>         server_role = host.slice(0,2)
>       else
>         server_role = host.slice(0.4)
>       end
>     end
>   end
> end
>
> Facter.add(:location_code) do
>   setcode do
>     address = Facter.value(:ipaddress).tr('.', '')
>     address = address.to_i
>     host = Facter.value(:hostname)
>     if host[0,1] != "a"
>       net = Facter.value(:network)
>       net = net[0..-3] += '.30'
>       net = Facter::Core::Execution.exec("nslookup #{net} | grep name |
> awk '{print $4}'")
>       net = net.partition('.').first
>       net = net[0..3]
>     else
>       if address.between?(1921680160, 1921680170)
>         location_code = host.slice(0,2)
>       else
>         location_code = host.slice(0,4)
>       end
>     end
>   end
> end
>
>
>
>
>
> --
> 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
> <javascript:_e(%7B%7D,'cvml','puppet-users%2bunsubscr...@googlegroups.com');>
> .
> To view this discussion on the web visit https://groups.google.com/d/
> msgid/puppet-users/e0a376db-83c9-4366-9ddd-318e6e298b36%40googlegroups.com
> <https://groups.google.com/d/msgid/puppet-users/e0a376db-83c9-4366-9ddd-318e6e298b36%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
> For more options, visit https://groups.google.com/d/optout.
>


-- 

Rob Nelson
rnels...@gmail.com

-- 
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/CAC76iT8jmP9Kzkz15DVwWs4F%3D278fxG5mVf-XXEOmWc2SNHzyQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to