哪个 ansible.cfg 超时值在 ansible-playbook 命令上被“-T”覆盖?

bdx*_*bdx 2 ansible

ansible -playbook 文档说 -T 将“以秒为单位覆盖连接超时(默认=10)”。

/etc/ansible/ansible.cfg文件的 部分下[persistent_connection],有connect_timeout (默认 30 秒)command_timeout (默认 10 秒)

ansible-playbook 文档表明 connect_timeout被覆盖,但页面指定的默认值与connect_timeout默认值不匹配,它与command_timeout默认值匹配。

那么,ansible-playbook 命令上的 -T 标志是否会覆盖connect_timeoutcommand_timeout或与其中任何一个都不相关的其他超时?

Kon*_*rov 5

-T相当于DEFAULT_TIMEOUT配置设置。

DEFAULT_TIMEOUT:
  default: 10
  description: This is the default timeout for connection plugins to use.
  env:
  - {name: ANSIBLE_TIMEOUT}
  ini:
  - {key: timeout, section: defaults}
  name: Connection timeout
  type: integer
Run Code Online (Sandbox Code Playgroud)

对于ssh连接插件,它被用作ConnectTimeout=<value>,意思是:

ConnectTimeout
   Specifies the timeout (in seconds) used when connecting to the SSH server, instead of using the default system TCP timeout.
   This value is used only when the target is down or really unreachable, not when it refuses the connection.
Run Code Online (Sandbox Code Playgroud)

command_timeout是关于:

PERSISTENT_COMMAND_TIMEOUT:
  default: 10
  description: This controls the amount of time to wait for response from remote device
    before timing out presistent connection.
  env:
  - {name: ANSIBLE_PERSISTENT_COMMAND_TIMEOUT}
  ini:
  - {key: command_timeout, section: persistent_connection}
  name: Persistence command timeout
  type: int
Run Code Online (Sandbox Code Playgroud)

  • CLI 开关映射位于[此处](https://github.com/ansible/ansible/blob/v2.7.7/lib/ansible/cli/__init__.py#L482)。至于配置助手,请使用“ansible-config list” (2认同)