# register results in a text file after retrieving it on a device with (gather\_facts)

**URL:** <https://forum.ansible.com/t/register-results-in-a-text-file-after-retrieving-it-on-a-device-with-gather-facts/31981>\
**Category:** Ansible Project\
**Created:** [January 15, 2020, 1:20pm UTC](https://forum.ansible.com/t/register-results-in-a-text-file-after-retrieving-it-on-a-device-with-gather-facts/31981 "2020-01-15T13:20:26Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Kaouane\_Alaaeddine](https://avatars.discourse-cdn.com/v4/letter/k/a87d85/32.png) [@Kaouane\_Alaaeddine](https://forum.ansible.com/u/Kaouane_Alaaeddine)\
**Post date:** [January 15, 2020, 1:20pm UTC](https://forum.ansible.com/t/register-results-in-a-text-file-after-retrieving-it-on-a-device-with-gather-facts/31981/1 "2020-01-15T13:20:26Z")

</div>

Hello all

my tesk consist to register the number of vlan available in the device ( cisco switch) in a texte file

1. I want to get just the value of vlan sotred in the item"vlan\_id"

I hope someone can help me 🙂

This my script

> **(attachments)**
>
> ![Capture.PNG](https://us1.discourse-cdn.com/ansible/original/2X/f/fdf64d1a81899628f7cfd7e8ce902924e410cd89.png)

---

<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:** [January 15, 2020, 5:47pm UTC](https://forum.ansible.com/t/register-results-in-a-text-file-after-retrieving-it-on-a-device-with-gather-facts/31981/2 "2020-01-15T17:47:43Z")

</div>

instead of the 2 debug statements use a `template` action  
[https://docs.ansible.com/ansible/latest/modules/template\_module.html](https://docs.ansible.com/ansible/latest/modules/template_module.html) if you delegate\_to: localhost it will write the file on the controller.

> **(attachments)**
>
> ![Capture.PNG](https://us1.discourse-cdn.com/ansible/original/2X/f/fdf64d1a81899628f7cfd7e8ce902924e410cd89.png)

---

<div class="post-metadata">

**Author:** ![Kaouane\_Alaaeddine](https://avatars.discourse-cdn.com/v4/letter/k/a87d85/32.png) [@Kaouane\_Alaaeddine](https://forum.ansible.com/u/Kaouane_Alaaeddine)\
**Post date:** [January 16, 2020, 8:36am UTC](https://forum.ansible.com/t/register-results-in-a-text-file-after-retrieving-it-on-a-device-with-gather-facts/31981/3 "2020-01-16T08:36:29Z")

</div>

Hello Brian,  
thanks you for your answer,  
I’ve already tried to used the template fonction but i can solves this issus " i don’t know exactly what i must to do

I am a very beginner in this field, i don’t understand all of ansible,  
i want some help can, and orient me or help to bluid this script

regards
