Short, simple command to create a group if it doesn't already exist?
getent group somegroupname || groupadd somegroupname
With force it exits successfully if the group already exists, and cancels -g if the GID is already used.
groupadd -f somegroupname