niubiwocao / niubiwocao.ne / 1.0.0 / module / ne_command Run arbitrary command on HUAWEI router devices based on VRP. | "added in version" 2.5 of niubiwocao.ne" Authors: LiQingKai preview | supported by communityniubiwocao.ne.ne_command (1.0.0) — module
Install with ansible-galaxy collection install niubiwocao.ne:==1.0.0
collections: - name: niubiwocao.ne version: 1.0.0
Sends an arbitrary command to an HUAWEI router node and returns the results read from the device. The router_command module includes an argument that will cause the module to wait for a specific condition before returning or timing out if the condition is not met.
# Note: examples below use network_cli to handle # transport and authentication to the node. - name: ne command test hosts: ne connection: network_cli gather_facts: no tasks: - name: "Run display version on remote devices" ne_command: commands: display version - name: "Run display version and check to see if output contains HUAWEI" ne_command: commands: display version wait_for: result[0] contains HUAWEI - name: "Run multiple commands on remote nodes" ne_command: commands: - display version - display device
match: default: all description: - The I(match) argument is used in conjunction with the I(wait_for) argument to specify the match policy. Valid values are C(all) or C(any). If the value is set to C(all) then all conditionals in the I(wait_for) must be satisfied. If the value is set to C(any) then only one of the values must be satisfied. required: false retries: default: 10 description: - Specifies the number of retries a command should by tried before it is considered failed. The command is run on the target device every retry and evaluated against the I(wait_for) conditionals. required: false commands: description: - The commands to send to the remote HUAWEI router device over the configured provider. The resulting output from the command is returned. If the I(wait_for) argument is provided, the module is not returned until the condition is satisfied or the number of I(retries) has been exceeded. required: true interval: default: 1 description: - Configures the interval in seconds to wait between retries of the command. If the command does not pass the specified conditional, the interval indicates how to long to wait before trying the command again. required: false wait_for: default: null 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 retries, the task fails. See examples. required: false
failed_conditions: description: the conditionals that failed returned: failed sample: - '...' - '...' type: list stdout: description: the set of responses from the commands returned: always sample: - '...' - '...' type: list stdout_lines: description: The value of stdout split into a list returned: always sample: - - '...' - '...' - - '...' - - '...' type: list