Hello!
I need to run a task based on the stderr output of a previous task:
My stderr output is as follows:
“stderr”: “Failed to enable application app2_20180601.05 : Application app1_20180501.01 has not been disabled yet.”
Defined Variable:
newApp: app2_20180601.05
The value below, can be any value, and it could change from time-to-time (and is not defined as a variable, it’s just something the stderr reports). So essentially I am planning to make that a regex or somehow use a wild card so that my when statement always picks it up.
app1_20180501.01
Question: How can I use regex in the when statement? Along with some variables?
For example if I set it persistently, it always works:
`
- debug:
msg: The old application has not been disabled yet
when: ‘app_enabled_status.stderr is search(“Failed to enable application " ~ newApp ~ " : Application app1_20180501.01 has not been disabled yet.”)’
`
However, I would like to set it to:
`
- debug:
msg: The old application has not been disabled yet
when: ‘app_enabled_status.stderr is search(“Failed to enable application " ~ newApp ~ " : Application * has not been disabled yet.”)’
`
or
- debug:
msg: The old application has not been disabled yet
when: ‘app_enabled_status.stderr is search("Failed to enable application " ~ newApp ~ " : Application (’\w+\d_\d{8}.\d{2}‘) has not been disabled yet.")’
Many thanks for your assistance in advance!
Regards
JS