Having some trouble with the user module in Ansible. Everything is technically working, just not as I expected. It seems Ansible uses "useradd" versus the newer "adduser" in Ubuntu and I think its missing some configuration settings when creating users. If I let Ansible create the user, the account is created and active but the account behaves a bit strangely. In particualar, the user@hostname prompt is not present. I did confirm that it is using /bin/bash. All I get as a prompt for Ansible created users is $. Doesnt even display current working directory. I want to use Ansible to create the admin accounts, but not if its going to behave like this. If however I create the user manually using adduser in the OS, the account gets setup as expected. Any thoughts?

Ansible user prompt:


Manual user created prompt:


Here is an example user portion of the playbook:

- name: Add user
    name: Username
    password: 'Password Hash'
    groups: sudo
    state: present

You are probably need to add the skeleton option that copies /etc/skel which includes all of the standard shell profiles and so on.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.