What privilege required for an ansible user able to configure a server

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:

Hello,

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?

That is the most likely cause of the error which you failed to post here.

Add "become: yes" to your playbook (or to this task).

Regards
      Racke

Hi Luca:

I’ve added that command become: yes like you and Stefan said, and make my playbook as simple as below for a test. But after I run this playbook where I didn’t see any error, I still couldn’t see the new user “edison” created on target server. However if I run this playbook on my ansible control node, I can see the user "edison’’ created. The control node can login target server with ansbile_user “manager”. Did I miss any part?

Hi Luca:

I've added that command become: yes like you and Stefan said, and make my playbook as simple as below for a test. But
after I run this playbook where I didn't see any error, I still couldn't see the new user "edison" created on target
server. However if I run this playbook on my ansible control node, I can see the user "edison'' created. The control
node can login target server with ansbile_user "manager". Did I miss any part?

---
- hosts: all
become: yes
tasks:
- name: add a new user
user:
name: it-manager
password: '$6$0r6COc71MvA$EGPPq9Tfq.BTNix2jWyDojB8qyFtKvSKiuXxCE4VRU4kiC5cgHvMwGklWxugfjUCYcc8hg2Sew1nIRMIcMgrB1'
shell: /bin/bash
state: present
groups: sudo

That playbook is creating a user with username it-manager.

Regards
          Racke