Forge Home

122,947,116 downloads

18,339 latest version

3.6 quality score

We run a couple of automated
scans to help you access a
module's quality. Each module is
given a score based on how well
the author has formatted their
code and documentation and
modules are also checked for
malware using VirusTotal.

Please note, the information below
is for guidance only and neither of
these methods should be considered
an endorsement by Puppet.

Version information

  • 8.0.0 (latest)
  • 7.0.2
  • 7.0.1
  • 7.0.0
  • 6.0.0
  • 5.0.0
  • 4.2.0
  • 4.1.0
  • 4.0.0
  • 3.1.0
  • 3.0.9
  • 3.0.8
  • 3.0.7
  • 3.0.6
  • 3.0.5
  • 3.0.4
  • 3.0.3
  • 3.0.2
  • 3.0.1
  • 3.0.0
  • 2.4.3
  • 2.4.2
  • 2.4.1
  • 2.4.0
  • 2.3.0
  • 2.2.0
  • 2.1.0
  • 2.0.9
  • 2.0.8
  • 2.0.7
  • 2.0.6
  • 2.0.5
  • 2.0.4
  • 2.0.3
  • 2.0.2
  • 2.0.1
  • 2.0.0
  • 1.0.2
  • 1.0.1
  • 1.0.0
released Apr 19th 2014
This version is compatible with:

    Start using this module

    • r10k or Code Manager
    • Bolt
    • Manual installation
    • Direct download

    Add this module to your Puppetfile:

    mod 'saz-sudo', '3.0.6'
    Learn more about managing modules with a Puppetfile

    Add this module to your Bolt project:

    bolt module add saz-sudo
    Learn more about using this module with an existing project

    Manually install this module globally with Puppet module tool:

    puppet module install saz-sudo --version 3.0.6

    Direct download is not typically how you would use a Puppet module to manage your infrastructure, but you may want to download the module in order to inspect the code.

    Download
    Tags: sudo

    Documentation

    saz/sudo — version 3.0.6 Apr 19th 2014

    puppet-sudo Build Status

    Manage sudo configuration via Puppet

    Gittip

    Support via Gittip

    Usage

    WARNING

    This module will purge your current sudo config

    If this is not what you're expecting, set purge and/or config_file_replace to false

    Install sudo with default sudoers

    Purge current sudo config

        class { 'sudo': }
    

    Purge sudoers.d directory, but leave sudoers file as it is

        class { 'sudo':
          config_file_replace => true,
        }
    

    Leave current sudo config as it is

        class { 'sudo':
          purge               => false,
          config_file_replace => false,
        }
    

    Adding sudoers configuration

    Using Code

        class { 'sudo': }
        sudo::conf { 'web':
          source => 'puppet:///files/etc/sudoers.d/web',
        }
        sudo::conf { 'admins':
          priority => 10,
          content  => "%admins ALL=(ALL) NOPASSWD: ALL",
        }
        sudo::conf { 'joe':
          priority => 60,
          source   => 'puppet:///files/etc/sudoers.d/users/joe',
        }
    

    Using Hiera

    A hiera hash may be used to assemble the sudoers configuration. Hash merging is also enabled, which supports layering the configuration settings.

    Examples using:

    • YAML backend
    • an environment called production
    • a /etc/puppet/hiera.yaml hierarchy configuration:
    :hierarchy:
      - "%{environment}"
      - "defaults"
    
    Load module
    Using Puppet version 3+

    Load the module via Puppet Code or your ENC.

        include sudo
    
    Using Puppet version 2.7+

    After Installing Hiera:

    • Load the sudo and sudo::configs modules via Puppet Code or your ENC.
        include sudo
        include sudo::configs
    
    Configure Hiera YAML (defaults.yaml)

    These defaults will apply to all systems.

    sudo::configs:
        'web':
            'source'    : 'puppet:///files/etc/sudoers.d/web'
        'admins':
            'content'   : "%admins ALL=(ALL) NOPASSWD: ALL"
            'priority'  : 10
        'joe':
            'priority'  : 60
            'source'    : 'puppet:///files/etc/sudoers.d/users/joe'
    
    Configure Hiera YAML (production.yaml)

    This will only apply to the production environment. In this example we are:

    • inheriting/preserving the web configuration
    • overriding the admins configuration
    • removing the joe configuration
    sudo::configs:
        'admins':
            'content'   : "%prodadmins ALL=(ALL) NOPASSWD: ALL"
            'priority'  : 10
        'joe':
            'ensure'    : 'absent'
            'source'    : 'puppet:///files/etc/sudoers.d/users/joe'
    

    If you have Hiera version >= 1.2.0 and enable Hiera Deeper Merging you may conditionally override any setting.

    In this example we are:

    • inheriting/preserving the web configuration
    • overriding the admins:content setting
    • inheriting/preserving the admins:priority setting
    • inheriting/preserving the joe:source and joe:priority settings
    • removing the joe configuration
    sudo::configs:
        'admins':
            'content'   : "%prodadmins ALL=(ALL) NOPASSWD: ALL"
        'joe':
            'ensure'    : 'absent'
    

    sudo::conf / sudo::configs notes

    • You can pass template() through content parameter.
    • One of content or source must be set.

    sudo class parameters

    Parameter Type Default Description
    enable boolean true Set this to remove or purge all sudoers configs
    package string OS specific Set package name (for unsupported platforms)
    package_ensure string present latest, absent, or a specific package version
    package_source string OS specific Set package source (for unsupported platforms)
    purge boolean true Purge unmanaged files from config_dir
    config_file string OS specific Set configfile (for unsupported platforms)_
    config_file_replace boolean true Replace config file with module config file
    config_dir string OS specific Set configdir (for unsupported platforms)_
    source string OS specific Set source (for unsupported platforms)

    sudo::conf class / sudo::configs hash parameters

    Parameter Type Default Description
    ensure string present present or absent
    priority number 10 file name prefix
    content string undef content of configuration snippet
    source string undef source of configuration snippet
    sudo_config_dir string OS Specific configuration snippet directory (for unsupported platforms)