How to use saz-sudo puppet module to deploy the own sudoers file with hiera

hierapuppetsudo

I have saz-sudo installed and have created a site_sudo module based (I hope) on it.
Here's what I have in my site_sudo/manifest/init.pp file:

class { 'site_sudo': }
    sudo::conf { 'web':
      source => 'puppet:///files/etc/sudoers',
    }
    sudo::conf { 'syseng':
      priority => 10,
      content  => "%sysadm ALL=(ALL) NOPASSWD: ALL",
    }

include sudo

No matter what I do, the sudoers file on the target is always overwritten with the sudoers.rhel6 file from saz-sudo module.

I'm using common.yaml too:

classes:
  - site_sudo

Best Answer

Is that an exact copy from your file? The class { 'site_sudo': } line would include that class into the config, not define the class as you should be doing in the init.pp for the module. This will prevent the rest of the config in the file from being applied (since this file is only being evaluated to load that class; the other lines won't be evaluated as they would in an import statement).

Instead, it should look like this:

class site_sudo { 
  include sudo
  sudo::conf { 'web':
    source => 'puppet:///files/etc/sudoers',
  }
  sudo::conf { 'syseng':
    priority => 10,
    content  => "%sysadm ALL=(ALL) NOPASSWD: ALL",
  }
}