fix of some problems with user modification with skeleton informations under FreeBSD (#34694)

* respect skeleton argument in usermod mode for FreeBSD

* use FreeBSD's own (more sophisticated) home creation function rather than ansible's create_home(), which does not handle skeleton files correctly for FreeBSD
pull/38764/merge
abelbabel 7 years ago committed by Brian Coca
parent d512bed495
commit c1e4ef39cb

@ -848,12 +848,16 @@ class FreeBsdUser(User):
cmd.append('-c')
cmd.append(self.comment)
if self.home is not None and info[5] != self.home:
if self.move_home:
if self.home is not None:
if (info[5] != self.home and self.move_home) or (not os.path.exists(self.home) and self.createhome):
cmd.append('-m')
cmd.append('-d')
cmd.append(self.home)
if self.skeleton is not None:
cmd.append('-k')
cmd.append(self.skeleton)
if self.group is not None:
if not self.group_exists(self.group):
self.module.fail_json(msg="Group %s does not exist" % self.group)

Loading…
Cancel
Save