Version information
This version is compatible with:
- Puppet Enterprise 2019.8.x, 2019.7.x, 2019.5.x, 2019.4.x, 2019.3.x, 2019.2.x, 2019.1.x, 2019.0.x, 2018.1.x, 2017.3.x, 2017.2.x, 2017.1.x, 2016.5.x, 2016.4.x
- Puppet >= 3.0.0 < 7.0.0
- Debian, RedHat, CentOS, OracleLinux, Scientific, Solaris, SLES, SLED, Ubuntu
Start using this module
Add this module to your Puppetfile:
mod 'ghoneycutt-common', '1.10.0'
Learn more about managing modules with a PuppetfileDocumentation
puppet-module-common
common module to be applied to ALL nodes
Compatibility
Module is generic enough to work on any system, though the individual modules that it could potentially include could be very platform specific.
===
Common class
Optionally include classes that are common to all systems, such as dnsclient
, ntp
, puppet::agent
, and vim
. By default we do not take any action, so you must enable the classes. This should be done in Hiera such as the following example. Ideally you would do this in your least specific level of hiera (often times labeled as 'common' or 'global') and potentially override at other levels.
common::manage_root_password: true common::enable_dnsclient: true common::enable_ntp: true common::enable_puppet_agent: true common::enable_vim: true
Parameters for class common
##
users
Hash of users to ensure with common::mkusers
- Default: undef
groups
Hash of groups to ensure
- Default: undef
manage_root_password
- Default: false
root_password
- Default: MD5 crypt of
puppet
create_opt_lsb_provider_name_dir
Boolean to ensure /opt/${lsb_provider_name}
- Default: false
lsb_provider_name
LSB Provider Name as assigned by LANANA - http://www.lanana.org/lsbreg/providers/index.html
- Default:
UNSET
enable_dnsclient
Boolean to include ghoneycutt/dnsclient
- Default: false
enable_hosts
Boolean to include ghoneycutt/hosts
- Default: false
enable_inittab
Boolean to include ghoneycutt/inittab
- Default: false
enable_mailaliases
Boolean to include ghoneycutt/mailaliases
- Default: false
enable_motd
Boolean to include ghoneycutt/motd
- Default: false
enable_network
Boolean to include ghoneycutt/network
- Default: false
enable_nsswitch
Boolean to include ghoneycutt/nsswitch
- Default: false
enable_ntp
Boolean to include ghoneycutt/ntp
- Default: false
enable_pam
Boolean to include ghoneycutt/pam
- Default: false
enable_puppet_agent
Boolean to include ghoneycutt/puppet::agent
- Default: false
enable_rsyslog
Boolean to include ghoneycutt/rsyslog
- Default: false
enable_selinux
Boolean to include ghoneycutt/selinux
- Default: false
enable_ssh
Boolean to include ghoneycutt/ssh
- Default: false
enable_utils
Boolean to include ghoneycutt/utils
- Default: false
enable_vim
Boolean to include ghoneycutt/vim
- Default: false
enable_wget
Boolean to include ghoneycutt/wget
- Default: false
includes classes based on osfamily
fact
enable_debian
Boolean to include ghoneycutt/debian
- Default: false
enable_redhat
Boolean to include ghoneycutt/redhat
- Default: false
enable_solaris
Boolean to include ghoneycutt/solaris
- Default: false
enable_suse
Boolean to include ghoneycutt/suse
- Default: false
===
common::mkdir_p define
Provide mkdir -p
functionality for a directory.
Used in conjunction with a file resource.
Example usage:
Parameters for common::mkdir_p
define
None.
===
common::remove_if_empty define
Removes a file if it exists and is empty.
Example usage:
Parameters for common::remove_if_empty
define
None.
===
common::mkuser define
Ensures user/groups
Usage
You can specify hash each for users and groups and use Hiera to manage them.
This example uses the YAML backend, though that is not mandatory.
In Hiera's hierarchy add two levels, users
, and groups
such as the following example.
hiera.yaml
:backends:
- yaml :hierarchy:
- fqdn/%{fqdn}
- users
- groups
- %{environment}
- common :yaml: :datadir:
users.yaml
common::users: gh: uid: "30000" comment: "Garrett Honeycutt" groups: admin ssh_auth_key: ssh-public-key
groups.yaml
common::groups: admin: gid: "32000"
Parameters for common::mkuser
define
uid
String - UID of user
- Required
gid
String - GID of user
- Default:
$uid
name
String - username
group
String - group name of user
- Default:
$name
shell
String - user's shell
- Default: '/bin/bash'
home
String - home directory
- Default:
/home/${username}
ensure
Present or Absent
- Default: present
managehome
Boolean for manage home attribute of user resource
- Default: true
manage_dotssh
Boolean to optionally create ~/.ssh
directory
- Default: true
comment
String - GECOS field for passed
- Default: 'created via puppet'
groups
Array - additional groups the user should be associated with
- Default: undef
password
String - password crypt for user
- Default: '!!'
mode
String - mode of home directory
- Default: 0700
ssh_auth_key
String - The ssh key for the user
- Default: undef
ssh_auth_key_type
String - Anything that the ssh_authorized_key resource can take for the type attribute, such as ssh-dss
or ssh-rsa
.
- Default: 'ssh-dss'
purge_ssh_keys
Boolean - Purge any keys that aren’t managed as ssh_authorized_key resources. As this parameter was introduced with Puppet 3.6, it will only work with Puppet >= 3.6. On earlier version this parameter will be silently ignored.
- Default: false
===
Functions
interface2factname()
Takes one argument, the interface name, and returns it formatted for use with facter.
Example: interface2factname('bond0:0')
would return ipaddress_bond0_0
.
strip_file_extension()
Takes two arguments, a file name which can include the path, and the extension to be removed. Returns the file name without the extension as a string.
Example: strip_file_extension('myapp.war','war')
would return myapp
.
1.0.0 - 2013-05-24
Add spec tests and become viable for first major release.
Albin Gustavsson 2ef8ddb Removed some commented out code from the spec tests d8fd795 Added spec testing for functions and defines 558a99f Added spec testing for common::mkuser
Garrett Honeycutt 21c7d9a Ensure all modules are listed in README 49f726d Add facter to .gemfile fd2a905 Test for both attributes of mkdir_p with a variable 81067a2 Travis - fix allowed failure for 2.7.x 556d1be Travis - test against Puppet 3.2.1 and display graphic in README 676bdeb Travis - remove 2.6.9 testing and test 3.x c64244c Add travis-ci.org support 419e530 Split mkuser testing into its own file and clarify usernames. 93beb4f Add spec tests
0.0.1 - 2013-05-12 Garrett Honeycutt code@garretthoneycutt.com
- Rework of some old code such that no action is taken by default
Dependencies
- puppetlabs/sshkeys_core (>= 1.0.1 <2.0.0)
- puppetlabs/stdlib (>= 4.6.0 < 7.0.0)
Copyright (C) 2007-2020 Garrett Honeycutt <code@garretthoneycutt.com> Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.