Below is the string
ORACLE_THIN PTEST1 my$pass myhost-SCA.mybank.com:1521/OLTP445
Desired output with password enclosed in single quotes:
ORACLE_THIN PTEST1 'my$pass' myhost-SCA.mybank.com:1521/OLTP445
Below is my ansible playbook:
- debug:
msg: "utils.dbping string is {{ item.split()[0] ~ ' ' ~ item.split()[1] ~ ' \'' ~ item.split()[2] ~ '\' ' ~ item.split()[3] | trim }}"
loop:
- ORACLE_THIN PTEST1 my$pass myhost-SCA.mybank.com:1521/OLTP445
However, i get syntax error while executing:
The offending line appears to be:
- debug:
msg: "utils.dbping string is {{ item.split()[0] ~ ' ' ~ item.split()[1] ~ ' \'' ~ item.split()[2] ~ '\' ' ~ item.split()[3] | trim }}"
^ here
We could be wrong, but this one looks like it might be an issue with
missing quotes. Always quote template expression brackets when they
start a value. For instance:
Can you please suggest?