diff --git a/changelogs/fragments/57057-add-terminal-initial-prompt-for-initial-connection.yml b/changelogs/fragments/57057-add-terminal-initial-prompt-for-initial-connection.yml new file mode 100644 index 00000000000..d816c926e6c --- /dev/null +++ b/changelogs/fragments/57057-add-terminal-initial-prompt-for-initial-connection.yml @@ -0,0 +1,2 @@ +bugfixes: +- add terminal initial prompt for initial connection(https://github.com/ansible/ansible/pull/57057). \ No newline at end of file diff --git a/lib/ansible/plugins/terminal/ce.py b/lib/ansible/plugins/terminal/ce.py index 557fcf3ac51..67936e8fef3 100644 --- a/lib/ansible/plugins/terminal/ce.py +++ b/lib/ansible/plugins/terminal/ce.py @@ -31,7 +31,13 @@ class TerminalModule(TerminalBase): re.compile(br'[\r\n]?<.+>(?:\s*)$'), re.compile(br'[\r\n]?\[.+\](?:\s*)$'), ] + #: terminal initial prompt + #: The password needs to be changed. Change now? [Y/N]: + terminal_initial_prompt = br'Change\s*now\s*\?\s*\[Y\/N\]\s*:' + #: terminal initial answer + #: do not change password when it is asked to change with initial connection. + terminal_initial_answer = b'N' terminal_stderr_re = [ re.compile(br"% ?Error: "), re.compile(br"^% \w+", re.M),