Ansible parse variables with special characters

I need to pass certain strings with special characters like $ to variables.
I was able to parse by providing the values in single quotes or using \ when the string contains a single $ .

Ex below x is my variable.

X : '${name}' --> this works.

But when my variable value is complex containing many $ in its value, it doesn't parse it.

Example :
X : '${name} --loglevel = ${loglevel}, --type=${type}'

The above is a shortend version but actually has many $ in the same format like above.
I tried using \ for every $ but it didn't help.

Is there a way to parse them ?

I got no problem with this so I think you need to explain more in detail what you are doing.

$ cat test.yml

I had ame issue.
Try escaping dollar sign

X : ‘${name} --loglevel = ${loglevel}, --type=${type}’