def chgid(name, gid):
 pre_gid = __salt__['file.group_to_gid'](name)
 if (gid == pre_gid):
  return True
 cmd = 'groupmod -g {0} {1}'.format(gid, name)
 __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

def chgid ( name , gid ) : pre_gid = __salt__ [ 'file.group_to_gid' ] ( name ) if ( gid == pre_gid ) : return True cmd = 'groupmod -g {0} {1}' . format ( gid , name ) __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 default group of the user cli example: .