Does this happen if you supply `createhome=no`?

Also is the home directory created on the initial user creation or
subsequent runs?

It looks like the user module does add `-r` to the command, however I see
some code that may create the homedir regardless of `system=yes` on
subsequent runs after the user is already created unless `createhome=no` is
specified:

https://github.com/ansible/ansible-modules-core/blob/0930a44816d717052f8f6e7d37b74ea200b0d661/system/user.py#L2148-L2156

Not sure if we would need to make that check if `system=yes` was specified.

On Wed, Jan 6, 2016 at 12:58 PM, Uberteck <[email protected]> wrote:

> Creating a user using the core user module and using the 'system' property
> still seems to create a home directory:
>
> - name: create test user
>   user:
>     name=test
>     system=yes
>
>
> The resulting user has a home directory when applying this to a Centos 7
> host.
>
> According to 'man useradd', creating a system account should override any
> defaults to create a home directory:
>
>
> -r, --system
>
>
>
>            Create a system account.
>
>
>
>
>            System users will be created with no aging information in
>
>            /etc/shadow, and their numeric identifiers are chosen in the
>
>            SYS_UID_MIN-SYS_UID_MAX range, defined in /etc/login.defs,
> instead
>
>            of UID_MIN-UID_MAX (and their GID counterparts for the
> creation of
>
>            groups).
>
>
>
>
>            Note that useradd will not create a home directory for such an
>
>            user, regardless of the default setting in /etc/login.defs
>
>            (CREATE_HOME). You have to specify the -m options if you want
> a
>
>            home directory for a system account to be created.
>
>
>
> Am I doing something wrong or is this a bug?
>
> Cheers,
>
> --
> You received this message because you are subscribed to the Google Groups
> "Ansible Project" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> To post to this group, send email to [email protected].
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/ansible-project/e648b8d7-1997-451a-bec8-c40eec2ce8c6%40googlegroups.com
> <https://groups.google.com/d/msgid/ansible-project/e648b8d7-1997-451a-bec8-c40eec2ce8c6%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
> For more options, visit https://groups.google.com/d/optout.
>



-- 
Matt Martz
@sivel
sivel.net

-- 
You received this message because you are subscribed to the Google Groups 
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/CAD8N0v9rX3hPekFeozCW3H9cWpHyo_vurcUOvswnSzyc6EQs%3Dg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to