Hi

I have playbook with screen output like this 

        "interface Ethernet0/0",
        " ip address 10.0.10.121 255.255.255.0",

I want like this
        interface Ethernet0/0
         ip address 10.0.10.121 255.255.255.0


Basically exactly like output of this file
    - name: copy output to file
      copy:
        content: "{{ output.stdout[0] }}"
        dest: "./output/{{ inventory_hostname }}.txt"

Is that possible?
tq

# cat playbooks/showrun.yml
---
- name: show run
  connection: network_cli
  hosts: cisco1
  gather_facts: no
  tasks:
    - name: run multiple commands
      ios_command:
        commands:
        - show run
        #- show version | i Version
        #- show clock
        #- show interfaces
      register: output

    - name: copy output to file
      copy:
        content: "{{ output.stdout[0] }}"
        dest: "./output/{{ inventory_hostname }}.txt"

    - debug: var=output.stdout_lines[0]

-- 
You received this message because you are subscribed to the Google Groups 
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to ansible-project+unsubscr...@googlegroups.com.
To post to this group, send email to ansible-project@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/c25c3a5c-8446-4969-9d94-019da3af35c6%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to