|
|
@ -41,6 +41,14 @@ options:
|
|
|
|
required: false
|
|
|
|
required: false
|
|
|
|
description:
|
|
|
|
description:
|
|
|
|
- Optionally sets the I(UID) of the user.
|
|
|
|
- Optionally sets the I(UID) of the user.
|
|
|
|
|
|
|
|
nonunique:
|
|
|
|
|
|
|
|
required: false
|
|
|
|
|
|
|
|
default: "no"
|
|
|
|
|
|
|
|
choices: [ "yes", "no" ]
|
|
|
|
|
|
|
|
description:
|
|
|
|
|
|
|
|
- Optionally when used with the -u option, this option allows to
|
|
|
|
|
|
|
|
change the user ID to a non-unique value.
|
|
|
|
|
|
|
|
(New in 1.1)
|
|
|
|
group:
|
|
|
|
group:
|
|
|
|
required: false
|
|
|
|
required: false
|
|
|
|
description:
|
|
|
|
description:
|
|
|
@ -196,6 +204,7 @@ class User(object):
|
|
|
|
self.state = module.params['state']
|
|
|
|
self.state = module.params['state']
|
|
|
|
self.name = module.params['name']
|
|
|
|
self.name = module.params['name']
|
|
|
|
self.uid = module.params['uid']
|
|
|
|
self.uid = module.params['uid']
|
|
|
|
|
|
|
|
self.nonunique = module.params['nonunique']
|
|
|
|
self.group = module.params['group']
|
|
|
|
self.group = module.params['group']
|
|
|
|
self.groups = module.params['groups']
|
|
|
|
self.groups = module.params['groups']
|
|
|
|
self.comment = module.params['comment']
|
|
|
|
self.comment = module.params['comment']
|
|
|
@ -244,6 +253,9 @@ class User(object):
|
|
|
|
cmd.append('-u')
|
|
|
|
cmd.append('-u')
|
|
|
|
cmd.append(self.uid)
|
|
|
|
cmd.append(self.uid)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if self.nonunique:
|
|
|
|
|
|
|
|
cmd.append('-o')
|
|
|
|
|
|
|
|
|
|
|
|
if self.group is not None:
|
|
|
|
if self.group is not None:
|
|
|
|
if not self.group_exists(self.group):
|
|
|
|
if not self.group_exists(self.group):
|
|
|
|
self.module.fail_json(msg="Group %s does not exist" % self.group)
|
|
|
|
self.module.fail_json(msg="Group %s does not exist" % self.group)
|
|
|
@ -294,6 +306,9 @@ class User(object):
|
|
|
|
cmd.append('-u')
|
|
|
|
cmd.append('-u')
|
|
|
|
cmd.append(self.uid)
|
|
|
|
cmd.append(self.uid)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if self.nonunique:
|
|
|
|
|
|
|
|
cmd.append('-o')
|
|
|
|
|
|
|
|
|
|
|
|
if self.group is not None:
|
|
|
|
if self.group is not None:
|
|
|
|
if not self.group_exists(self.group):
|
|
|
|
if not self.group_exists(self.group):
|
|
|
|
self.module.fail_json(msg="Group %s does not exist" % self.group)
|
|
|
|
self.module.fail_json(msg="Group %s does not exist" % self.group)
|
|
|
@ -531,6 +546,9 @@ class FreeBsdUser(User):
|
|
|
|
cmd.append('-u')
|
|
|
|
cmd.append('-u')
|
|
|
|
cmd.append(self.uid)
|
|
|
|
cmd.append(self.uid)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if self.nonunique:
|
|
|
|
|
|
|
|
cmd.append('-o')
|
|
|
|
|
|
|
|
|
|
|
|
if self.comment is not None:
|
|
|
|
if self.comment is not None:
|
|
|
|
cmd.append('-c')
|
|
|
|
cmd.append('-c')
|
|
|
|
cmd.append(self.comment)
|
|
|
|
cmd.append(self.comment)
|
|
|
@ -591,6 +609,9 @@ class FreeBsdUser(User):
|
|
|
|
cmd.append('-u')
|
|
|
|
cmd.append('-u')
|
|
|
|
cmd.append(self.uid)
|
|
|
|
cmd.append(self.uid)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if self.nonunique:
|
|
|
|
|
|
|
|
cmd.append('-o')
|
|
|
|
|
|
|
|
|
|
|
|
if self.comment is not None and info[4] != self.comment:
|
|
|
|
if self.comment is not None and info[4] != self.comment:
|
|
|
|
cmd.append('-c')
|
|
|
|
cmd.append('-c')
|
|
|
|
cmd.append(self.comment)
|
|
|
|
cmd.append(self.comment)
|
|
|
@ -691,6 +712,9 @@ class SunOS(User):
|
|
|
|
cmd.append('-u')
|
|
|
|
cmd.append('-u')
|
|
|
|
cmd.append(self.uid)
|
|
|
|
cmd.append(self.uid)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if self.nonunique:
|
|
|
|
|
|
|
|
cmd.append('-o')
|
|
|
|
|
|
|
|
|
|
|
|
if self.group is not None:
|
|
|
|
if self.group is not None:
|
|
|
|
if not self.group_exists(self.group):
|
|
|
|
if not self.group_exists(self.group):
|
|
|
|
self.module.fail_json(msg="Group %s does not exist" % self.group)
|
|
|
|
self.module.fail_json(msg="Group %s does not exist" % self.group)
|
|
|
@ -752,6 +776,9 @@ class SunOS(User):
|
|
|
|
cmd.append('-u')
|
|
|
|
cmd.append('-u')
|
|
|
|
cmd.append(self.uid)
|
|
|
|
cmd.append(self.uid)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if self.nonunique:
|
|
|
|
|
|
|
|
cmd.append('-o')
|
|
|
|
|
|
|
|
|
|
|
|
if self.group is not None:
|
|
|
|
if self.group is not None:
|
|
|
|
if not self.group_exists(self.group):
|
|
|
|
if not self.group_exists(self.group):
|
|
|
|
self.module.fail_json(msg="Group %s does not exist" % self.group)
|
|
|
|
self.module.fail_json(msg="Group %s does not exist" % self.group)
|
|
|
@ -857,6 +884,9 @@ class AIX(User):
|
|
|
|
cmd.append('-u')
|
|
|
|
cmd.append('-u')
|
|
|
|
cmd.append(self.uid)
|
|
|
|
cmd.append(self.uid)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if self.nonunique:
|
|
|
|
|
|
|
|
cmd.append('-o')
|
|
|
|
|
|
|
|
|
|
|
|
if self.group is not None:
|
|
|
|
if self.group is not None:
|
|
|
|
if not self.group_exists(self.group):
|
|
|
|
if not self.group_exists(self.group):
|
|
|
|
self.module.fail_json(msg="Group %s does not exist" % self.group)
|
|
|
|
self.module.fail_json(msg="Group %s does not exist" % self.group)
|
|
|
@ -910,6 +940,9 @@ class AIX(User):
|
|
|
|
cmd.append('-u')
|
|
|
|
cmd.append('-u')
|
|
|
|
cmd.append(self.uid)
|
|
|
|
cmd.append(self.uid)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if self.nonunique:
|
|
|
|
|
|
|
|
cmd.append('-o')
|
|
|
|
|
|
|
|
|
|
|
|
if self.group is not None:
|
|
|
|
if self.group is not None:
|
|
|
|
if not self.group_exists(self.group):
|
|
|
|
if not self.group_exists(self.group):
|
|
|
|
self.module.fail_json(msg="Group %s does not exist" % self.group)
|
|
|
|
self.module.fail_json(msg="Group %s does not exist" % self.group)
|
|
|
@ -995,6 +1028,7 @@ def main():
|
|
|
|
state=dict(default='present', choices=['present', 'absent'], type='str'),
|
|
|
|
state=dict(default='present', choices=['present', 'absent'], type='str'),
|
|
|
|
name=dict(required=True, aliases=['user'], type='str'),
|
|
|
|
name=dict(required=True, aliases=['user'], type='str'),
|
|
|
|
uid=dict(default=None, type='str'),
|
|
|
|
uid=dict(default=None, type='str'),
|
|
|
|
|
|
|
|
nonunique=dict(default='no', type='bool'),
|
|
|
|
group=dict(default=None, type='str'),
|
|
|
|
group=dict(default=None, type='str'),
|
|
|
|
groups=dict(default=None, type='str'),
|
|
|
|
groups=dict(default=None, type='str'),
|
|
|
|
comment=dict(default=None, type='str'),
|
|
|
|
comment=dict(default=None, type='str'),
|
|
|
|