command
Run commands and wait for conditions on Cisco SMB switches
Collection: community.ciscosmb
Full Name: community.ciscosmb.command
Controller module — runs on the local controller, not on remote hosts.
Synopsis
Run commands and wait for conditions on Cisco SMB switches
Parameters
| Name | Type | Required | Default | Description |
|---|---|---|---|---|
| commands | list | yes | Ordered CLI command strings | |
| wait_for | list | Conditions evaluated against command results | ||
| match | string | all | Require all or any condition | |
| retries | int | 10 | Number of condition evaluation attempts | |
| interval | int | 1 | Seconds between unsuccessful attempts |
Example
yaml
- name: Run command on remote devices
community.ciscosmb.command:
commands: show version
- name: Run command and check to see if output contains PID
community.ciscosmb.command:
commands: show inventory
wait_for: result[0] contains PID
- name: Run multiple commands on remote nodes
community.ciscosmb.command:
commands:
- show version
- show system
- name: Run multiple commands and evaluate the output
community.ciscosmb.command:
commands:
- show version
- show system
wait_for:
- result[0] contains Active-image
- result[1] contains "System Up Time"