Ansible playbook, create a user with the option --disabled-login

I need create a user with the option --disabled-login with ansible's playbook.

The command line is:

sudo adduser --disabled-login git

I'm searching on Ansible's documentation. And the option system is similar.

The playbook task is:

user: name=git system=no

Is the option system=no the same as the option --disabled-login?


Solution 1:

No, system=no is not the same as --disabled-login!
From the adduser man-page:

--disabled-login
Do not run passwd to set the password. The user won't be able to use her account until the password is set.

So when using Ansible's user module, and you do not set a password, the login is disabled anyway (unless SSH-keys are being setup in the account's $HOME).