What do you mean by private ip of the machine ?
If you have facter installed, you can do,
facter --puppet
to get a list of facts about the machines. Many of these facts will point to ipaddresses and other network parameters used by the machine.
facter --puppet | grep ipaddress
ipaddress => xxx.yy.zz.abc
ipaddress_eth0 => xxx.yy.zz.abc
ipaddress_lo => 127.0.0.1
facter --puppet | grep network
In your code you can do,
$my_ip = $::ipaddress