# Command line variables not respected in case of an include and variable rename

**URL:** <https://forum.ansible.com/t/command-line-variables-not-respected-in-case-of-an-include-and-variable-rename/17655>\
**Category:** Ansible Project\
**Created:** [March 3, 2015, 10:05am UTC](https://forum.ansible.com/t/command-line-variables-not-respected-in-case-of-an-include-and-variable-rename/17655 "2015-03-03T10:05:46Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Ivan\_Spasov](https://avatars.discourse-cdn.com/v4/letter/i/b9e5f3/32.png) [@Ivan\_Spasov](https://forum.ansible.com/u/Ivan_Spasov)\
**Post date:** [March 3, 2015, 10:05am UTC](https://forum.ansible.com/t/command-line-variables-not-respected-in-case-of-an-include-and-variable-rename/17655/1 "2015-03-03T10:05:46Z")

</div>

I have the following scenarion

I have definied a variable named **old\_var\_name** inside **group\_vars/all/common.yml** the following way

**group\_vars/all/common.yml**

old\_var\_name: some\_text

I have a **foo.yml** and a **bar.yml** files defined the following way:

**foo.yml**

- name: Do stuff  
vars:  
new\_var\_name: “{{ old\_var\_name }}”  
include: bar.yml

**bar.yml**

- name: Debug var  
debug: msg={{ new\_var\_name}}

If I call the tasks from the command line and try to pass **old\_var\_name** with " **-e “old\_var\_name=command\_line\_text”** I expect the result to be:

ok: [ab-linuxbpc-2.sit] =\> {  
“msg”: “ **command\_line\_text** ”  
}

but instead I get

ok: [ab-linuxbpc-2.sit] =\> {  
“msg”: “ **some\_text** ”  
}

If I pass " **-e “new\_var\_name=command\_line\_text”** I do get the desired result.  
In addition If I move the declaration of **old\_var\_name** from **group\_vars/all/common.yml** to the **defaults** of the role where **foo.yml** is definied I also get the desired result.  
It seems the command line varialbe cannot overwrite just the group one.  
Is this expected? Or I should file a bug?
