def chgid(name, gid, root=None):
    pre_gid = __salt__['file.group_to_gid'](name)
    if gid == pre_gid:
        return True
    cmd = ('groupmod', '-g', gid, name)

    if root is not None:
        cmd.extend(('-R', root))

    __salt__['cmd.run'](cmd, python_shell=False)
    post_gid = __salt__['file.group_to_gid'](name)
    if post_gid != pre_gid:
        return post_gid == gid
    return False
Change the gid for a named group
dataset/ETHPy150Open saltstack/salt/salt/modules/groupadd.py/chgid