# How to use variable in path

**URL:** <https://forum.ansible.com/t/how-to-use-variable-in-path/35856>\
**Category:** Ansible Project\
**Created:** [October 12, 2021, 4:22pm UTC](https://forum.ansible.com/t/how-to-use-variable-in-path/35856 "2021-10-12T16:22:17Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Sanjay\_Chakraborty](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/sanjay_chakraborty/32/10409_2.png) [@Sanjay\_Chakraborty](https://forum.ansible.com/u/Sanjay_Chakraborty)\
**Post date:** [October 12, 2021, 4:22pm UTC](https://forum.ansible.com/t/how-to-use-variable-in-path/35856/1 "2021-10-12T16:22:17Z")

</div>

I need to disable ipv6 on the network interface config file. The interface name is not the same for all environments. How I can achieve that ?  
playbook :

---

<div class="post-metadata">

**Author:** ![sivel](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/sivel/32/1198_2.png) [@sivel](https://forum.ansible.com/u/sivel)\
**Post date:** [October 12, 2021, 4:37pm UTC](https://forum.ansible.com/t/how-to-use-variable-in-path/35856/2 "2021-10-12T16:37:16Z")

</div>

Just replace `{{ item }}` with `{{ ansible_default_ipv4.interface }}` and delete the `loop`

---

<div class="post-metadata">

**Author:** ![Sanjay\_Chakraborty](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/sanjay_chakraborty/32/10409_2.png) [@Sanjay\_Chakraborty](https://forum.ansible.com/u/Sanjay_Chakraborty)\
**Post date:** [October 12, 2021, 5:21pm UTC](https://forum.ansible.com/t/how-to-use-variable-in-path/35856/3 "2021-10-12T17:21:03Z")

</div>

It worked Matt!  
Ironically I did try that but it was gather\_fact = false and it failed previously.  
Thank you !

Regards,  
Sanjay C.
