From fbb82a0875dacc8200d3f663c3286104d0a1afbf Mon Sep 17 00:00:00 2001 From: GomathiselviS Date: Fri, 24 Jul 2020 16:16:03 -0400 Subject: [vyos] Fix sanity issues (#58) [vyos] Fix sanity issues Reviewed-by: https://github.com/apps/ansible-zuul --- plugins/modules/vyos_command.py | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) (limited to 'plugins/modules/vyos_command.py') diff --git a/plugins/modules/vyos_command.py b/plugins/modules/vyos_command.py index 03f476c8..cb1fd476 100644 --- a/plugins/modules/vyos_command.py +++ b/plugins/modules/vyos_command.py @@ -42,13 +42,20 @@ options: output from the command execution is returned to the playbook. If the I(wait_for) argument is provided, the module is not returned until the condition is satisfied or the number of retries has been exceeded. + - If a command sent to the device requires answering a prompt, it is possible to pass + a dict containing command, answer and prompt. Common answers are 'y' or "\\r" + (carriage return, must be double quotes). Refer below examples. required: true + type: list + elements: raw wait_for: description: - Specifies what to evaluate from the output of the command and what conditionals to apply. This argument will cause the task to wait for a particular conditional to be true before moving forward. If the conditional is not true by the configured I(retries), the task fails. See examples. + type: list + elements: str aliases: - waitfor match: @@ -58,6 +65,7 @@ options: set to C(all) then all conditionals in the wait_for must be satisfied. If the value is set to C(any) then only one of the values must be satisfied. default: all + type: str choices: - any - all @@ -67,12 +75,14 @@ options: failed. The command is run on the target device every retry and evaluated against the I(wait_for) conditionals. default: 10 + type: int interval: description: - Configures the interval in seconds to wait between I(retries) of the command. If the command does not pass the specified conditions, the interval indicates how long to wait before trying the command again. default: 1 + type: int notes: - Tested against VyOS 1.1.8 (helium). - Running C(show system boot-messages all) will cause the module to hang since VyOS @@ -166,8 +176,8 @@ def parse_commands(module, warnings): def main(): spec = dict( - commands=dict(type="list", required=True), - wait_for=dict(type="list", aliases=["waitfor"]), + commands=dict(type="list", required=True, elements="raw"), + wait_for=dict(type="list", aliases=["waitfor"], elements="str"), match=dict(default="all", choices=["all", "any"]), retries=dict(default=10, type="int"), interval=dict(default=1, type="int"), -- cgit v1.2.3