I"m looking at a Red Hat document that shows the following command:
$ ANSIBLE_BECOME_METHOD='sudo' ANSIBLE_BECOME=True
ANSIBLE_HOST_KEY_CHECKING=False ./setup.sh
My question involves the variable ANSIBLE_BECOME_METHOD.
We know that the purpose of this variable is to specify the preferred
method of privilege escalation to root. By default, the preferred
method is sudo. I see the inclusion of this variable in the above
command as being redundant - since the default method of privilege
escalation is sudo. Of course, nothing will be negatively impacted
with this redundancy.
Other than insuring that the method used will be sudo, is there some
benefit to explicitly assigning this variable - ANSIBLE_BECOME_MEHTHOD -
with the value sudo, even though the default method is already sudo?
Thanks in advance.
Hey Trevor,
The only scenario that comes to mind is that maybe ansible.cfg has a different setting for ansible_become_method in that environment and you want to override during the installation somehow. Another scenario is that this is only used for teaching purposes, in order to make the (default) configuration more obvious.
Is that a public document / KCS / something you can share? I'm also curious now :smiley_emoji: ...
Cheers
Fran
As @Fran_Garcia mentioned , I too think that this is beneficial for consistency and to override the deafult one :
https://docs.ansible.com/ansible/latest/playbook_guide/playbooks_privilege_escalation.html
Red Hat
Learning Community
A collaborative learning environment, enabling open source skill development.