0

I'm looking to create a playbook on ansible to gather info of more than 300 hosts and save the info to a file. I get 2 diffente issues, one not being able to save the info to a file and the second issue comes because of telnet connection of some hosts, only working for ssh hosts.

ansible 2.9.3 under vm CentOS7

Already tried:

- name: "[SCAN][IOS] IOS play for scanning facts"
  hosts: CISCO
  connection: network_cli
  ignore_errors: true
  ignore_unreachable: true
  vars:
     ansible_network_os: ios
  gather_facts: False 

  tasks:
  - name: run show logging host ip on remote devices
    ios_command:
      commands: show run | i logging host
    register: output
  - debug:
      var: output["stdout_lines"]

This playbook shows the ssh hosts results according to the configuration required, but I'm not able to save this info to a file.

On the other hand I would like to run this commands on telnet hosts, is it possible to run this in both connection types together and save to file?

Milo
  • 3,365
  • 9
  • 30
  • 44
  • "not being able to save the info to a file" - where did you try that – Smily Feb 24 '20 at 14:01
  • - name: escribir a fichero el inventario lineinfile: path: /root/Escritorio/ansible_net_TEST_distri/cisco_inv_syslog line: "{{ ansible_net_hostname }}, {{ ansible_host }}, , {{ version_ssh.stdout_l$ }}, {{ ansible_logging_ssh }}" create: yes – Call_me_AL Feb 25 '20 at 06:12
  • Please add this to your question. Also please add what is the output or error message for this task. Instead of mentioning as not able to save, if you show the error message, it would be helpful. – Smily Feb 25 '20 at 11:10
  • Also where is version_ssh variable – Smily Feb 25 '20 at 11:43

0 Answers0