# How to utilize AWX survey variable as conditional

**URL:** <https://forum.ansible.com/t/how-to-utilize-awx-survey-variable-as-conditional/35322>\
**Category:** AWX Project\
**Tags:** awx\
**Created:** [June 9, 2021, 2:39pm UTC](https://forum.ansible.com/t/how-to-utilize-awx-survey-variable-as-conditional/35322 "2021-06-09T14:39:45Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Tony1](https://avatars.discourse-cdn.com/v4/letter/t/858c86/32.png) [@Tony1](https://forum.ansible.com/u/Tony1)\
**Post date:** [June 9, 2021, 2:39pm UTC](https://forum.ansible.com/t/how-to-utilize-awx-survey-variable-as-conditional/35322/1 "2021-06-09T14:39:45Z")

</div>

I am trying to use a survey variable in a conditional but a bit stuck

when: (variable\_name == ‘string’) but it doesn’t read my variable

I guess this is a syntax error but I am struggling to find out more info on google in relation to surveys.

Any help would be most appreciated

Thank you

---

<div class="post-metadata">

**Author:** ![Tony1](https://avatars.discourse-cdn.com/v4/letter/t/858c86/32.png) [@Tony1](https://forum.ansible.com/u/Tony1)\
**Post date:** [June 10, 2021, 8:16am UTC](https://forum.ansible.com/t/how-to-utilize-awx-survey-variable-as-conditional/35322/2 "2021-06-10T08:16:29Z")

</div>

Anyone? 🙂

---

<div class="post-metadata">

**Author:** ![Wei-Yen\_Tan](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/wei-yen_tan/32/4111_2.png) [@Wei-Yen\_Tan](https://forum.ansible.com/u/Wei-Yen_Tan)\
**Post date:** [June 10, 2021, 8:18am UTC](https://forum.ansible.com/t/how-to-utilize-awx-survey-variable-as-conditional/35322/3 "2021-06-10T08:18:40Z")

</div>

Please show playbook and show what you are putting in survey

---

<div class="post-metadata">

**Author:** ![Tony1](https://avatars.discourse-cdn.com/v4/letter/t/858c86/32.png) [@Tony1](https://forum.ansible.com/u/Tony1)\
**Post date:** [June 10, 2021, 8:27am UTC](https://forum.ansible.com/t/how-to-utilize-awx-survey-variable-as-conditional/35322/4 "2021-06-10T08:27:38Z")

</div>

Hey weiye,

thanks again for helping me, I’ve just got it working, it was a syntax error.

I wanted a host to be added to awx when a condition was met from the survey… here is what I did.

env\_type is the survey variable

- name: add tower host

when: ‘(env\_type) == [“nonprod”]’

i’ll probably handle this differently in future, but for now this is what I wanted
