Ansible installations may be modified by adjusting settings in the Ansible configuration file. Ansible selects a configuration file from one of several available places on the control node.
The ansible configuration file consists of several options, and settings are defined as key-value pairs. Consist of two section
[defaults]
, which sets defaults for Ansible operation.
[privilege_escalation
], which configures how Ansible performs privilege escalation on managed hosts.
Example of a typical ansible.cfg
[defaults]
inventory = ./inventory
remote_user = user
ask_pass = false
[privilege_escalation]
become = True
become_method = sudo
become_user = root
become_ask_pass = false
become = True become_method = sudo become_user = root become_ask_pass = false
inventory
, The path to the inventory file
remote_user
, The username that Ansible uses to connect to the managed hosts. If not defined, the current user’s name is used.
In ansible-navigator, this is always the root.
ask_pass
, Whether to prompt for an SSH password.
become
, To automatically switch users on the managed host, typical to root after connecting.
become_method
, How to switch users, typical sudo
which is the defaults, can also use su
option.
become_user
, Which user to switch to on the managed host typical root.
become_ask_pass
, Whether to prompt for a prompt for the become_method
parameter. Defaults are false.