can nodes be grouped with IP address?

92 views
Skip to first unread message

Hai Tao

unread,
Jul 5, 2012, 2:34:39 PM7/5/12
to puppet...@googlegroups.com
instead of using hostname wildcard, is there a way to define nodes by their IP addresses? for example, I want to put all nodes with 10.0.2.x and 10.0.3.0 to a nodes group called "testing". how can I do this?

thanks.

Steph Gosling

unread,
Jul 5, 2012, 2:40:05 PM7/5/12
to puppet...@googlegroups.com, Hai Tao
Hi,
Seems a bit backwards to me (you're the ones assigning the IP addresses
afterall) but I don't see why you couldn't do this with a custom fact
and a class that reads it.

Cheers,

Steph

--
Steph Gosling <st...@chuci.org>

Ryan Bowlby

unread,
Jul 9, 2012, 4:08:08 AM7/9/12
to puppet...@googlegroups.com
I would probably grimace and find my right eye twitch ramp back up if this was in my environment....but here you go:

node default {
  if $::ipaddress =~ /^10\.0\.[3,4]\.\d{1,3}$/ {
    include testing # testing class
  } 
}

Obviously make sure no other matching node defs exist for this host.

-Ryan
Reply all
Reply to author
Forward
0 new messages