Fortinet FortiGate config backup via ansible playbook
- Add ssh public key Public to admin user.
config system admin
edit "admin"
set ssh-public-key1 "<your public key>"
next
end
- Predefined ncftp bookmark
variable name | default | description |
---|---|---|
device_user | admin | FortiOS user account |
device_port | 22 | FortiOS ssh port |
variable name | default | description |
---|---|---|
ssh_option | "StrictHostKeyChecking=no" | bypass ssh host key |
backup_local_path | "{{ role_path }}/files" | temp backup file path |
backup_srv_path | "/Downloads/{{ inventory_hostname }}/" | backup server file path |
backup_filename | "{{ inventory_hostname }}_{{ lookup('pipe', 'date +%Y%m%d') }}.conf" | backup filename |
No
example of inventory
firewall ansible_host=192.168.1.1
[fortios]
firewall
Including an example of how to use your role (for instance, with variables passed in as parameters) is always nice for users too:
- hosts: fortios
gather_facts: no
connection: no
tags: fortios
roles:
- backup-fortios
Sam Chen