Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7975125
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T08:33:53+00:00 2026-06-04T08:33:53+00:00

Just getting started with Puppet, and I’m having trouble with my first template. It

  • 0

Just getting started with Puppet, and I’m having trouble with my first template. It should be very easy, but I can’t figure it out.

I have a module “base” at

/etc/puppet/modules/base/
    ./manifests
    ./manifests/service.pp
    ./manifests/init.pp
    ./manifests/params.pp
    ./manifests/config.pp
    ./manifests/install.pp
    ./templates
    ./templates/puppet.conf.erb

There’s other stuff, but it’s not necessary.

base/manifests/init.pp:

class base {
  include base::install, base::service, base::config, base::params
}

base/manifests/config.pp

class base::config {
  include base::params

  File {
    require => Class["base::install"],
    ensure => present,
    owner => root,
    group => root,
  }

  file { "/etc/puppet/puppet.conf":
    mode => 0644,
    content => template("base/puppet.conf.erb"),
    require => Class["base::install"],
    nofity => Service["puppet"],
  }
...

base/manifests/params.pp

class base::params {
  $puppetserver = "pup01.sdirect.lab"
}

Finally the interesting part of the template at base/templates/puppet.conf.erb

...
server=<% puppetserver %>

The error message:

err: Failed to parse template base/puppet.conf.erb: Could not find
value for ‘puppetserver’ at
/etc/puppet/modules/base/manifests/config.pp:13 on node …

I don’t get what the problem is. I’ve copied this part straight out of the Pro Puppet book.

Could someone show me where $puppetserver should be defined and how?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-04T08:33:55+00:00Added an answer on June 4, 2026 at 8:33 am

    The issue is that the name “puppetserver” needs to be fully qualified so Puppet can find the value, since it’s defined in a different scope to the one the template is evaluated in.

    The variable is defined in base::params so can only be referred to simply as “puppetserver” in that scope. When you’re evaluating the template from within base::config, you’re in a different scope and so you can’t refer to the variable simply by its short name. The “include” adds the other class to the catalog, but doesn’t change these rules.

    This means to access it, you fully qualify it with the class name: base::params::puppetserver. If you were using it in the manifest itself, this would be $base::params::puppetserver. You’ll see similar examples in Pro Puppet in the ssh::config and ssh::service classes where it refers to “ssh_service_name” in the params class (pages 43-45).

    To access the variable in a template it’s a bit different, use scope.lookupvar("base::params::puppetserver"). Taking your full example and adding a missing equals sign (to output the value) in the template:

    ...
    server=<%= scope.lookupvar("base::params::puppetserver") %>
    

    There’s a bit more information about scoping on the Scope and Puppet as of 2.7 page.

    (Edit: looks like it’s listed on the confirmed errata page too with the same solution.)

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Just getting started with MSpec and I can't seem to quite get my first
I'm just getting started with a project and wondered if someone can let me
I'm just getting started in CakePHP, and am running into trouble limiting retrieved results
Just getting started with C++, done a bit of C but one thing I
Hi I'm just getting started on the v4 CTP so I can see me
I'm just getting started with Boost for the first time, details: I'm using Visual
Just getting started on Scala Actors. The Scala website says: Thread-blocking operations can be
I'm just getting started with M-V-VM and WPF and having issues understanding some binding
I'm just getting started with grails, and I'm having an issue. I have a
I'm just getting started using ADO.NET and DataSets and DataTables. One problem I'm having

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.