user2315104
user2315104

Reputation: 2722

How to pass variable in command module in ansible

i am using folloing task in YAMl file.

- name: Run deployment of RWI Artifact command: "{{ deploy_script }} /home/scripts/lite /application/ a-CL '--Home=/opt/AppServer --appClassLoaderMode=abc'"

but typically , i am getting following error

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:

with_items: - {{ foo }}

Should be written as:

with_items: - "{{ foo }}"

i tried all combination but dont know how to put those quotes correctly.

please suggest

Upvotes: 0

Views: 2213

Answers (1)

Konstantin Suvorov
Konstantin Suvorov

Reputation: 68269

In YAML if you start string with quote, it is considered as quoted string, so you must end the string with the same quote.

Try:

- name: Run deployment of RWI Artifact
  command: "{{ deploy_script }} /home/scripts/lite /application/ a-CL '--Home=/opt/AppServer --appClassLoaderMode=abc'"

I assume that deploy_script has no spaces.

Upvotes: 1

Related Questions