Closed mpsOxygen closed 1 year ago
I looked into this, because I've definitely been doing this, but it appears the module I had been using was deprecated with 2.0.0: https://ansible-galaxy-fortios-docs.readthedocs.io/en/galaxy-2.0.0/release.html
The notes there say you should be using these modules: To backup the FOS system, use module fortios_monitor_fact and its selector system_config_backup. To restore the configuration, use module fortios_monitor and its selector restore.system.config.
https://ansible-galaxy-fortios-docs.readthedocs.io/en/galaxy-2.0.0/fortios_monitor_fact.html
Hi @mpsOxygen ,
Thank you for your question and thank you @kbmulligan for your detailed answer. Like they said, we can use fortios_monitor_fact module to backup all configuration in a simple way, the following example just backup all configuration into local.backup file, you are free to use it, if you still have any questions, please let me know.
- hosts: fortigate03
connection: httpapi
collections:
- fortinet.fortios
vars:
vdom: "root"
ansible_httpapi_use_ssl: yes
ansible_httpapi_validate_certs: no
ansible_httpapi_port: 443
tasks:
- fortios_monitor_fact:
vdom: "root"
access_token: "fgQjpmm76hzsN5xf4Qx1g9kqjHN3z4"
enable_log: true
selector: "system_config_backup"
params:
enable_log: true
scope: global
register: backupinfo
- name: Save the backup information.
copy:
content: '{{ backupinfo.meta.raw }}'
dest: './local.backup'
Thanks, Maxx
Thank you for the answers and explanations. I managed to back up the system.
I am closing the issue as it's resolved. Let us know if you have any questions.
I know this isn't exactly a bug, but I cannot seem to figure out if there is a simple way to just get the config file from the device using one of the modules. The facts module seems way over complicated but lacking this simple function.