My code is to check if the below software exists on the server and fail the playbook at the end if any of them is missing
- name: run powershell script
win_shell: POWERSHELL -file c:\temp\{{ script }}
register: PS_result
- debug:
msg: " Java x is installed"
when: "'Java: Version x' in PS_result.stdout"
- debug:
msg: "ERROR!! Java x is not installed"
when: "'Java: Version x' not in PS_result.stdout"
- debug:
msg: "'Websphere is installed"
when: "'Websphere: Version xx' in PS_result.stdout"
- debug:
msg: "ERROR!! Websphere is not installed"
when: "'Websphere: Version xx' not in PS_result.stdout"
- fail:
msg: "Error!! Few Applications are not installed"
when: ( "'Java: Version x' not in PS_result.stdout" ) or ( "'Websphere: Version xx' not in PS_result.stdout" )
My query is if any one of the software doesn't exist on the server, the playbook has to fail at the end. But above code throws syntax error at fail module. How to use multiple OR operator in this case.
Error
The offending line appears to be:\n\n msg: \"Error!! Few Applications are not installed, Please check keyword ERROR and request FIT to install\"\n when: ( \"'Java: Version x' not in PS_result.stdout\" ) or ( \"'Websphere: Version xx' not in PS_result.stdout\" )\n ^ here\nWe could be wrong, but this one looks like it might be an issue with\nunbalanced quotes. If starting a value with a quote, make sure the\nline ends with the same set of quotes.