On 8/13/20 5:33 PM, Edison Wang wrote: > 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
> On Thursday, August 13, 2020 at 8:36:16 AM UTC-4, Luca 'remix_tj' Lorenzetto
> wrote:
>
> Hello,
>
> On Thu, Aug 13, 2020 at 2:30 PM Edison Wang <[email protected]
> <javascript:>> 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 <http://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
> <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 ,
> <[email protected] <javascript:>>
>
> --
> 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
> [email protected]
> <mailto:[email protected]>.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/ansible-project/f2f62fc1-e59c-4f9b-8473-7d750da46f5eo%40googlegroups.com
> <https://groups.google.com/d/msgid/ansible-project/f2f62fc1-e59c-4f9b-8473-7d750da46f5eo%40googlegroups.com?utm_medium=email&utm_source=footer>.
--
Ecommerce and Linux consulting + Perl and web application programming.
Debian and Sympa administration. Provisioning with Ansible.
--
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 [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/ansible-project/2c19a5fe-045c-ef94-c89c-ce257d3da737%40linuxia.de.
signature.asc
Description: OpenPGP digital signature
