[junos]

192.168.1.180


[junos:vars]

ansible_connection=ansible.netcommon.network_cli

ansible_network_os=junipernetworks.junos.junos

ansible_user=admin

ansible_password=admin123





---


-




  name: Iniciando Backup


  hosts: junos


  gather_facts: false


  tasks:


    - name: Acessando e coletando dados

      junipernetworks.junos.junos_command:

        commands:

        - show configuration | display set


      register: response


    - name: getting status

      debug: var=response.stdout_lines


    - name: CRIANDO DIRETORIO DE BACKUP.

      file:

        path: "/etc/ansible/BACKUPJUNOS"

        state: directory


    - name: save output to /etc/ansible/backups

      copy:

        dest: "/etc/ansible/BACKUPJUNOS/show_run_{{ inventory_hostname }}.txt"

        content: "{{ response.stdout[0] }}"