diff --git a/changelogs/fragments/timeout_config_fix.yml b/changelogs/fragments/timeout_config_fix.yml new file mode 100644 index 00000000000..5cebe81bf69 --- /dev/null +++ b/changelogs/fragments/timeout_config_fix.yml @@ -0,0 +1,5 @@ +bugfixes: + - connection timeouts defined in ansible.cfg will now be properly used, the --timeout cli option was obscuring them by always being set. +breaking_changes: + - Any plugin using the config system and the `cli` entry to use the `timeout` from the command line, will see the value change if the use had configured it in any of the lower precedence methods. + If relying on this behaviour to consume the global/generic timeout from the DEFAULT_TIMEOUT constant, please consult the documentation on plugin configuration to add the overlaping entries. diff --git a/lib/ansible/cli/arguments/option_helpers.py b/lib/ansible/cli/arguments/option_helpers.py index a3efb1e2680..e3f661111f1 100644 --- a/lib/ansible/cli/arguments/option_helpers.py +++ b/lib/ansible/cli/arguments/option_helpers.py @@ -250,8 +250,8 @@ def add_connect_options(parser): help='connect as this user (default=%s)' % C.DEFAULT_REMOTE_USER) connect_group.add_argument('-c', '--connection', dest='connection', default=C.DEFAULT_TRANSPORT, help="connection type to use (default=%s)" % C.DEFAULT_TRANSPORT) - connect_group.add_argument('-T', '--timeout', default=C.DEFAULT_TIMEOUT, type=int, dest='timeout', - help="override the connection timeout in seconds (default=%s)" % C.DEFAULT_TIMEOUT) + connect_group.add_argument('-T', '--timeout', default=None, type=int, dest='timeout', + help="override the connection timeout in seconds (default depends on connection)") # ssh only connect_group.add_argument('--ssh-common-args', default=None, dest='ssh_common_args',