FAQ
I'm new to Puppet (yay!) and working through having a different resolv.conf
for systems that contain a certain string in their hostname.

I've got the following in my modules/system/files.pp:

class system::files {
case $hostname {
/^uklab*$/: {
$file = "resolv-isg.conf"
}
default: {
$file = "resolv-internal.conf"
}
}

file { '/etc/resolv.conf':
source => "puppet:///modules/system/$file"
}
}

For some reason it always uses the default, what am I doing wrong? I've
done loads of Googling around but can't seem to find a reasonable answer. I
know I could use a different module per node but didn't want to have loads
of per-node nodules but is this the only way?

--
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/-/ycBO-sSvP6sJ.
To post to this group, send email to puppet-users@googlegroups.com.
To unsubscribe from this group, send email to puppet-users+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.

Search Discussions

  • Roman Shaposhnik at Dec 27, 2012 at 6:50 pm

    On Thu, Dec 27, 2012 at 5:29 AM, Allan Mullan wrote:
    I'm new to Puppet (yay!) and working through having a different resolv.conf
    for systems that contain a certain string in their hostname.

    I've got the following in my modules/system/files.pp:

    class system::files {
    case $hostname {
    Off the top of my head you may want to try $::fqdn instead.

    Thanks,
    Roman.

    --
    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+unsubscribe@googlegroups.com.
    For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.
  • Aaron Russo at Dec 27, 2012 at 7:02 pm
    I think you might have an error in your regex. In particular, it looks like
    you're missing a '.', so /^uklab*$/ should probably be /^uklab.*$/

    Cheers,

    Aaron Russo
    IST Infrastructure Services, Unix Group
    UC Berkeley
    ---
    Desk: 510-643-5550Mobile: 510-206-1532
    IM: arusso@berkeley.edu (XMPP/Jabber)


    On Thu, Dec 27, 2012 at 5:29 AM, Allan Mullan wrote:

    case $hostname {
    /^uklab*$/: {
    $file = "resolv-isg.conf"
    }
    default: {
    $file = "resolv-internal.conf"
    }
    --
    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+unsubscribe@googlegroups.com.
    For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
grouppuppet-users @
categoriespuppet
postedDec 27, '12 at 5:12p
activeDec 27, '12 at 7:02p
posts3
users3
websitepuppetlabs.com

People

Translate

site design / logo © 2022 Grokbase