Hello,

On Thu, Aug 13, 2020 at 2:30 PM Edison Wang <edisonwang6...@gmail.com>
wrote:

> Hi There,
>
> I am pretty new in this domain and got a question to ask. My goal is to
> create a new user "edison" on a Ubuntu server. Now I've already had a user
> "manager" which is able to ssh to this Ubuntu server. This problem I got is
> after I run user creation role with user "manager" as ansbile_user, the new
> user "edison" always failed to be created. Role is very simple, my question
> is if this issue would be caused by ansible_user "manager" that doesn't
> have some privilege?
>
> role:
>
> ---
> - name: manage-user - Manage user account
> user:
> name: "{{ user.username }}"
> comment: "{{ user.name }}"
> shell: "/bin/bash"
> groups:
> - sudo
>

The manager user is not root, so is not able to create users. You should add

become: true

to your task, so the user module is executed with elevated privileges.

Check out this:
https://docs.ansible.com/ansible/latest/user_guide/become.html

Luca



-- 
"E' assurdo impiegare gli uomini di intelligenza eccellente per fare
calcoli che potrebbero essere affidati a chiunque se si usassero delle
macchine"
Gottfried Wilhelm von Leibnitz, Filosofo e Matematico (1646-1716)

"Internet è la più grande biblioteca del mondo.
Ma il problema è che i libri sono tutti sparsi sul pavimento"
John Allen Paulos, Matematico (1945-vivente)

Luca 'remix_tj' Lorenzetto, http://www.remixtj.net , <
lorenzetto.l...@gmail.com>

-- 
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 ansible-project+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/CAKuX69rmmtXbCwWj5kznda6Bra2m8doE1bVNR3HgGo4iaJ3%2BdQ%40mail.gmail.com.

Reply via email to