I am trying to setup a simple ansible script using the ansible.builtin.fetch module.
- The ansible setup and access to my MikroTik device work fine.
- Triggering the creation of a .backup and a .rsc file work fine.
- Fetching the files from the MikroTik device to my linux box does NOT work.
Code: Select all
---
# tasks for mtk-backup
- set_fact: time="{{lookup('pipe','date \"+%Y-%m-%d-%H-%M\"')}}"
- name: "Starting ROS System Backup"
community.routeros.command:
commands: /system backup save name {{inventory_hostname}}
- name: "Starting ROS Configuration Backup"
community.routeros.command:
commands: /export show-sensitive file={{inventory_hostname}}
- name: "Copying ROS System Backup to Local Host"
ansible.builtin.fetch:
src: /{{inventory_hostname}}.backup
dest: ~/backup/mikrotik/{{inventory_hostname}}-{{time}}.backup
- name: "Copying ROS Configuation Backup to Local Host"
ansible.builtin.fetch:
src: /{{inventory_hostname}}.rsc
dest: ~/backup/mikrotik/{{inventory_hostname}}-{{time}}.rsc
Code: Select all
TASK [mtk-backup : Copying ROS System Backup to Local Host] *****************************************************************************************
fatal: [MikroTik-RO]: FAILED! => {"changed": false, "msg": "file not found: /MikroTik-RO.backup"}
Has anyone (successfully) tried to fetch files from a MikroTik device using this ansible module?
Thanks!