camptocamp / puppet-accounts

11 stars 40 forks source link

Create user's group with custom GID before creating the user. #33

Closed johnzimm closed 8 years ago

johnzimm commented 8 years ago

Custom UID and GID are able to be specified for each user, but if the group doesn't already exist the user's new group is not created before attempting to create the new user.

You would recieve a message similar to the following:

Error: Could not create user example: Execution of '/sbin/useradd -g 66666 -d /home/example -p * -u 66666 -m example' returned 6: useradd: group '66666' does not exist
Error: /Stage[main]/Profiles::Base/Accounts::Account[@herp]/Accounts::Account[example]/User[example]/ensure: change from absent to present failed: Could not create user example: Execution of '/sbin/useradd -g 66666 -d /home/example -p * -u 66666 -m example' returned 6: useradd: group '66666' does not exist

Without specifying a custom GID Puppet will autorequire the group for the user and select the next available GID

This commit modifies account.pp to create the new group with custom GID prior to creating the user.

Deletion of the group, regardless of the GID, will happen automatically when the user is purged using this module.

johnzimm commented 8 years ago

This is still failing the build routines with ruby 1.8.7. Can someone who knows better take a look and comment?

johnzimm commented 8 years ago

Closing until I can fix the build.