fortinet-ansible-dev / ansible-galaxy-fortiswitch-collection

GNU General Public License v3.0
2 stars 0 forks source link

Fortinet logo|

FortiSwitch Ansible Collection


The collection is the FortiSwitch Ansible Automation project. It includes the modules that are able to configure FortiSwitch.

Installation

This collection is distributed via ansible-galaxy, the installation steps are as follows:

  1. Install or upgrade to Ansible 2.11
  2. Download this collection from galaxy: ansible-galaxy collection install fortinet.fortiswitch:1.2.4

Requirements

Supported FortiSwitch Versions

FSW version Galaxy Version Release date Path to Install
7.0.0 1.0.0 2021/12/15 ansible-galaxy collection install fortinet.fortiswitch:1.0.0
7.0.0 1.0.1 2022/2/2 ansible-galaxy collection install fortinet.fortiswitch:1.0.1
7.0.0 1.1.0 latest 2022/4/1 ansible-galaxy collection install fortinet.fortiswitch:1.1.0

Note: Use -f option (i.e. ansible-galaxy collection install -f fortinet.fortiswitch:x.x.x) to renew your existing local installation.

Modules

The collection provides the following modules:

Roles

Usage

The following example is used to configure system interface in Fortinet's FortiSwitch.

Create config_system_interface.yml with the following template:

---
- hosts: fortiswitch01
  collections:
  - fortinet.fortiswitch
  connection: httpapi
  gather_facts: 'no'
  vars:
    ansible_httpapi_use_ssl: 'yes'
    ansible_httpapi_validate_certs: 'no'
    ansible_httpapi_port: 443
  tasks:
  - name: edit internal interface
    fortiswitch_system_interface:
      state: present
      system_interface:
        name: internal
        vdom: root
        allowaccess: https

Create the hosts inventory file

[fortiswitches]
fortiswitch01 ansible_host=192.168.190.100 ansible_user="admin" ansible_password="password"

[fortiswitches:vars]
ansible_network_os=fortinet.fortiswitch.fortiswitch

Run the test:

ansible-playbook -i hosts config_system_interface.yml

The task will set up the allowaccess in system_interface.