Answers for "save output in txt ansible"

0

save output in txt ansible

---
- hosts: switches
  gather_facts: no
  vars:
    data_dir: foo
  tasks:

  - name: run commands to gather information
    ios_command:
      commands:
      - show version
      - show running
      - show snmp user
    register: switch_config

  - name: save collected infromation in data directory
    copy:
      dest: "output.txt"
      content: |
        show version
        -----
        {{ switch_config.stdout[0] }}

        show running-config
        -----
        {{ switch_config.stdout[1] }}

        show snmp user
        -----
        {{ switch_config.stdout[2] }}
Posted by: Guest on October-09-2020

Browse Popular Code Answers by Language