# ansible template vars for command line invocation

**URL:** <https://forum.ansible.com/t/ansible-template-vars-for-command-line-invocation/35611>\
**Category:** Ansible Project\
**Created:** [August 11, 2021, 1:58pm UTC](https://forum.ansible.com/t/ansible-template-vars-for-command-line-invocation/35611 "2021-08-11T13:58:34Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Ed\_Greenberg](https://avatars.discourse-cdn.com/v4/letter/e/7ab992/32.png) [@Ed\_Greenberg](https://forum.ansible.com/u/Ed_Greenberg)\
**Post date:** [August 11, 2021, 1:58pm UTC](https://forum.ansible.com/t/ansible-template-vars-for-command-line-invocation/35611/1 "2021-08-11T13:58:34Z")

</div>

Hi, I have a bash command of:

ansible beta -m template -a 'src=…/templates/www.conf.j2 dest=/root/www.conf ’

I need to specify a variable on the command line.

I tried specifying it in the -a string, but got an error that template only accepts certain variables.

IF the template was in a playbook I could provide the variable(s) using -e. How can I do this from the command line invocation?

Thanks,  
Ed

---

<div class="post-metadata">

**Author:** ![Roberto\_J\_R\_Paz](https://avatars.discourse-cdn.com/v4/letter/r/d2c977/32.png) [@Roberto\_J\_R\_Paz](https://forum.ansible.com/u/Roberto_J_R_Paz)\
**Post date:** [August 11, 2021, 2:14pm UTC](https://forum.ansible.com/t/ansible-template-vars-for-command-line-invocation/35611/2 "2021-08-11T14:14:06Z")

</div>

Can you share the error message? Didn’t work if you use as an “extra var” added to the command line you posted?
