User creation problem

Hi,
I’m having some troubles creating a user on a Debian host, using ansible 1.2.
This is my action:
action: user name=erlang comment=“Delibird user” group=staff shell=/bin/false createhome=no

action: user name=erlang groups=sudo

And this is the debug output:

TASK: [Create erlang user account] ********************************************
REMOTE_MODULE user name=erlang groups=sudo
changed: [travis] => {“changed”: true, “comment”: “”, “createhome”: true, “group”: 1004, “groups”: “sudo”, “home”: “/home/erlang”, “item”: “”, “name”: “erlang”, “shell”: “/bin/sh”, “state”: “present”, “stderr”: “useradd: warning: the home directory already exists.\nNot copying any file from skel directory into it.\n”, “system”: false, “uid”: 1001}

Why are my settings almost completely ignored? I mean, it’s trying to create a home directory, wrong default shell and it also ignore the default group setting.

Thanks,
Carlo

So it looks like you have two action lines in your playbook, which is going to only do the last one since you are specifying a YAML hash.

I imagine you have it like this?

  • action: user …
    action: user …

In which case you want this:

  • action: user …
  • action: user …

Bullseye :slight_smile:
Thanks,
Carlo