Automation

 View Only
last person joined: 6 days ago 

Ask questions and share experiences about Apstra, Paragon, and all things network automation.
  • 1.  Ansible to delete file.

    Posted 02-14-2023 11:27

    I am trying to delete a file from my Juniper device using Ansible, but it is not working.  This is the code I am using:

      tasks:
        - name: Remove file (delete file)
          ansible.builtin.file:
            path: /var/home/remote/.ssh/test.txt
            state: absent

    Thanks.



  • 2.  RE: Ansible to delete file.

    Posted 02-15-2023 11:16

    Hello 

    ansible.builtin.file is specifically for windows/linux operating systems , rather use the file delete junos_command to remove files from a juniper device 

    - name: delete a file on Juniper devices
      junos_command:
        commands: file delete /var/home/remote/.ssh/test.txt



    ------------------------------
    francois Van Heerden
    ------------------------------



  • 3.  RE: Ansible to delete file.

    Posted 02-15-2023 11:20

    Thanks!  Works Great!