Ask Your Question

arnoudj/puppet-sudo module - Syntax Error

asked 2016-07-18 17:44:58 -0600

smti gravatar image

updated 2016-07-19 08:44:07 -0600


I am new to Puppet and recently downloaded the arnoudj puppet-sudo module. I create a new module simply titled "sudo" and placed the following in the init.pp file:

class sudo {
          sudo::sudoers {'worlddomination'}:
          ensure => 'present',
          users => 'jalewellyn'],
          runas => 'root',
          cmnds => ['ALL'],
          tags     =>  ['NOPASSWD'],

When i do a puppet run I get: Syntax error at '}' /etc/puppetlabs/code/environments/development/modules/manifests/init.pp: 2:33

What am I missing here? Probably something basic! Any help would be much appreciated!

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted

answered 2016-07-19 08:43:45 -0600

Maybe you mean this?

class sudo {
  sudo::sudoers { 'worlddomination':
    ensure => 'present',
    users  => ['jalewellyn'],
    runas  => 'root',
    cmnds  => ['ALL'],
    tags   => ['NOPASSWD'],

That is at least syntactically correct.

edit flag offensive delete link more


Okay, so I have updated the syntax and that seems good. When I perform a puppet run now I get: Invalid resource type sudo::sudoers. Do I need to import/include something here? All I really did was run: puppet module install arnoudj-sudo, nothing more, nothing less.

smti gravatar imagesmti ( 2016-07-19 09:45:49 -0600 )edit

I think you need to check where it was installed . NB: the init.pp that comes with it already declares a class sudo; see github

cm01 gravatar imagecm01 ( 2016-07-19 20:54:01 -0600 )edit

It's a resource, so you could use hiera and create_resources too.
$sudoers = hiera('my::sudo')
create_resources('sudo::sudoers', $sudoers)
"my::sudo" : {
"test" : {
"cmnds" : "/usr/bin/",
"comment" : "Get Some value" ...

FranzCC gravatar imageFranzCC ( 2016-07-20 03:14:56 -0600 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower


Asked: 2016-07-18 17:44:58 -0600

Seen: 47 times

Last updated: Jul 19 '16