User add error on provision

hey everyone,

I am running the command ansible-playbook server.yml -e env=staging for provisioning, and it goes through everything fine up till TASK [users : Setup users] where it’s able to add web users, but then fails at useradd: invalid field '**** which seems to be when it’s adding the admin user. Any idea how to debug this?

I have regenerated ssh keys, created a new server, and reinstalled trellis with a new vagrant box, but the same problem is still occurring! If anyone else is having the same issue, please share your thoughts.

After a quick google search, it seems the error ‘useradd: invalid field’ is commonly associated with a malformed password variable (e.g., with errant newlines). You could rule this out by changing back to the default sudo password hash for admin (corresponds to example_password). If the ‘users’ role succeeds with this default value, you can try re-creating your custom password hash again. See Trellis admin user password docs for info.

Of course, maybe you never changed that default hash. If not, could you post your

  • group_vars/all/users.yml
  • group_vars/staging/vault.yml (can hide sensitive info)
  • verbose output from "Setup users’ task (add -vvvv to your ansible-playbook cmd)
1 Like

Awesome advice @fullyint. Turns out the random password I used for the sudo password hash was the problem.
Thanks a ton!