Support Forum
The Forums are a place to find answers on a range of Fortinet products from peers and product experts.
antton
New Contributor

FortiSwitch port admin status change from Ansible.

I am trying to change a switch port administrative status of a FortiSwitch 108E with Ansible. It has FortiOS 6.4.9 installed, and I am working on an Ansible 2.12.1, fortinet.fortios 2.1.3.
 
My problem is that I am not able to do it. I have been able to connect to the switch and change de hostname, but it seems that the port change option in the fortios_system_physical_switch module is not compatible since version 6.2.3. Does anybody know how to do it? I'll attach my playbook and inventory.
 
Thank you very much in advance
 

 

 

 

---
  - name: Shut interface down
    collections:
     -  fortinet.fortios
    hosts: forti.switch
    connection: httpapi
    vars:
     vdom: "root"
     ansible_httpapi_use_ssl: yes
     ansible_httpapi_validate_certs: no
     ansible_httpapi_port: 443
    tasks:
    - name: Disable port
      fortios_system_physical_switch:
        state: "present"
        system_physical_switch:
          name: "port5"
          port:
            -
              name: "port5"
              status: "down"

 

 

 

 

 

 

 

[forti.switch]
fortiswitch01 ansible_host=192.168.1.99 ansible_user="admin" ansible_password="mypass"

[forti.switch:vars]
ansible_network_os=fortinet.fortios.fortios​

 

 

 

 

 

 

 

fatal: [fortiswitch01]: FAILED! => {
    "changed": false,
    "invocation": {
        "module_args": {
            "access_token": null,
            "enable_log": null,
            "member_path": null,
            "member_state": null,
            "state": "present",
            "system_physical_switch": {
                "age_enable": null,
                "age_val": null,
                "name": "port5",
                "port": [
                    {
                        "name": "port5",
                        "status": "down"
                    }
                ]
            },
            "vdom": "root"
        }
    },
    "meta": {
        "build": 488,
        "cmdb-checksum": "10474624100130647167",
        "cmdb-index": "480",
        "error_reason": "unable to create query for 'system.physical-switch'",
        "http_method": "PUT",
        "http_status": 400,
        "name": "port5",
        "path": "system",
        "serial": "S108EN4N17000745",
        "status": "error",
        "timestamp": "1970-01-01T01:40:11Z",
        "vdom": "root",
        "version": "v6.4.9"
    },
    "msg": "Error in repo",
    "version_check_warning": {
        "matched": false,
        "mismatches": [
            "option port not supported since v6.2.3"
        ],
        "system_version": "v6.4.9"
    }
}

 

 

 

1 REPLY 1
Anonymous
Not applicable

Hello @antton , 

 

Thank you for using the Community Forum. I will seek to get you an answer or help. We will reply to this thread with an update as soon as possible. 

 

Thanks,

Announcements

Select Forum Responses to become Knowledge Articles!

Select the “Nominate to Knowledge Base” button to recommend a forum post to become a knowledge article.

Labels
Top Kudoed Authors