3

I am using the WSUS Module with Puppet Master on Centos 7.2. My Puppet Agent servers are running Windows Server 2012.

I want to use a manifest with a variable. However, when the Puppet Agent server has the puppet agent run, it displays "error 400, syntax error." I have tried re-writing the manifest and every variation I could think of. I keep getting some error.

Here is one example of a manifest:

class excellent {
    class { 'wsus_client':
       $cool = 'Saturday'
    server_url => 'http://acme.com',
    auto_update_option  => 'Scheduled'
    scheduled_install_day => $cool,
    scheduled_install_hour => 1,
}
}

I've tried assigning the variable in braces {}. I tried to use $LOAD_PATH, --custom-dir and FACTERLIB. But I could not figure out how to use any of these three.

I want to change the variable in one place and use it within the scope of its parent class. What should I do?

2 Answers 2

7

Have you tried it this way?

class excellent {
  $cool = 'Saturday'

  class { 'wsus_client':
    server_url => 'http://acme.com',
    auto_update_option  => 'Scheduled'
    scheduled_install_day => $cool,
    scheduled_install_hour => 1,
  }
}

Or, this way

class excellent (
  $cool = 'Saturday'
){
  class { 'wsus_client':
    server_url => 'http://acme.com',
    auto_update_option  => 'Scheduled'
    scheduled_install_day => $cool,
    scheduled_install_hour => 1,
  }
}
2
  • Is there any difference between these two? Commented Sep 15, 2016 at 0:10
  • 2
    @StefanLasiewski yes, the second one makes $cool be a parameter for the class excellent. Meaning you could set it in heira, or in your class declaration for excellent.
    – Zoredache
    Commented Sep 15, 2016 at 0:34
1

You currently seem to be attempting to assign a value to a variable within the class declaration. Your variable assignment needs to be separate.

$cool = 'Saturday'

Your class declaration should look like this.

class {'namevar':
  a => 'a',
  b => 'b',
  c => 'c'
}

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .