Set hostname, IP via razor hook or puppet module?

93 views
Skip to first unread message

Bret Wortman

unread,
Apr 18, 2016, 1:15:35 PM4/18/16
to puppet-razor
I'm debating whether to create a hook for razor that can retrieve a JSON document from a web service to set the hostname and IP address of a node based on an internal database, or whether to do that same work in puppet as a "firstboot" module which could be set to any node with names like /node.*/. This module would basically set the hostname and IP address before terminating with puppetlabs-reboot, after which Puppet would continue its work based on the profile assigned to its official hostname.

Is there a compelling reason to do one over the other? The razor approach seems cleaner, but I've got more experience developing puppet modules & custom facts than I have building hooks.


Bret

Scott McClellan

unread,
Apr 18, 2016, 4:10:01 PM4/18/16
to puppet...@googlegroups.com
On Mon, Apr 18, 2016 at 12:15 PM, Bret Wortman <br...@thewortmans.org> wrote:
I'm debating whether to create a hook for razor that can retrieve a JSON document from a web service to set the hostname and IP address of a node based on an internal database, or whether to do that same work in puppet as a "firstboot" module which could be set to any node with names like /node.*/. This module would basically set the hostname and IP address before terminating with puppetlabs-reboot, after which Puppet would continue its work based on the profile assigned to its official hostname.

Is there a compelling reason to do one over the other? The razor approach seems cleaner, but I've got more experience developing puppet modules & custom facts than I have building hooks.

I haven't explored "firstboot" modules before, but can speak to some of the contrast based on what you described. I agree in that the Razor approach seems more contained and elegant. The firstboot approach would require an extra reboot of the node, taking some extra time. Also, if you were to change the default hostname pattern in Razor, that might require an additional change in the puppet module to ensure the /node.*/ pattern still applies.

Razor seems like the right place to handle the setting of those properties before being handed over, so I'd recommend going with that approach.

Maintainability is important, so choose an executable language that is most comfortable to you. I find hook development to be pretty straightforward, but let me know if you hit any issues.

Bret

Hope that helps,

Scott 

--
You received this message because you are subscribed to the Google Groups "puppet-razor" group.
To unsubscribe from this group and stop receiving emails from it, send an email to puppet-razor...@googlegroups.com.
To post to this group, send email to puppet...@googlegroups.com.
Visit this group at https://groups.google.com/group/puppet-razor.
For more options, visit https://groups.google.com/d/optout.

Bret Wortman

unread,
Apr 18, 2016, 4:21:57 PM4/18/16
to puppet...@googlegroups.com
Excellent. Then I’ll give hook development a go tomorrow. Thanks,
Scott!


On 18 Apr 2016, at 16:09, Scott McClellan wrote:

> On Mon, Apr 18, 2016 at 12:15 PM, Bret Wortman <br...@thewortmans.org>
> wrote:
>
>> I'm debating whether to create a hook for razor that can retrieve a
>> JSON
>> document from a web service to set the hostname and IP address of a
>> node
>> based on an internal database, or whether to do that same work in
>> puppet as
>> a "firstboot" module which could be set to any node with names like
>> /node.\*/. This module would basically set the hostname and IP
>> address
>> before terminating with puppetlabs-reboot, after which Puppet would
>> continue its work based on the profile assigned to its official
>> hostname.
>>
>> Is there a compelling reason to do one over the other? The razor
>> approach
>> seems cleaner, but I've got more experience developing puppet modules
>> &
>> custom facts than I have building hooks.
>>
>
> I haven't explored "firstboot" modules before, but can speak to some
> of the
> contrast based on what you described. I agree in that the Razor
> approach
> seems more contained and elegant. The firstboot approach would require
> an
> extra reboot of the node, taking some extra time. Also, if you were to
> change the default hostname pattern in Razor, that might require an
> additional change in the puppet module to ensure the /node.\*/ pattern
> still
> applies.
>
> Razor seems like the right place to handle the setting of those
> properties
> before being handed over, so I'd recommend going with that approach.
>
> Maintainability is important, so choose an executable language that is
> most
> comfortable to you. I find hook development to be pretty
> straightforward,
> but let me know if you hit any issues.
>
> Bret
>>
>
> Hope that helps,
>
> Scott
>
>> --
>> You received this message because you are subscribed to the Google
>> Groups
>> "puppet-razor" group.
>> To unsubscribe from this group and stop receiving emails from it,
>> send an
>> email to puppet-razor...@googlegroups.com.
>> To post to this group, send email to puppet...@googlegroups.com.
>> Visit this group at https://groups.google.com/group/puppet-razor.
>> For more options, visit https://groups.google.com/d/optout.
>>
>
> --
> You received this message because you are subscribed to a topic in the
> Google Groups "puppet-razor" group.
> To unsubscribe from this topic, visit
> https://groups.google.com/d/topic/puppet-razor/CchybxwgGws/unsubscribe.
> To unsubscribe from this group and all its topics, send an email to
> puppet-razor...@googlegroups.com.
> To post to this group, send email to puppet...@googlegroups.com.
> Visit this group at https://groups.google.com/group/puppet-razor.
> For more options, visit https://groups.google.com/d/optout.


Bret Wortman
http://wrapbuddies.co/

Bret Wortman

unread,
May 6, 2016, 10:07:23 AM5/6/16
to puppet-razor
This approach works like a champ. Just sayin'.
>> To post to this group, send email to puppet...@googlegroups.com.
>> Visit this group at https://groups.google.com/group/puppet-razor.
>> For more options, visit https://groups.google.com/d/optout.
>>
>
> --
> You received this message because you are subscribed to a topic in the
> Google Groups "puppet-razor" group.
> To unsubscribe from this topic, visit
> https://groups.google.com/d/topic/puppet-razor/CchybxwgGws/unsubscribe.
> To unsubscribe from this group and all its topics, send an email to
Reply all
Reply to author
Forward
0 new messages