how can I pull a string from the stdout and use it for failed_when? I run a command on a switch and then I want to match a string w/in that output to determine if it failed or not.
Here’s what the playbook looks like:
how can I pull a string from the stdout and use it for failed_when? I run a command on a switch and then I want to match a string w/in that output to determine if it failed or not.
Here’s what the playbook looks like:
As you can see here the [ indicate a list so first element is 0.
The nxos_command takes several commands, the first command is in list element 0, the second one is list element 1 and so on....
so you need to use element 0 like this
failed_when: ("could not retrieve rsa key information" in print_output.stdout.0)
Thanks Kai, That worked.