# Variable substitution problem in task name

**URL:** <https://forum.ansible.com/t/variable-substitution-problem-in-task-name/17737>\
**Category:** Ansible Project\
**Created:** [March 13, 2015, 10:56am UTC](https://forum.ansible.com/t/variable-substitution-problem-in-task-name/17737 "2015-03-13T10:56:47Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/ansible/original/1X/1882d9a01da5d8996a862359b0913cc568a39b84.svg) [@system](https://forum.ansible.com/u/system)\
**Post date:** [March 13, 2015, 10:56am UTC](https://forum.ansible.com/t/variable-substitution-problem-in-task-name/17737/1 "2015-03-13T10:56:47Z")

</div>

Hi,

I have a problem with the Variable substitution in task name, like:

- name: VPC | Write public subnets id to ‘{{ vpc\_name }}’\_vpc\_info.yml file  
local\_action: shell echo “{{ item.id }}” \> ./vars/{{ item.resource\_tags.Name }}.yml  
with\_items: vpc.subnets

But when I run this playbook, it gave me the result like this:

TASK: [VPC | Write public subnets id to ‘{{ vpc\_name }}’\_vpc\_info.yml file] \*\*\*

changed: [localhost → 127.0.0.1] =\> (item={u’resource\_tags’: {u’Name’: u’tendo\_public\_subnet’}, u’cidr’: u’172.25.10.0/24’, u’az’: u’ap-southeast-2a’, u’id’: u’subnet-947bbce3’})  
changed: [localhost → 127.0.0.1] =\> (item={u’resource\_tags’: {u’Name’: u’tendo\_private\_subnet’}, u’cidr’: u’172.25.20.0/24’, u’az’: u’ap-southeast-2b’, u’id’: u’subnet-5be23b3e’})

instead it should give result like this, which i expect:

TASK: [VPC | Write public subnets id to tendo\_vpc\_info.yml file] \*\*\*

changed: [localhost → 127.0.0.1] =\> (item={u’resource\_tags’: {u’Name’: u’tendo\_public\_subnet’}, u’cidr’: u’172.25.10.0/24’, u’az’: u’ap-southeast-2a’, u’id’: u’subnet-947bbce3’})  
changed: [localhost → 127.0.0.1] =\> (item={u’resource\_tags’: {u’Name’: u’tendo\_private\_subnet’}, u’cidr’: u’172.25.20.0/24’, u’az’: u’ap-southeast-2b’, u’id’: u’subnet-5be23b3e’})

Can somebody point me that where I am making mistake? Thanks

---

<div class="post-metadata">

**Author:** ![Mirko\_Friedenhagen](https://avatars.discourse-cdn.com/v4/letter/m/838e76/32.png) [@Mirko\_Friedenhagen](https://forum.ansible.com/u/Mirko_Friedenhagen)\
**Post date:** [March 16, 2015, 10:48am UTC](https://forum.ansible.com/t/variable-substitution-problem-in-task-name/17737/2 "2015-03-16T10:48:10Z")

</div>

No solution but only a confirmation that I see thisas well, at least  
in some cases while in other cases the variable is substituted in the  
task name.  
Regards Mirko

---

<div class="post-metadata">

**Author:** ![Michael\_Bushey](https://avatars.discourse-cdn.com/v4/letter/m/e9bcb4/32.png) [@Michael\_Bushey](https://forum.ansible.com/u/Michael_Bushey)\
**Post date:** [March 18, 2015, 6:46pm UTC](https://forum.ansible.com/t/variable-substitution-problem-in-task-name/17737/3 "2015-03-18T18:46:39Z")

</div>

Hi Arbab,

That’s just the way Ansible works, the ‘- name’ item is not parsed for variable substitution. That’s pissed me off too.

---

<div class="post-metadata">

**Author:** ![Brian\_Coca](https://avatars.discourse-cdn.com/v4/letter/b/6de8d8/32.png) [@Brian\_Coca](https://forum.ansible.com/u/Brian_Coca)\
**Post date:** [March 18, 2015, 7:02pm UTC](https://forum.ansible.com/t/variable-substitution-problem-in-task-name/17737/4 "2015-03-18T19:02:30Z")

</div>

This is a known bug in 1.8, it should work for variables that are in  
scope (non inventory/host).
