---
- name: "PLAY 1: Capture and store VRF config"
  hosts: routers
  connection: network_cli
  tasks:
    - name: "TASK 1: Get VRF config from routers"
      ios_command:
        commands: "show running-config | section vrf definition"
      register: cli_result

    - name: "TASK 2: Print VRF output"
      debug:
        msg: "{{ cli_result }}"

    - name: "TASK 3: Create outputs/ folder"
      file:
        path: "outputs"
        state: directory
      run_once: true

    - name: "TASK 4: Write output to file"
      copy:
        content: "{{ cli_result.stdout[0] }}\n"
        dest: "outputs/{{ inventory_hostname }}.txt"
