# EVAL OF Variable

**URL:** <https://forum.ansible.com/t/eval-of-variable/36997>\
**Category:** Ansible Project\
**Created:** [August 17, 2022, 5:19pm UTC](https://forum.ansible.com/t/eval-of-variable/36997 "2022-08-17T17:19:45Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Michael\_Burch](https://avatars.discourse-cdn.com/v4/letter/m/9de053/32.png) [@Michael\_Burch](https://forum.ansible.com/u/Michael_Burch)\
**Post date:** [August 17, 2022, 5:19pm UTC](https://forum.ansible.com/t/eval-of-variable/36997/1 "2022-08-17T17:19:45Z")

</div>

Good afternoon Group. Any help is appreciated.

I have a survey that collects the name of a project (project\_name). Lets call it SKILL

I have variables set in the playbook for all the projects to save their USER and Password Info.

- SKILL\_UNAME
- SKILL\_PWORD

I have a task that has to account for the project name and pull the values from those variables to set a temp variable in the task. Unfortunately, I keep getting an error when attempting to do a lookup and get the value of the variable:  
set\_fact:  
temp\_uname: “{{ lookup(‘vars’, project\_name + ‘\_UNAME’ }}”  
temp\_pword: “{{ lookup(‘vars’, project\_name + ‘\_PWORD’ }}”

Error reads: template error while templating string: unexpected ‘}’, expected ‘)’. String: {{ lookup(‘vars’, project\_name + ‘\_UNAME’ }}"

Any help is appreciated!

---

<div class="post-metadata">

**Author:** ![Richard\_Megginson](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/richard_megginson/32/4540_2.png) [@Richard\_Megginson](https://forum.ansible.com/u/Richard_Megginson)\
**Post date:** [August 17, 2022, 5:21pm UTC](https://forum.ansible.com/t/eval-of-variable/36997/2 "2022-08-17T17:21:24Z")

</div>

> Good afternoon Group. Any help is appreciated.
> 
> I have a survey that collects the name of a project (project\_name). Lets call it SKILL
> 
> I have variables set in the playbook for all the projects to save their USER and Password Info.
> 
> - SKILL\_UNAME
> - SKILL\_PWORD
> 
> I have a task that has to account for the project name and pull the values from those variables to set a temp variable in the task. Unfortunately, I keep getting an error when attempting to do a lookup and get the value of the variable:  
> set\_fact:  
> temp\_uname: “{{ lookup(‘vars’, project\_name + ‘\_UNAME’ }}”  
> temp\_pword: “{{ lookup(‘vars’, project\_name + ‘\_PWORD’ }}”

Missing closing parentheses

temp\_uname: “{{ lookup(‘vars’, project\_name + ‘\_UNAME’) }}”  
temp\_pword: “{{ lookup(‘vars’, project\_name + ‘\_PWORD’) }}”

---

<div class="post-metadata">

**Author:** ![Michael\_Burch](https://avatars.discourse-cdn.com/v4/letter/m/9de053/32.png) [@Michael\_Burch](https://forum.ansible.com/u/Michael_Burch)\
**Post date:** [August 17, 2022, 6:54pm UTC](https://forum.ansible.com/t/eval-of-variable/36997/3 "2022-08-17T18:54:14Z")

</div>

Yes… Resolved…

Thanks,
