register results in a text file after retrieving it on a device with (gather_facts)

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 :slight_smile:

This my script

(attachments)

instead of the 2 debug statements use a template action
https://docs.ansible.com/ansible/latest/modules/template_module.html if you delegate_to: localhost it will write the file on the controller.

(attachments)

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