Am I missing something or Ansible is uselessly verbose?

34 views
Skip to first unread message

Istvan Kis

unread,
Mar 1, 2021, 7:25:08 PM3/1/21
to Ansible Project
I am just starting to learn Ansible as I need it for my current job.
I am kind of disappointed.
Why can't: 
become: yes
become_user: root

Just be:
user: root
Can you become anything else other than a user?

Jean-Yves LENHOF

unread,
Mar 1, 2021, 10:22:27 PM3/1/21
to 'Praveen Kumar Singh' via Ansible Project
"user" is the name of a module ! (since 2.10 it is now ansible.builtin.user but for now there's some backward compatibility)
You can alternate part of your playbook with some being root or another user and some with the remote_user. So these different tag are needed, but you can factorize them on the play level or put them in the config file if you want

Télécharger BlueMail pour Android

Nuno Jordão

unread,
Mar 2, 2021, 5:49:12 AM3/2/21
to ansible...@googlegroups.com
Hello,

"become: yes" means you need to become a different user than the user used to connect. By default "root" as is normally used to elevate privileges. 
"become_user: postgres" if you need a different user, other than connecting user or root.

--
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-proje...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/90c7917a-0804-4332-8b92-fd76a296257en%40googlegroups.com.

Brian Coca

unread,
Mar 2, 2021, 7:21:22 PM3/2/21
to Ansible Project
it is 'useless' for those not using certain features, but mandatory to
support them.

Also you have the 'user' module and user(deprecated)/remote_user
keywords (login user) so become_user is required for disambiguation,
but you can drop `become_user: root` since that is the default.

--
----------
Brian Coca

Reply all
Reply to author
Forward
0 new messages