A collection of task oriented solutions in Puppet


Create a group


You want to create a group.


class add_group {

  # minimum required.
  group { 'logusers':
    ensure => 'present',

  # create a group with a specific GID.
  group { 'stats':
    gid => 2001,



Creating a new group via puppet only requires the resource to be named and that ensure => 'present' be specified. If you specify a GID then you can even skip the ensure, otherwise you must provide it; and the new groups GID will be chosen by your operating system.

If you specify a different GID on a group that already exists then puppet will change the GID in /etc/group but it will not change the ownership of any existing files and directories. To change permissions on files please see Setting basic file permissions - TODO

By default most Linux distributions will use the groupadd provider, which doesn't allow you to manage group members, so you'll have to do it on the user resources instead.