0

Is it possible to do something like this with Ansible's command module?

- command: {{ venv_path }}/bin/python {{ repo_path }}/manage.py runserver

Since there are no double quotes around the first set of braces, I get the usual "We could be wrong..." syntax error. But none of the following work either:

- command "{{ venv_path }}"/bin/python ... # Error
- command "{{ venv_path }}/bin/python" ... # Error
- command: "{{ venv_path }}/bin/python {{ repo_path }}/manage.py runserver" # Error

Thanks.

4
  • Does the last one really result into the same error as the other examples? This last line looks like it should work - or at least not fail due to the "We could be wrong..." syntax error. Commented Feb 13, 2016 at 2:24
  • yep, @udondan, I just created an example and cannot reproduce it. Robert, please give a sample example that fails, using something like "ls" as the command. Commented Feb 13, 2016 at 6:08
  • You can also try - command: > and then put the rest on the next line. Then it is treated as text in YAML and it wont complain Commented Feb 13, 2016 at 17:22
  • @Jim Upvote and accept my answer if you think it is useful so that others know this is the right answer, thanks! Commented Oct 14, 2018 at 3:58

1 Answer 1

1

try shell: "{{ venv_path }}/bin/python {{ repo_path }}/manage.py runserver"

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.