# How to set a variable using dynamic inventory using Ansible

**URL:** <https://forum.ansible.com/t/how-to-set-a-variable-using-dynamic-inventory-using-ansible/18533>\
**Category:** Ansible Project\
**Created:** [June 17, 2015, 7:44pm UTC](https://forum.ansible.com/t/how-to-set-a-variable-using-dynamic-inventory-using-ansible/18533 "2015-06-17T19:44:45Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Rahul\_Mehrotra](https://avatars.discourse-cdn.com/v4/letter/r/5e9695/32.png) [@Rahul\_Mehrotra](https://forum.ansible.com/u/Rahul_Mehrotra)\
**Post date:** [June 17, 2015, 7:44pm UTC](https://forum.ansible.com/t/how-to-set-a-variable-using-dynamic-inventory-using-ansible/18533/1 "2015-06-17T19:44:45Z")

</div>

I am looking for method to set a variable in ansible playbook using inventory information received from dynamic inventory.

For example if we have a sample playbook like

---

<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:** [June 18, 2015, 4:11am UTC](https://forum.ansible.com/t/how-to-set-a-variable-using-dynamic-inventory-using-ansible/18533/2 "2015-06-18T04:11:53Z")

</div>

what is rds\_mysql in this context? it is not clear that it is returned  
as a hostvar/groupvar or something else
