A comprehensive Ansible collection for automating Fortinet FortiOS devices, starting with enterprise-grade FortiGate firewall management.
The EmberStack FortiOS collection (emberstack.fortios) provides production-ready Ansible roles for automating FortiOS-based network infrastructure. The collection currently focuses on comprehensive FortiGate firewall management with plans to expand to other FortiOS devices.
- Ansible 2.9 or higher
- Python 3.6 or higher
- FortiOS 7.4
- Required Ansible collections:
fortinet.fortios>= 2.4.0ansible.netcommon>= 2.0.0
ansible-galaxy collection install git+https://github.com/emberstack/ansible.git#/src/fortios# From the collection directory
cd src/fortios
ansible-galaxy collection install . --forceComprehensive FortiGate firewall configuration management.
Features:
- System configuration (hostname, DNS, NTP, certificates)
- Network configuration (interfaces, zones, VLANs, routing)
- Security policies and objects (addresses, services, policies)
- VPN configuration (IPSec, SSL VPN)
- SD-WAN configuration
- Wireless controller (FortiAP management)
- High availability and clustering
- Complete VDOM support
Supported FortiOS Version:
- 7.4.x
---
- name: Configure FortiGate Firewall
hosts: fortigates
collections:
- emberstack.fortios
roles:
- fortigate---
- name: Configure FortiGate
hosts: fortigates
gather_facts: no
connection: httpapi
collections:
- emberstack.fortios
- fortinet.fortios
vars:
ansible_network_os: fortinet.fortios.fortios
ansible_httpapi_use_ssl: yes
ansible_httpapi_validate_certs: no
ansible_httpapi_port: 443
roles:
- fortigate---
- name: Configure FortiGate with Custom Settings
hosts: fortigates
collections:
- emberstack.fortios
vars:
fortigate_system_settings:
hostname: "firewall-01"
timezone: "America/New_York"
fortigate_firewall_addresses:
- firewall_address:
name: "web_server"
subnet: "192.168.100.10/32"
type: "ipmask"
roles:
- fortigateAll FortiGate role variables follow the pattern fortigate_[category]_[resources]:
fortigate_system_settings- System configurationfortigate_interfaces- Network interfacesfortigate_firewall_addresses- Address objectsfortigate_firewall_policies- Security policiesfortigate_vpn_tunnels- VPN configurationfortigate_sdwan_zones- SD-WAN zones- And many more...
See the fortigate role documentation for complete variable reference.
Example playbooks are provided in the playbooks/examples/ directory:
fortigate_connect_only.yml- Connection test without changes
# Run sanity tests
ansible-test sanity
# Run integration tests
ansible-test integration- Repository: GitHub
- Issues: GitHub Issues
MIT License - see LICENSE file for details.
- EmberStack Team