---
- name: FORTGATEInterfaceManagement
gather_facts: no
connection: local
hosts: FORTTINET
vars:
action: enableinterface
vdomname: root
interfacename: ['interface port-channel 35.3102']
ip:
mask: 255.255.255.0
speedmode: auto
duplexmode: auto
securityinterfacename: inside
securitylevelnumber: 0
devicetype: fortigate
cli:
host:
username: admin
password: admin@123
timeout: 30
- name: setIPAddress
when: action == "setIPAddress" and devicetype == "fortinet"
fortios_config:
vdom: "{{vdom}}"
commands:
- config system interface
- edit "interfacename"
- set ip "ip" "mask"
provider: "{{ cli }}"
- name: unsetIPAddress
when: action == "unsetIPAddress" and devicetype == "fortinet"
fortios_config:
vdom: "{{vdom}}"
commands:
- config system interface
- "edit {{interfacename}}"
- "unset ip {{ip}} {{mask}}"
provider: "{{ cli }}"
- name: setSpeed
when: action == "setSpeed" and devicetype == "fortinet"
fortios_config:
vdom: "{{vdomname}}"
commands:
- config sys global
- set interface-switch-speed "{{speedmode}}"
provider: "{{ cli }}"
No comments:
Post a Comment