Closed R1sCh0 closed 1 year ago
Because you are running a FortiOS version before 6.4.9 you need to downgrade your Ansible FortiOS Galaxy package to 2.1.4.
Then change fortios_monitor to fortios_monitor_fact and change your selector from backup.system.config to system_config_backup
everything else should be fine.
Alternatively, your playbook is correct and will start working if you upgrade your FortiGate to anything later then 6.4.9 or 7.0.2
Hi @slazer2au,
Thank you for your comment.
Thanks, Xing
Hi @R1sCh0,
Thank you for raising this issue. Team are working on this issue. We will fix it on next release.
REST API for back up configuration of FortiOS changed from GET
to POST
since FortiOS v7.0.2. So, fortios_monitor
will not work on FortiOS v6.4.7. But Ansible FortiOS Galaxy collection removed system_config_backup
on fortios_monitor_fact
by mistake since v2.1.5. The solutions for this issue before next release are:
fortios_monitor_fact
;fortios_monitor
.Please let me know if you have any questions.
Thanks, Xing
Hi @R1sCh0,
I got the same issue and when I downgraded collection to 2.1.4 version in a virtual environment via Ansible AWX, it's working pretty-well. Unfortunately, if I have several vdom, scope global
doesn't seem worked, only vdom
.
Do you got the same or everything's working for you ?
Hi txk3n,
I forgot to answer this thread, but for me the easier solution was to downgrade the collection to v2.1.4 and it's working on my root vdom (because it's my only one for the moment). I think the reason it's not working for you is that this playbook is about "vdom backuping". So if you have several vdoms you should execute this task for each vdom.
Hi @R1sCh0,
We tested in our side. FortiOS Ansible collection v2.1.4 has some issue to get the configuration file with scope global
. v2.1.2 works with scope global
. Could you downgrade the FortiOS Ansible collection to v2.1.2 and try it again? We will fix this issue in the next release.
Thanks, Xing
Hi @R1sCh0, @txk3n,
This issue is fixed on the latest release of FortiOS Ansible collection v2.2.0. Please switch to v2.2.0 and try it again.
Please let me know if you have any questions.
Thanks, Xing
@lix-fortinet i did upgrade to the v2.0.0 still i m facing the same issue. Can you help
Hi @foxpatil,
The latest version is v2.2.0. Could you try switch to v2.2.0 and try it again? Please let me know if you have any questions.
Thanks, Xing
Thank you for quick response lix-fortinet,
Issue is resolved using scope as my single vdom (root in my case) . but when i set scope as global it fails. any further modifications needed ? below is my playbook. if i want to take global backup will it be possible ?
hosts: fortigate connection: httpapi collections:
vdom: "root" ansible_httpapi_use_ssl: yes ansible_httpapi_validate_certs: no ansible_httpapi_port: 443 ansible_command_timeout: 60
tasks:
fortios_monitor_fact:
access_token: "***********************"
selector: "system_config_backup"
vdom: root
params:
scope: vdom
register: backup
name: Save the backup information. copy: content: '{{ backup.meta.raw }}' dest: '/home/*/**/upload.txt'
Hi @R1sCh0
We've fixed the issue in version 2.2.0. Let us know if you have any questions.
Thanks, Jie
Hi, I'm trying to perform a system configuration backup of my fortinet fortigate 6.4.7 firewall using your fortinet.fortios module but it doesn't seem to work as I keep getting the message "error in repo" and i don't understand why.
first heres an extract of my inventory file:
heres my executed playbook that is basically a copy/paste of the one provided here: https://ansible-galaxy-fortios-docs.readthedocs.io/en/latest/faq.html#restore-settings-from-local-file I had to edit this playbook to use the "fortios_monitor" instead of "fortios_monitor_fact" and use the selector "backup.system.config" instead of "system_config_backup" because if i use the values provided in your docs, ansible returns an error that says that the selector is not valid.
heres the ansible command that i run:
ansible-playbook -i inventory.yaml backup_forti.yaml
And heres the output with verbose option:
I tried to enable "diagnose debug enable" with "diagnose application httpsd -1" to see if i had more information but i get this:
The important part of this last log is: get_endpoint_v2[259] -- no matching method found. It's just like the api doesn't have a method for config backup.
I'am able to do a config backup from GUI and it works perfectly. I am also able to perform other actions with ansible like the "save.system.config" but the backup.system.config is not working at all.
Can you help ?
Thanks,
R1sCh0