Forge Home

common

This module manages user accounts and common packages.

16,624 downloads

6,665 latest version

5.0 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

  • 1.3.1 (latest)
  • 1.3.0
  • 1.2.1
  • 1.2.0
  • 1.1.1
  • 1.1.0
  • 1.0.3
  • 1.0.2
  • 1.0.0
  • 0.0.12
  • 0.0.9
  • 0.0.8
  • 0.0.7
  • 0.0.5
  • 0.0.4
  • 0.0.3
  • 0.0.2
  • 0.0.1
released Nov 30th 2016
This version is compatible with:
  • Puppet Enterprise >= 3.2.0
  • Puppet >= 3.2.0
  • ,

Start using this module

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

Add this module to your Puppetfile:

mod 'dhoppe-common', '1.3.1'
Learn more about managing modules with a Puppetfile

Add this module to your Bolt project:

bolt module add dhoppe-common
Learn more about using this module with an existing project

Manually install this module globally with Puppet module tool:

puppet module install dhoppe-common --version 1.3.1

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: common

Documentation

dhoppe/common — version 1.3.1 Nov 30th 2016

common

Build Status Code Coverage Puppet Forge Puppet Forge - downloads Puppet Forge - endorsement Puppet Forge - scores

Table of Contents

  1. Overview
  2. Module Description - What the module does and why it is useful
  3. Setup - The basics of getting started with common
  4. Usage - Configuration options and additional functionality
  5. Reference - An under-the-hood peek at what the module is doing and how
  6. Limitations - OS compatibility, etc.
  7. Development - Guide for contributing to the module

Overview

This module manages user accounts and common packages.

Module Description

This module handles managing user accounts and installing common packages across a range of operating systems and distributions.

Setup

What common affects

  • user accounts.
  • common packages.

Setup Requirements

Beginning with common

Install common with the default parameters (No configuration files will be changed).

    class { 'common': }

Install common with the recommended parameters.

    class { 'common':
      config_file_hash => {
        'passwd' => {},
        'shadow' => {
          config_file_group => 'shadow',
          config_file_mode  => '0640',
        },
      },
      package_list     => [
        'colordiff',
        'dcfldd',
        'debian-goodies',
        'deborphan',
        'dstat',
        'ethtool',
        'htop',
        'ifstat',
        'iftop',
        'iotop',
        'ipcalc',
        'iperf',
        'molly-guard',
        'mtr-tiny',
        'nmap',
        'parted',
        'pwgen',
        'rsync',
        'sysstat',
        'tcpdump',
        'tree',
        'unrar',
        'unzip',
      ],
      groups_hash      => {
        'docker' => {
          members => ['dhoppe'],
        }
      },
      users_hash       => {
        'dhoppe' => {
          'comment'         => 'Dennis Hoppe',
          'groups'          => [
            'audio',
            'cdrom',
            'dip',
            'floppy',
            'plugdev',
            'sudo',
            'video',
          ],
          'password'        => '$6$9zv3v3FT5qU$W/0yudPmRfUl55EaCv2nCk7eLB5TJ2YpLCRMurdR/bP2HpMbXM3eHvZmxu7JahYjFHZ1ThOkjc8KNQ3oIa1Aq1',
          'ssh_key'         => 'AAAAB3NzaC1yc2EAAAADAQABAAABAQDuXXte0XbIfh7iAEjw7gNKMhNFnlNwI2yt5CR4xrDuBWqNF9JZ266R9e77Z/uo4ayev/whmk8btuw3IsYJdQ4FGwJp7yOShcOKk/Y44/7ROggM71K525MdxhlYthe2hzbFMzRw6IUvhJih81ehD/VULEIuD0nsqutrTfe2c4Dgd2BeTeKPFazyYKSdhb2NGsXwe2tEOJKpRCopmOPDGnyiLPEW7j2DX1uwBVFx/ZUh8gwEia7gLqgLeqBN30DuDk8RAO6cL0cMB7H0tPXDtq/Ooyn974pk73MXPoCkiAwe/9xROLQzqDEqf1N5t7+cDeLWaClh80scEyBTNRkoUDLR',
        },
      },
    }

Usage

Update the common package.

    class { 'common':
      package_ensure => 'latest',
    }

Remove the common package.

    class { 'common':
      package_ensure => 'absent',
    }

Purge the common package (All configuration files will be removed).

    class { 'common':
      package_ensure => 'purged',
    }

Deploy the configuration files from source directory.

    class { 'common':
      config_dir_source => 'puppet:///modules/common/etc',
    }

Deploy the configuration files from source directory (Unmanaged configuration files will be removed).

    class { 'common':
      config_dir_purge  => true,
      config_dir_source => 'puppet:///modules/common/etc',
    }

Deploy the configuration file from source.

    class { 'common':
      config_file_source => 'puppet:///modules/common/etc/group',
    }

Deploy the configuration file from string.

    class { 'common':
      config_file_string => '# THIS FILE IS MANAGED BY PUPPET',
    }

Deploy the configuration file from template.

    class { 'common':
      config_file_template => 'common/etc/group.erb',
    }

Deploy the configuration file from custom template (Additional parameters can be defined).

    class { 'common':
      config_file_template     => 'common/etc/group.erb',
      config_file_options_hash => {
        'key' => 'value',
      },
    }

Deploy additional configuration files from source, string or template.

    class { 'common':
      config_file_hash => {
        'group.2nd' => {
          config_file_path   => '/etc/group.2nd',
          config_file_source => 'puppet:///modules/common/etc/group.2nd',
        },
        'group.3rd' => {
          config_file_path   => '/etc/group.3rd',
          config_file_string => '# THIS FILE IS MANAGED BY PUPPET',
        },
        'group.4th' => {
          config_file_path     => '/etc/group.4th',
          config_file_template => 'common/etc/group.4th.erb',
        },
      },
    }

Reference

Classes

Public Classes

  • common: Main class, includes all other classes.

Private Classes

  • common::install: Handles the packages.
  • common::config: Handles the configuration file.

Parameters

package_ensure

Determines if the package should be installed. Valid values are 'present', 'latest', 'absent' and 'purged'. Defaults to 'present'.

package_name

Determines the name of package to manage. Defaults to 'undef'.

package_list

Determines if additional packages should be managed. Defaults to 'undef'.

config_dir_ensure

Determines if the configuration directory should be present. Valid values are 'absent' and 'directory'. Defaults to 'directory'.

config_dir_path

Determines if the configuration directory should be managed. Defaults to '/etc'

config_dir_purge

Determines if unmanaged configuration files should be removed. Valid values are 'true' and 'false'. Defaults to 'false'.

config_dir_recurse

Determines if the configuration directory should be recursively managed. Valid values are 'true' and 'false'. Defaults to 'true'.

config_dir_source

Determines the source of a configuration directory. Defaults to 'undef'.

config_file_ensure

Determines if the configuration file should be present. Valid values are 'absent' and 'present'. Defaults to 'present'.

config_file_path

Determines if the configuration file should be managed. Defaults to '/etc/group'

config_file_owner

Determines which user should own the configuration file. Defaults to 'root'.

config_file_group

Determines which group should own the configuration file. Defaults to 'root'.

config_file_mode

Determines the desired permissions mode of the configuration file. Defaults to '0644'.

config_file_source

Determines the source of a configuration file. Defaults to 'undef'.

config_file_string

Determines the content of a configuration file. Defaults to 'undef'.

config_file_template

Determines the content of a configuration file. Defaults to 'undef'.

config_file_require

Determines which package a configuration file depends on. Defaults to 'undef'.

config_file_hash

Determines which configuration files should be managed via common::define. Defaults to '{}'.

config_file_options_hash

Determines which parameters should be passed to an ERB template. Defaults to '{}'.

Parameters within common::group

ensure

Determines if the group should be created. Valid values are 'absent' and 'present'. Defaults to 'present'.

gid

Determines which group ID should be used. Defaults to 'undef'.

members

Determines the members of the group. Defaults to 'undef'.

Parameters within common::user

ensure

Determines if the user should be created. Valid values are 'absent' and 'present'. Defaults to 'present'.

uid

Determines which user ID should be used. Defaults to 'undef'.

gid

Determines which group ID should be used. Defaults to 'undef'.

comment

Determines a description of the user. Defaults to 'undef'.

home

Determines the home directory of the user. Defaults to "/home/${name}".

shell

Determines the user's login shell. Defaults to '/bin/bash'.

groups

Determines the groups to which the user belongs. Defaults to 'undef'.

managehome

Determines whether to manage the home directory when managing the user. Valid values are 'true' and 'false'. Defaults to 'true'.

password

Determines the user's password. Defaults to 'undef'.

purge_ssh_keys

Determines whether to purge authorized SSH keys for this user if they are not managed with the ssh_authorized_key resource type. Valid values are 'true' and 'false'. Defaults to 'true'.

ssh_key_options

Determines the SSH key options; see sshd(8) for possible values. Defaults to 'undef'.

ssh_key_type

Determines the encryption type used. Valid values are 'ssh-dss', 'ssh-rsa', 'ecdsa-sha2-nistp256', 'ecdsa-sha2-nistp384', 'ecdsa-sha2-nistp521' and 'ssh-ed25519'. Defaults to 'ssh-rsa'.

ssh_key

Determines the public key itself. Defaults to 'undef'.

Limitations

This module has been tested on:

  • Debian 6/7/8
  • Ubuntu 12.04/14.04/16.04

Development

Bug Report

If you find a bug, have trouble following the documentation or have a question about this module - please create an issue.

Pull Request

If you are able to patch the bug or add the feature yourself - please make a pull request.

Contributors

The list of contributors can be found at: https://github.com/dhoppe/puppet-common/graphs/contributors