Connection Parameters
Overview
#------------------------------------------------------------------------------
# CONNECTION PARAMETERS
#------------------------------------------------------------------------------
proxy_env
ansible_host
Reference
proxy_env
In some areas where there is an “Internet block”, some software downloads may be affected.
For example, when accessing the official PostgreSQL source from mainland China, the download speed may only be a few kilobytes per second. However, if you use a proper HTTP proxy, it can reach several MB per second.
Therefore, if you have a proxy server, please configure it via proxy_env
, sample as follows.
proxy_env: # global proxy env when downloading packages
http_proxy: 'http://username:password@proxy.address.com'
https_proxy: 'http://username:password@proxy.address.com'
all_proxy: 'http://username:password@proxy.address.com'
no_proxy: "localhost,127.0.0.1,10.0.0.0/8,192.168.0.0/16,*.pigsty,*.aliyun.com"
ansible_host
If your environment uses a springboard machine, or has some customization that prevents access via the simple ssh <ip>
method, then consider using Ansible’s connection parameters. ansible_host
is the most typical of ansiblel connection parameters.
ansible_host
The name of the host to connect to, if different from the alias you wish to give to it.
ansible_port
The ssh port number, if not 22
ansible_user
The default ssh user name to use.
ansible_ssh_pass
The ssh password to use (never store this variable in plain text; always use a vault. See Variables and Vaults)
ansible_ssh_private_key_file
Private key file used by ssh. Useful if using multiple keys and you don’t want to use SSH agent.
ansible_ssh_common_args
This setting is always appended to the default command line for sftp, scp, and ssh. Useful to configure a
ProxyCommand
for a certain host (or group).ansible_sftp_extra_args
This setting is always appended to the default sftp command line.
ansible_scp_extra_args
This setting is always appended to the default scp command line.
ansible_ssh_extra_args
This setting is always appended to the default ssh command line.
ansible_ssh_pipelining
Determines whether or not to use SSH pipelining. This can override the
pipelining
setting inansible.cfg
.
The simplest usage is to configure ssh alias
as ansible_host
, and as long as you can access the target machine by means of ssh <name>
, then configure ansible_host
as <name>
. Note that these variables are Instance level variables.