david_igou.routeros_configuration.fetch role – Transfer files to/from RouterOS via /tool fetch.
Note
This role is part of the david_igou.routeros_configuration collection (version 0.0.8-alpha).
It is not included in ansible-core.
To check whether it is installed, run ansible-galaxy collection list.
To install it use: ansible-galaxy collection install david_igou.routeros_configuration.
To use it in a playbook, specify: david_igou.routeros_configuration.fetch.
Entry point main – Transfer files to/from RouterOS via /tool fetch.
Synopsis
Downloads/uploads files with
/tool fetchand removes files with/file remove.
Parameters
Parameter |
Comments |
|---|---|
API hostname/IP of the device. Default: |
|
API password. Secret — supply via vault. |
|
TCP port; empty lets the module choose from tls. Default: |
|
Use TLS (api-ssl). Choices:
|
|
API username. Default: |
|
Validate the device TLS certificate. Choices:
|
|
Files to fetch. Default: |
|
Destination file name on the device. |
|
Extra fetch arguments appended verbatim. |
|
Transfer mode (http/https/ftp/tftp/sftp). Choices:
|
|
Hide this fetch from logs (set when the URL/extra carries a secret). Choices:
|
|
Source URL. |
|
File names to delete from the device. Default: |
Examples
# Download a file onto the device over HTTPS.
- hosts: routers
gather_facts: false
roles:
- role: david_igou.routeros_configuration.fetch
vars:
routeros_fetch:
- url: https://example.com/firmware.npk
dst_path: firmware.npk
mode: https
# Download a file, and clean up a stale one with routeros_fetch_remove.
- hosts: routers
gather_facts: false
roles:
- role: david_igou.routeros_configuration.fetch
vars:
routeros_fetch:
- url: https://config.example.com/edge.rsc
dst_path: edge.rsc
mode: https
routeros_fetch_remove:
- old-edge.rsc
# Fetch over SFTP with extra arguments (appended verbatim); set no_log when
# the URL or arguments carry a credential.
- hosts: routers
gather_facts: false
roles:
- role: david_igou.routeros_configuration.fetch
vars:
routeros_fetch:
- url: sftp://files.example.com/backup.rsc
dst_path: backup.rsc
mode: sftp
extra: "user=svc password={{ vault_sftp_password }}"
no_log: true