From f9b0ab774f71b09c3f1c734f4bd19d57966dd431 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miguel=20Angel=20Mu=C3=B1oz=20Gonz=C3=A1lez?= Date: Wed, 28 Aug 2019 22:03:07 +0200 Subject: [PATCH] Minor bug fixes - 3 (#61461) --- ..._switch_controller_switch_interface_tag.py | 6 +++-- .../fortios_switch_controller_switch_log.py | 5 ++-- ...ortios_switch_controller_switch_profile.py | 11 ++++---- .../fortios_switch_controller_system.py | 7 ++--- ...ios_switch_controller_virtual_port_pool.py | 10 ++++--- .../fortios/fortios_switch_controller_vlan.py | 10 ++++--- .../fortios/fortios_system_accprofile.py | 26 ++++++++++++++++--- .../network/fortios/fortios_system_admin.py | 26 ++++++++++++++++--- .../fortios_system_affinity_interrupt.py | 6 +++-- ...s_system_affinity_packet_redistribution.py | 6 +++-- .../network/fortios/fortios_system_alarm.py | 5 ++-- .../network/fortios/fortios_system_alias.py | 6 +++-- .../fortios/fortios_system_api_user.py | 26 ++++++++++++++++--- .../fortios/fortios_system_arp_table.py | 6 +++-- .../fortios/fortios_system_auto_install.py | 5 ++-- .../fortios/fortios_system_auto_script.py | 8 +++--- .../fortios_system_automation_action.py | 6 +++-- .../fortios_system_automation_destination.py | 8 +++--- .../fortios_system_automation_stitch.py | 6 +++-- .../fortios_system_automation_trigger.py | 10 ++++--- .../fortios_system_autoupdate_push_update.py | 5 ++-- .../fortios_system_autoupdate_schedule.py | 5 ++-- .../fortios_system_autoupdate_tunneling.py | 5 ++-- .../fortios/fortios_system_cluster_sync.py | 6 +++-- .../network/fortios/fortios_system_console.py | 5 ++-- .../network/fortios/fortios_system_csf.py | 7 ++--- .../fortios/fortios_system_custom_language.py | 6 +++-- .../network/fortios/fortios_system_ddns.py | 8 +++--- .../fortios/fortios_system_dedicated_mgmt.py | 5 ++-- .../fortios/fortios_system_dhcp6_server.py | 6 +++-- .../fortios/fortios_system_dhcp_server.py | 26 ++++++++++++++++--- .../fortios/fortios_system_dns_database.py | 6 +++-- .../fortios/fortios_system_dns_server.py | 6 +++-- .../fortios_system_dscp_based_priority.py | 6 +++-- .../fortios/fortios_system_email_server.py | 7 ++--- .../fortios_system_external_resource.py | 8 +++--- .../network/fortios/fortios_system_fips_cc.py | 5 ++-- .../network/fortios/fortios_system_fm.py | 5 ++-- .../fortios/fortios_system_fortiguard.py | 15 ++++++----- .../fortios/fortios_system_fortimanager.py | 5 ++-- .../fortios/fortios_system_fortisandbox.py | 7 ++--- .../fortios/fortios_system_fsso_polling.py | 5 ++-- .../fortios/fortios_system_ftm_push.py | 7 ++--- .../fortios/fortios_system_geoip_override.py | 6 +++-- .../fortios/fortios_system_gre_tunnel.py | 6 +++-- .../network/fortios/fortios_system_ha.py | 7 ++--- .../fortios/fortios_system_ha_monitor.py | 5 ++-- .../fortios/fortios_system_interface.py | 26 ++++++++++++++++--- .../fortios/fortios_system_ipip_tunnel.py | 6 +++-- 49 files changed, 294 insertions(+), 127 deletions(-) diff --git a/lib/ansible/modules/network/fortios/fortios_switch_controller_switch_interface_tag.py b/lib/ansible/modules/network/fortios/fortios_switch_controller_switch_interface_tag.py index c3c84b8ef13..4adba061e59 100644 --- a/lib/ansible/modules/network/fortios/fortios_switch_controller_switch_interface_tag.py +++ b/lib/ansible/modules/network/fortios/fortios_switch_controller_switch_interface_tag.py @@ -26,7 +26,7 @@ DOCUMENTATION = ''' module: fortios_switch_controller_switch_interface_tag short_description: Configure switch object tags in Fortinet's FortiOS and FortiGate. description: - - This module is able to configure a FortiGate or FortiOS device by allowing the + - This module is able to configure a FortiGate or FortiOS (FOS) device by allowing the user to set and modify switch_controller feature and switch_interface_tag category. Examples include all parameters and values need to be adjusted to datasources before usage. Tested with FOS v6.0.5 @@ -76,6 +76,7 @@ options: description: - Indicates whether to create or remove the object. type: str + required: true choices: - present - absent @@ -255,7 +256,7 @@ def main(): fields = { "host": {"required": False, "type": "str"}, "username": {"required": False, "type": "str"}, - "password": {"required": False, "type": "str", "no_log": True}, + "password": {"required": False, "type": "str", "default": "", "no_log": True}, "vdom": {"required": False, "type": "str", "default": "root"}, "https": {"required": False, "type": "bool", "default": True}, "ssl_verify": {"required": False, "type": "bool", "default": True}, @@ -273,6 +274,7 @@ def main(): module = AnsibleModule(argument_spec=fields, supports_check_mode=False) + # legacy_mode refers to using fortiosapi instead of HTTPAPI legacy_mode = 'host' in module.params and module.params['host'] is not None and \ 'username' in module.params and module.params['username'] is not None and \ 'password' in module.params and module.params['password'] is not None diff --git a/lib/ansible/modules/network/fortios/fortios_switch_controller_switch_log.py b/lib/ansible/modules/network/fortios/fortios_switch_controller_switch_log.py index 2c0e30070c6..a3da3b2cf24 100644 --- a/lib/ansible/modules/network/fortios/fortios_switch_controller_switch_log.py +++ b/lib/ansible/modules/network/fortios/fortios_switch_controller_switch_log.py @@ -26,7 +26,7 @@ DOCUMENTATION = ''' module: fortios_switch_controller_switch_log short_description: Configure FortiSwitch logging (logs are transferred to and inserted into FortiGate event log) in Fortinet's FortiOS and FortiGate. description: - - This module is able to configure a FortiGate or FortiOS device by allowing the + - This module is able to configure a FortiGate or FortiOS (FOS) device by allowing the user to set and modify switch_controller feature and switch_log category. Examples include all parameters and values need to be adjusted to datasources before usage. Tested with FOS v6.0.5 @@ -255,7 +255,7 @@ def main(): fields = { "host": {"required": False, "type": "str"}, "username": {"required": False, "type": "str"}, - "password": {"required": False, "type": "str", "no_log": True}, + "password": {"required": False, "type": "str", "default": "", "no_log": True}, "vdom": {"required": False, "type": "str", "default": "root"}, "https": {"required": False, "type": "bool", "default": True}, "ssl_verify": {"required": False, "type": "bool", "default": True}, @@ -276,6 +276,7 @@ def main(): module = AnsibleModule(argument_spec=fields, supports_check_mode=False) + # legacy_mode refers to using fortiosapi instead of HTTPAPI legacy_mode = 'host' in module.params and module.params['host'] is not None and \ 'username' in module.params and module.params['username'] is not None and \ 'password' in module.params and module.params['password'] is not None diff --git a/lib/ansible/modules/network/fortios/fortios_switch_controller_switch_profile.py b/lib/ansible/modules/network/fortios/fortios_switch_controller_switch_profile.py index 297babdd030..01afb470966 100644 --- a/lib/ansible/modules/network/fortios/fortios_switch_controller_switch_profile.py +++ b/lib/ansible/modules/network/fortios/fortios_switch_controller_switch_profile.py @@ -26,7 +26,7 @@ DOCUMENTATION = ''' module: fortios_switch_controller_switch_profile short_description: Configure FortiSwitch switch profile in Fortinet's FortiOS and FortiGate. description: - - This module is able to configure a FortiGate or FortiOS device by allowing the + - This module is able to configure a FortiGate or FortiOS (FOS) device by allowing the user to set and modify switch_controller feature and switch_profile category. Examples include all parameters and values need to be adjusted to datasources before usage. Tested with FOS v6.0.5 @@ -44,12 +44,12 @@ options: description: - FortiOS or FortiGate IP address. type: str - required: true + required: false username: description: - FortiOS or FortiGate username. type: str - required: true + required: false password: description: - FortiOS or FortiGate password. @@ -76,6 +76,7 @@ options: description: - Indicates whether to create or remove the object. type: str + required: true choices: - present - absent @@ -102,7 +103,6 @@ options: - FortiSwitch Profile name. required: true type: str - ''' EXAMPLES = ''' @@ -270,7 +270,7 @@ def main(): fields = { "host": {"required": False, "type": "str"}, "username": {"required": False, "type": "str"}, - "password": {"required": False, "type": "str", "no_log": True}, + "password": {"required": False, "type": "str", "default": "", "no_log": True}, "vdom": {"required": False, "type": "str", "default": "root"}, "https": {"required": False, "type": "bool", "default": True}, "ssl_verify": {"required": False, "type": "bool", "default": True}, @@ -291,6 +291,7 @@ def main(): module = AnsibleModule(argument_spec=fields, supports_check_mode=False) + # legacy_mode refers to using fortiosapi instead of HTTPAPI legacy_mode = 'host' in module.params and module.params['host'] is not None and \ 'username' in module.params and module.params['username'] is not None and \ 'password' in module.params and module.params['password'] is not None diff --git a/lib/ansible/modules/network/fortios/fortios_switch_controller_system.py b/lib/ansible/modules/network/fortios/fortios_switch_controller_system.py index df76cac89e4..a0edde4029d 100644 --- a/lib/ansible/modules/network/fortios/fortios_switch_controller_system.py +++ b/lib/ansible/modules/network/fortios/fortios_switch_controller_system.py @@ -26,7 +26,7 @@ DOCUMENTATION = ''' module: fortios_switch_controller_system short_description: Configure system-wide switch controller settings in Fortinet's FortiOS and FortiGate. description: - - This module is able to configure a FortiGate or FortiOS device by allowing the + - This module is able to configure a FortiGate or FortiOS (FOS) device by allowing the user to set and modify switch_controller feature and system category. Examples include all parameters and values need to be adjusted to datasources before usage. Tested with FOS v6.0.5 @@ -80,7 +80,7 @@ options: suboptions: parallel_process: description: - - Maximum number of parallel processes (1 - 300, default = 1). + - Maximum number of parallel processes (1 - 300). type: int parallel_process_override: description: @@ -246,7 +246,7 @@ def main(): fields = { "host": {"required": False, "type": "str"}, "username": {"required": False, "type": "str"}, - "password": {"required": False, "type": "str", "no_log": True}, + "password": {"required": False, "type": "str", "default": "", "no_log": True}, "vdom": {"required": False, "type": "str", "default": "root"}, "https": {"required": False, "type": "bool", "default": True}, "ssl_verify": {"required": False, "type": "bool", "default": True}, @@ -264,6 +264,7 @@ def main(): module = AnsibleModule(argument_spec=fields, supports_check_mode=False) + # legacy_mode refers to using fortiosapi instead of HTTPAPI legacy_mode = 'host' in module.params and module.params['host'] is not None and \ 'username' in module.params and module.params['username'] is not None and \ 'password' in module.params and module.params['password'] is not None diff --git a/lib/ansible/modules/network/fortios/fortios_switch_controller_virtual_port_pool.py b/lib/ansible/modules/network/fortios/fortios_switch_controller_virtual_port_pool.py index a9adbf58fbd..3989327633a 100644 --- a/lib/ansible/modules/network/fortios/fortios_switch_controller_virtual_port_pool.py +++ b/lib/ansible/modules/network/fortios/fortios_switch_controller_virtual_port_pool.py @@ -26,7 +26,7 @@ DOCUMENTATION = ''' module: fortios_switch_controller_virtual_port_pool short_description: Configure virtual pool in Fortinet's FortiOS and FortiGate. description: - - This module is able to configure a FortiGate or FortiOS device by allowing the + - This module is able to configure a FortiGate or FortiOS (FOS) device by allowing the user to set and modify switch_controller feature and virtual_port_pool category. Examples include all parameters and values need to be adjusted to datasources before usage. Tested with FOS v6.0.5 @@ -44,12 +44,12 @@ options: description: - FortiOS or FortiGate IP address. type: str - required: true + required: false username: description: - FortiOS or FortiGate username. type: str - required: true + required: false password: description: - FortiOS or FortiGate password. @@ -76,6 +76,7 @@ options: description: - Indicates whether to create or remove the object. type: str + required: true choices: - present - absent @@ -260,7 +261,7 @@ def main(): fields = { "host": {"required": False, "type": "str"}, "username": {"required": False, "type": "str"}, - "password": {"required": False, "type": "str", "no_log": True}, + "password": {"required": False, "type": "str", "default": "", "no_log": True}, "vdom": {"required": False, "type": "str", "default": "root"}, "https": {"required": False, "type": "bool", "default": True}, "ssl_verify": {"required": False, "type": "bool", "default": True}, @@ -279,6 +280,7 @@ def main(): module = AnsibleModule(argument_spec=fields, supports_check_mode=False) + # legacy_mode refers to using fortiosapi instead of HTTPAPI legacy_mode = 'host' in module.params and module.params['host'] is not None and \ 'username' in module.params and module.params['username'] is not None and \ 'password' in module.params and module.params['password'] is not None diff --git a/lib/ansible/modules/network/fortios/fortios_switch_controller_vlan.py b/lib/ansible/modules/network/fortios/fortios_switch_controller_vlan.py index f7b7295236d..059fb5e3141 100644 --- a/lib/ansible/modules/network/fortios/fortios_switch_controller_vlan.py +++ b/lib/ansible/modules/network/fortios/fortios_switch_controller_vlan.py @@ -26,7 +26,7 @@ DOCUMENTATION = ''' module: fortios_switch_controller_vlan short_description: Configure VLANs for switch controller in Fortinet's FortiOS and FortiGate. description: - - This module is able to configure a FortiGate or FortiOS device by allowing the + - This module is able to configure a FortiGate or FortiOS (FOS) device by allowing the user to set and modify switch_controller feature and vlan category. Examples include all parameters and values need to be adjusted to datasources before usage. Tested with FOS v6.0.5 @@ -44,12 +44,12 @@ options: description: - FortiOS or FortiGate IP address. type: str - required: true + required: false username: description: - FortiOS or FortiGate username. type: str - required: true + required: false password: description: - FortiOS or FortiGate password. @@ -76,6 +76,7 @@ options: description: - Indicates whether to create or remove the object. type: str + required: true choices: - present - absent @@ -349,7 +350,7 @@ def main(): fields = { "host": {"required": False, "type": "str"}, "username": {"required": False, "type": "str"}, - "password": {"required": False, "type": "str", "no_log": True}, + "password": {"required": False, "type": "str", "default": "", "no_log": True}, "vdom": {"required": False, "type": "str", "default": "root"}, "https": {"required": False, "type": "bool", "default": True}, "ssl_verify": {"required": False, "type": "bool", "default": True}, @@ -389,6 +390,7 @@ def main(): module = AnsibleModule(argument_spec=fields, supports_check_mode=False) + # legacy_mode refers to using fortiosapi instead of HTTPAPI legacy_mode = 'host' in module.params and module.params['host'] is not None and \ 'username' in module.params and module.params['username'] is not None and \ 'password' in module.params and module.params['password'] is not None diff --git a/lib/ansible/modules/network/fortios/fortios_system_accprofile.py b/lib/ansible/modules/network/fortios/fortios_system_accprofile.py index 66ce62777ac..c16a83c1982 100644 --- a/lib/ansible/modules/network/fortios/fortios_system_accprofile.py +++ b/lib/ansible/modules/network/fortios/fortios_system_accprofile.py @@ -76,8 +76,10 @@ options: state: description: - Indicates whether to create or remove the object. + This attribute was present already in previous version in a deeper level. + It has been moved out to this outer level. type: str - required: true + required: false choices: - present - absent @@ -88,6 +90,17 @@ options: default: null type: dict suboptions: + state: + description: + - B(Deprecated) + - Starting with Ansible 2.9 we recommend using the top-level 'state' parameter. + - HORIZONTALLINE + - Indicates whether to create or remove the object. + type: str + required: false + choices: + - present + - absent admintimeout: description: - Administrator timeout for this access profile (0 - 480 min). @@ -622,7 +635,12 @@ def underscore_to_hyphen(data): def system_accprofile(data, fos): vdom = data['vdom'] - state = data['state'] + if 'state' in data and data['state']: + state = data['state'] + elif 'state' in data['system_accprofile'] and data['system_accprofile']: + state = data['system_accprofile']['state'] + else: + state = True system_accprofile_data = data['system_accprofile'] filtered_data = underscore_to_hyphen(filter_system_accprofile_data(system_accprofile_data)) @@ -662,11 +680,13 @@ def main(): "vdom": {"required": False, "type": "str", "default": "root"}, "https": {"required": False, "type": "bool", "default": True}, "ssl_verify": {"required": False, "type": "bool", "default": True}, - "state": {"required": True, "type": "str", + "state": {"required": False, "type": "str", "choices": ["present", "absent"]}, "system_accprofile": { "required": False, "type": "dict", "default": None, "options": { + "state": {"required": False, "type": "str", + "choices": ["present", "absent"]}, "admintimeout": {"required": False, "type": "int"}, "admintimeout_override": {"required": False, "type": "str", "choices": ["enable", "disable"]}, diff --git a/lib/ansible/modules/network/fortios/fortios_system_admin.py b/lib/ansible/modules/network/fortios/fortios_system_admin.py index 79ebb9109f6..c2055c757cc 100644 --- a/lib/ansible/modules/network/fortios/fortios_system_admin.py +++ b/lib/ansible/modules/network/fortios/fortios_system_admin.py @@ -76,8 +76,10 @@ options: state: description: - Indicates whether to create or remove the object. + This attribute was present already in previous version in a deeper level. + It has been moved out to this outer level. type: str - required: true + required: false choices: - present - absent @@ -88,6 +90,17 @@ options: default: null type: dict suboptions: + state: + description: + - B(Deprecated) + - Starting with Ansible 2.9 we recommend using the top-level 'state' parameter. + - HORIZONTALLINE + - Indicates whether to create or remove the object. + type: str + required: false + choices: + - present + - absent accprofile: description: - Access profile for this administrator. Access profiles control administrator access to FortiGate features. Source system.accprofile.name. @@ -780,7 +793,12 @@ def underscore_to_hyphen(data): def system_admin(data, fos): vdom = data['vdom'] - state = data['state'] + if 'state' in data and data['state']: + state = data['state'] + elif 'state' in data['system_admin'] and data['system_admin']: + state = data['system_admin']['state'] + else: + state = True system_admin_data = data['system_admin'] filtered_data = underscore_to_hyphen(filter_system_admin_data(system_admin_data)) @@ -820,11 +838,13 @@ def main(): "vdom": {"required": False, "type": "str", "default": "root"}, "https": {"required": False, "type": "bool", "default": True}, "ssl_verify": {"required": False, "type": "bool", "default": True}, - "state": {"required": True, "type": "str", + "state": {"required": False, "type": "str", "choices": ["present", "absent"]}, "system_admin": { "required": False, "type": "dict", "default": None, "options": { + "state": {"required": False, "type": "str", + "choices": ["present", "absent"]}, "accprofile": {"required": False, "type": "str"}, "accprofile_override": {"required": False, "type": "str", "choices": ["enable", "disable"]}, diff --git a/lib/ansible/modules/network/fortios/fortios_system_affinity_interrupt.py b/lib/ansible/modules/network/fortios/fortios_system_affinity_interrupt.py index 9a69c9ebc2b..dea62bac634 100644 --- a/lib/ansible/modules/network/fortios/fortios_system_affinity_interrupt.py +++ b/lib/ansible/modules/network/fortios/fortios_system_affinity_interrupt.py @@ -26,7 +26,7 @@ DOCUMENTATION = ''' module: fortios_system_affinity_interrupt short_description: Configure interrupt affinity in Fortinet's FortiOS and FortiGate. description: - - This module is able to configure a FortiGate or FortiOS device by allowing the + - This module is able to configure a FortiGate or FortiOS (FOS) device by allowing the user to set and modify system feature and affinity_interrupt category. Examples include all parameters and values need to be adjusted to datasources before usage. Tested with FOS v6.0.5 @@ -76,6 +76,7 @@ options: description: - Indicates whether to create or remove the object. type: str + required: true choices: - present - absent @@ -265,7 +266,7 @@ def main(): fields = { "host": {"required": False, "type": "str"}, "username": {"required": False, "type": "str"}, - "password": {"required": False, "type": "str", "no_log": True}, + "password": {"required": False, "type": "str", "default": "", "no_log": True}, "vdom": {"required": False, "type": "str", "default": "root"}, "https": {"required": False, "type": "bool", "default": True}, "ssl_verify": {"required": False, "type": "bool", "default": True}, @@ -285,6 +286,7 @@ def main(): module = AnsibleModule(argument_spec=fields, supports_check_mode=False) + # legacy_mode refers to using fortiosapi instead of HTTPAPI legacy_mode = 'host' in module.params and module.params['host'] is not None and \ 'username' in module.params and module.params['username'] is not None and \ 'password' in module.params and module.params['password'] is not None diff --git a/lib/ansible/modules/network/fortios/fortios_system_affinity_packet_redistribution.py b/lib/ansible/modules/network/fortios/fortios_system_affinity_packet_redistribution.py index 4aa1033714c..7383da0c26a 100644 --- a/lib/ansible/modules/network/fortios/fortios_system_affinity_packet_redistribution.py +++ b/lib/ansible/modules/network/fortios/fortios_system_affinity_packet_redistribution.py @@ -26,7 +26,7 @@ DOCUMENTATION = ''' module: fortios_system_affinity_packet_redistribution short_description: Configure packet redistribution in Fortinet's FortiOS and FortiGate. description: - - This module is able to configure a FortiGate or FortiOS device by allowing the + - This module is able to configure a FortiGate or FortiOS (FOS) device by allowing the user to set and modify system feature and affinity_packet_redistribution category. Examples include all parameters and values need to be adjusted to datasources before usage. Tested with FOS v6.0.5 @@ -76,6 +76,7 @@ options: description: - Indicates whether to create or remove the object. type: str + required: true choices: - present - absent @@ -271,7 +272,7 @@ def main(): fields = { "host": {"required": False, "type": "str"}, "username": {"required": False, "type": "str"}, - "password": {"required": False, "type": "str", "no_log": True}, + "password": {"required": False, "type": "str", "default": "", "no_log": True}, "vdom": {"required": False, "type": "str", "default": "root"}, "https": {"required": False, "type": "bool", "default": True}, "ssl_verify": {"required": False, "type": "bool", "default": True}, @@ -292,6 +293,7 @@ def main(): module = AnsibleModule(argument_spec=fields, supports_check_mode=False) + # legacy_mode refers to using fortiosapi instead of HTTPAPI legacy_mode = 'host' in module.params and module.params['host'] is not None and \ 'username' in module.params and module.params['username'] is not None and \ 'password' in module.params and module.params['password'] is not None diff --git a/lib/ansible/modules/network/fortios/fortios_system_alarm.py b/lib/ansible/modules/network/fortios/fortios_system_alarm.py index 3e2b29bab77..8dd5ebb8009 100644 --- a/lib/ansible/modules/network/fortios/fortios_system_alarm.py +++ b/lib/ansible/modules/network/fortios/fortios_system_alarm.py @@ -26,7 +26,7 @@ DOCUMENTATION = ''' module: fortios_system_alarm short_description: Configure alarm in Fortinet's FortiOS and FortiGate. description: - - This module is able to configure a FortiGate or FortiOS device by allowing the + - This module is able to configure a FortiGate or FortiOS (FOS) device by allowing the user to set and modify system feature and alarm category. Examples include all parameters and values need to be adjusted to datasources before usage. Tested with FOS v6.0.5 @@ -360,7 +360,7 @@ def main(): fields = { "host": {"required": False, "type": "str"}, "username": {"required": False, "type": "str"}, - "password": {"required": False, "type": "str", "no_log": True}, + "password": {"required": False, "type": "str", "default": "", "no_log": True}, "vdom": {"required": False, "type": "str", "default": "root"}, "https": {"required": False, "type": "bool", "default": True}, "ssl_verify": {"required": False, "type": "bool", "default": True}, @@ -404,6 +404,7 @@ def main(): module = AnsibleModule(argument_spec=fields, supports_check_mode=False) + # legacy_mode refers to using fortiosapi instead of HTTPAPI legacy_mode = 'host' in module.params and module.params['host'] is not None and \ 'username' in module.params and module.params['username'] is not None and \ 'password' in module.params and module.params['password'] is not None diff --git a/lib/ansible/modules/network/fortios/fortios_system_alias.py b/lib/ansible/modules/network/fortios/fortios_system_alias.py index f35ae73b6fb..e60b420807c 100644 --- a/lib/ansible/modules/network/fortios/fortios_system_alias.py +++ b/lib/ansible/modules/network/fortios/fortios_system_alias.py @@ -26,7 +26,7 @@ DOCUMENTATION = ''' module: fortios_system_alias short_description: Configure alias command in Fortinet's FortiOS and FortiGate. description: - - This module is able to configure a FortiGate or FortiOS device by allowing the + - This module is able to configure a FortiGate or FortiOS (FOS) device by allowing the user to set and modify system feature and alias category. Examples include all parameters and values need to be adjusted to datasources before usage. Tested with FOS v6.0.5 @@ -76,6 +76,7 @@ options: description: - Indicates whether to create or remove the object. type: str + required: true choices: - present - absent @@ -260,7 +261,7 @@ def main(): fields = { "host": {"required": False, "type": "str"}, "username": {"required": False, "type": "str"}, - "password": {"required": False, "type": "str", "no_log": True}, + "password": {"required": False, "type": "str", "default": "", "no_log": True}, "vdom": {"required": False, "type": "str", "default": "root"}, "https": {"required": False, "type": "bool", "default": True}, "ssl_verify": {"required": False, "type": "bool", "default": True}, @@ -279,6 +280,7 @@ def main(): module = AnsibleModule(argument_spec=fields, supports_check_mode=False) + # legacy_mode refers to using fortiosapi instead of HTTPAPI legacy_mode = 'host' in module.params and module.params['host'] is not None and \ 'username' in module.params and module.params['username'] is not None and \ 'password' in module.params and module.params['password'] is not None diff --git a/lib/ansible/modules/network/fortios/fortios_system_api_user.py b/lib/ansible/modules/network/fortios/fortios_system_api_user.py index d810ea76a1b..ab0fde13c3c 100644 --- a/lib/ansible/modules/network/fortios/fortios_system_api_user.py +++ b/lib/ansible/modules/network/fortios/fortios_system_api_user.py @@ -76,8 +76,10 @@ options: state: description: - Indicates whether to create or remove the object. + This attribute was present already in previous version in a deeper level. + It has been moved out to this outer level. type: str - required: true + required: false choices: - present - absent @@ -88,6 +90,17 @@ options: default: null type: dict suboptions: + state: + description: + - B(Deprecated) + - Starting with Ansible 2.9 we recommend using the top-level 'state' parameter. + - HORIZONTALLINE + - Indicates whether to create or remove the object. + type: str + required: false + choices: + - present + - absent accprofile: description: - Admin user access profile. Source system.accprofile.name. @@ -307,7 +320,12 @@ def underscore_to_hyphen(data): def system_api_user(data, fos): vdom = data['vdom'] - state = data['state'] + if 'state' in data and data['state']: + state = data['state'] + elif 'state' in data['system_api_user'] and data['system_api_user']: + state = data['system_api_user']['state'] + else: + state = True system_api_user_data = data['system_api_user'] filtered_data = underscore_to_hyphen(filter_system_api_user_data(system_api_user_data)) @@ -347,11 +365,13 @@ def main(): "vdom": {"required": False, "type": "str", "default": "root"}, "https": {"required": False, "type": "bool", "default": True}, "ssl_verify": {"required": False, "type": "bool", "default": True}, - "state": {"required": True, "type": "str", + "state": {"required": False, "type": "str", "choices": ["present", "absent"]}, "system_api_user": { "required": False, "type": "dict", "default": None, "options": { + "state": {"required": False, "type": "str", + "choices": ["present", "absent"]}, "accprofile": {"required": False, "type": "str"}, "api_key": {"required": False, "type": "str"}, "comments": {"required": False, "type": "str"}, diff --git a/lib/ansible/modules/network/fortios/fortios_system_arp_table.py b/lib/ansible/modules/network/fortios/fortios_system_arp_table.py index 3776644b0c0..e026dee738f 100644 --- a/lib/ansible/modules/network/fortios/fortios_system_arp_table.py +++ b/lib/ansible/modules/network/fortios/fortios_system_arp_table.py @@ -26,7 +26,7 @@ DOCUMENTATION = ''' module: fortios_system_arp_table short_description: Configure ARP table in Fortinet's FortiOS and FortiGate. description: - - This module is able to configure a FortiGate or FortiOS device by allowing the + - This module is able to configure a FortiGate or FortiOS (FOS) device by allowing the user to set and modify system feature and arp_table category. Examples include all parameters and values need to be adjusted to datasources before usage. Tested with FOS v6.0.5 @@ -76,6 +76,7 @@ options: description: - Indicates whether to create or remove the object. type: str + required: true choices: - present - absent @@ -271,7 +272,7 @@ def main(): fields = { "host": {"required": False, "type": "str"}, "username": {"required": False, "type": "str"}, - "password": {"required": False, "type": "str", "no_log": True}, + "password": {"required": False, "type": "str", "default": "", "no_log": True}, "vdom": {"required": False, "type": "str", "default": "root"}, "https": {"required": False, "type": "bool", "default": True}, "ssl_verify": {"required": False, "type": "bool", "default": True}, @@ -292,6 +293,7 @@ def main(): module = AnsibleModule(argument_spec=fields, supports_check_mode=False) + # legacy_mode refers to using fortiosapi instead of HTTPAPI legacy_mode = 'host' in module.params and module.params['host'] is not None and \ 'username' in module.params and module.params['username'] is not None and \ 'password' in module.params and module.params['password'] is not None diff --git a/lib/ansible/modules/network/fortios/fortios_system_auto_install.py b/lib/ansible/modules/network/fortios/fortios_system_auto_install.py index 9ef45b05c8c..e13bb7aa62e 100644 --- a/lib/ansible/modules/network/fortios/fortios_system_auto_install.py +++ b/lib/ansible/modules/network/fortios/fortios_system_auto_install.py @@ -26,7 +26,7 @@ DOCUMENTATION = ''' module: fortios_system_auto_install short_description: Configure USB auto installation in Fortinet's FortiOS and FortiGate. description: - - This module is able to configure a FortiGate or FortiOS device by allowing the + - This module is able to configure a FortiGate or FortiOS (FOS) device by allowing the user to set and modify system feature and auto_install category. Examples include all parameters and values need to be adjusted to datasources before usage. Tested with FOS v6.0.5 @@ -260,7 +260,7 @@ def main(): fields = { "host": {"required": False, "type": "str"}, "username": {"required": False, "type": "str"}, - "password": {"required": False, "type": "str", "no_log": True}, + "password": {"required": False, "type": "str", "default": "", "no_log": True}, "vdom": {"required": False, "type": "str", "default": "root"}, "https": {"required": False, "type": "bool", "default": True}, "ssl_verify": {"required": False, "type": "bool", "default": True}, @@ -281,6 +281,7 @@ def main(): module = AnsibleModule(argument_spec=fields, supports_check_mode=False) + # legacy_mode refers to using fortiosapi instead of HTTPAPI legacy_mode = 'host' in module.params and module.params['host'] is not None and \ 'username' in module.params and module.params['username'] is not None and \ 'password' in module.params and module.params['password'] is not None diff --git a/lib/ansible/modules/network/fortios/fortios_system_auto_script.py b/lib/ansible/modules/network/fortios/fortios_system_auto_script.py index 66080e38a49..1e3880efdb4 100644 --- a/lib/ansible/modules/network/fortios/fortios_system_auto_script.py +++ b/lib/ansible/modules/network/fortios/fortios_system_auto_script.py @@ -26,7 +26,7 @@ DOCUMENTATION = ''' module: fortios_system_auto_script short_description: Configure auto script in Fortinet's FortiOS and FortiGate. description: - - This module is able to configure a FortiGate or FortiOS device by allowing the + - This module is able to configure a FortiGate or FortiOS (FOS) device by allowing the user to set and modify system feature and auto_script category. Examples include all parameters and values need to be adjusted to datasources before usage. Tested with FOS v6.0.5 @@ -76,6 +76,7 @@ options: description: - Indicates whether to create or remove the object. type: str + required: true choices: - present - absent @@ -96,7 +97,7 @@ options: type: str output_size: description: - - Number of megabytes to limit script output to (10 - 1024, default = 10). + - Number of megabytes to limit script output to (10 - 1024). type: int repeat: description: @@ -284,7 +285,7 @@ def main(): fields = { "host": {"required": False, "type": "str"}, "username": {"required": False, "type": "str"}, - "password": {"required": False, "type": "str", "no_log": True}, + "password": {"required": False, "type": "str", "default": "", "no_log": True}, "vdom": {"required": False, "type": "str", "default": "root"}, "https": {"required": False, "type": "bool", "default": True}, "ssl_verify": {"required": False, "type": "bool", "default": True}, @@ -308,6 +309,7 @@ def main(): module = AnsibleModule(argument_spec=fields, supports_check_mode=False) + # legacy_mode refers to using fortiosapi instead of HTTPAPI legacy_mode = 'host' in module.params and module.params['host'] is not None and \ 'username' in module.params and module.params['username'] is not None and \ 'password' in module.params and module.params['password'] is not None diff --git a/lib/ansible/modules/network/fortios/fortios_system_automation_action.py b/lib/ansible/modules/network/fortios/fortios_system_automation_action.py index c9ff6f3ca9d..cc909ceceec 100644 --- a/lib/ansible/modules/network/fortios/fortios_system_automation_action.py +++ b/lib/ansible/modules/network/fortios/fortios_system_automation_action.py @@ -26,7 +26,7 @@ DOCUMENTATION = ''' module: fortios_system_automation_action short_description: Action for automation stitches in Fortinet's FortiOS and FortiGate. description: - - This module is able to configure a FortiGate or FortiOS device by allowing the + - This module is able to configure a FortiGate or FortiOS (FOS) device by allowing the user to set and modify system feature and automation_action category. Examples include all parameters and values need to be adjusted to datasources before usage. Tested with FOS v6.0.5 @@ -76,6 +76,7 @@ options: description: - Indicates whether to create or remove the object. type: str + required: true choices: - present - absent @@ -387,7 +388,7 @@ def main(): fields = { "host": {"required": False, "type": "str"}, "username": {"required": False, "type": "str"}, - "password": {"required": False, "type": "str", "no_log": True}, + "password": {"required": False, "type": "str", "default": "", "no_log": True}, "vdom": {"required": False, "type": "str", "default": "root"}, "https": {"required": False, "type": "bool", "default": True}, "ssl_verify": {"required": False, "type": "bool", "default": True}, @@ -435,6 +436,7 @@ def main(): module = AnsibleModule(argument_spec=fields, supports_check_mode=False) + # legacy_mode refers to using fortiosapi instead of HTTPAPI legacy_mode = 'host' in module.params and module.params['host'] is not None and \ 'username' in module.params and module.params['username'] is not None and \ 'password' in module.params and module.params['password'] is not None diff --git a/lib/ansible/modules/network/fortios/fortios_system_automation_destination.py b/lib/ansible/modules/network/fortios/fortios_system_automation_destination.py index 6323c09c7e5..045d49d363c 100644 --- a/lib/ansible/modules/network/fortios/fortios_system_automation_destination.py +++ b/lib/ansible/modules/network/fortios/fortios_system_automation_destination.py @@ -26,7 +26,7 @@ DOCUMENTATION = ''' module: fortios_system_automation_destination short_description: Automation destinations in Fortinet's FortiOS and FortiGate. description: - - This module is able to configure a FortiGate or FortiOS device by allowing the + - This module is able to configure a FortiGate or FortiOS (FOS) device by allowing the user to set and modify system feature and automation_destination category. Examples include all parameters and values need to be adjusted to datasources before usage. Tested with FOS v6.0.5 @@ -76,6 +76,7 @@ options: description: - Indicates whether to create or remove the object. type: str + required: true choices: - present - absent @@ -97,7 +98,7 @@ options: type: str ha_group_id: description: - - Cluster group ID set for this destination (default = 0). + - Cluster group ID set for this destination . type: int name: description: @@ -282,7 +283,7 @@ def main(): fields = { "host": {"required": False, "type": "str"}, "username": {"required": False, "type": "str"}, - "password": {"required": False, "type": "str", "no_log": True}, + "password": {"required": False, "type": "str", "default": "", "no_log": True}, "vdom": {"required": False, "type": "str", "default": "root"}, "https": {"required": False, "type": "bool", "default": True}, "ssl_verify": {"required": False, "type": "bool", "default": True}, @@ -307,6 +308,7 @@ def main(): module = AnsibleModule(argument_spec=fields, supports_check_mode=False) + # legacy_mode refers to using fortiosapi instead of HTTPAPI legacy_mode = 'host' in module.params and module.params['host'] is not None and \ 'username' in module.params and module.params['username'] is not None and \ 'password' in module.params and module.params['password'] is not None diff --git a/lib/ansible/modules/network/fortios/fortios_system_automation_stitch.py b/lib/ansible/modules/network/fortios/fortios_system_automation_stitch.py index 90260e783ef..ce725ef4d8f 100644 --- a/lib/ansible/modules/network/fortios/fortios_system_automation_stitch.py +++ b/lib/ansible/modules/network/fortios/fortios_system_automation_stitch.py @@ -26,7 +26,7 @@ DOCUMENTATION = ''' module: fortios_system_automation_stitch short_description: Automation stitches in Fortinet's FortiOS and FortiGate. description: - - This module is able to configure a FortiGate or FortiOS device by allowing the + - This module is able to configure a FortiGate or FortiOS (FOS) device by allowing the user to set and modify system feature and automation_stitch category. Examples include all parameters and values need to be adjusted to datasources before usage. Tested with FOS v6.0.5 @@ -76,6 +76,7 @@ options: description: - Indicates whether to create or remove the object. type: str + required: true choices: - present - absent @@ -295,7 +296,7 @@ def main(): fields = { "host": {"required": False, "type": "str"}, "username": {"required": False, "type": "str"}, - "password": {"required": False, "type": "str", "no_log": True}, + "password": {"required": False, "type": "str", "default": "", "no_log": True}, "vdom": {"required": False, "type": "str", "default": "root"}, "https": {"required": False, "type": "bool", "default": True}, "ssl_verify": {"required": False, "type": "bool", "default": True}, @@ -324,6 +325,7 @@ def main(): module = AnsibleModule(argument_spec=fields, supports_check_mode=False) + # legacy_mode refers to using fortiosapi instead of HTTPAPI legacy_mode = 'host' in module.params and module.params['host'] is not None and \ 'username' in module.params and module.params['username'] is not None and \ 'password' in module.params and module.params['password'] is not None diff --git a/lib/ansible/modules/network/fortios/fortios_system_automation_trigger.py b/lib/ansible/modules/network/fortios/fortios_system_automation_trigger.py index d26ec2b40fa..f18f758e29f 100644 --- a/lib/ansible/modules/network/fortios/fortios_system_automation_trigger.py +++ b/lib/ansible/modules/network/fortios/fortios_system_automation_trigger.py @@ -26,7 +26,7 @@ DOCUMENTATION = ''' module: fortios_system_automation_trigger short_description: Trigger for automation stitches in Fortinet's FortiOS and FortiGate. description: - - This module is able to configure a FortiGate or FortiOS device by allowing the + - This module is able to configure a FortiGate or FortiOS (FOS) device by allowing the user to set and modify system feature and automation_trigger category. Examples include all parameters and values need to be adjusted to datasources before usage. Tested with FOS v6.0.5 @@ -76,6 +76,7 @@ options: description: - Indicates whether to create or remove the object. type: str + required: true choices: - present - absent @@ -134,7 +135,7 @@ options: type: int trigger_frequency: description: - - Scheduled trigger frequency (default = daily). + - Scheduled trigger frequency . type: str choices: - hourly @@ -143,7 +144,7 @@ options: - monthly trigger_hour: description: - - Hour of the day on which to trigger (0 - 23, default = 1). + - Hour of the day on which to trigger (0 - 23). type: int trigger_minute: description: @@ -346,7 +347,7 @@ def main(): fields = { "host": {"required": False, "type": "str"}, "username": {"required": False, "type": "str"}, - "password": {"required": False, "type": "str", "no_log": True}, + "password": {"required": False, "type": "str", "default": "", "no_log": True}, "vdom": {"required": False, "type": "str", "default": "root"}, "https": {"required": False, "type": "bool", "default": True}, "ssl_verify": {"required": False, "type": "bool", "default": True}, @@ -388,6 +389,7 @@ def main(): module = AnsibleModule(argument_spec=fields, supports_check_mode=False) + # legacy_mode refers to using fortiosapi instead of HTTPAPI legacy_mode = 'host' in module.params and module.params['host'] is not None and \ 'username' in module.params and module.params['username'] is not None and \ 'password' in module.params and module.params['password'] is not None diff --git a/lib/ansible/modules/network/fortios/fortios_system_autoupdate_push_update.py b/lib/ansible/modules/network/fortios/fortios_system_autoupdate_push_update.py index 2983e0b015a..d2ae48f18d9 100644 --- a/lib/ansible/modules/network/fortios/fortios_system_autoupdate_push_update.py +++ b/lib/ansible/modules/network/fortios/fortios_system_autoupdate_push_update.py @@ -26,7 +26,7 @@ DOCUMENTATION = ''' module: fortios_system_autoupdate_push_update short_description: Configure push updates in Fortinet's FortiOS and FortiGate. description: - - This module is able to configure a FortiGate or FortiOS device by allowing the + - This module is able to configure a FortiGate or FortiOS (FOS) device by allowing the user to set and modify system_autoupdate feature and push_update category. Examples include all parameters and values need to be adjusted to datasources before usage. Tested with FOS v6.0.5 @@ -260,7 +260,7 @@ def main(): fields = { "host": {"required": False, "type": "str"}, "username": {"required": False, "type": "str"}, - "password": {"required": False, "type": "str", "no_log": True}, + "password": {"required": False, "type": "str", "default": "", "no_log": True}, "vdom": {"required": False, "type": "str", "default": "root"}, "https": {"required": False, "type": "bool", "default": True}, "ssl_verify": {"required": False, "type": "bool", "default": True}, @@ -281,6 +281,7 @@ def main(): module = AnsibleModule(argument_spec=fields, supports_check_mode=False) + # legacy_mode refers to using fortiosapi instead of HTTPAPI legacy_mode = 'host' in module.params and module.params['host'] is not None and \ 'username' in module.params and module.params['username'] is not None and \ 'password' in module.params and module.params['password'] is not None diff --git a/lib/ansible/modules/network/fortios/fortios_system_autoupdate_schedule.py b/lib/ansible/modules/network/fortios/fortios_system_autoupdate_schedule.py index 5adf46b9b5e..9ac74b6115a 100644 --- a/lib/ansible/modules/network/fortios/fortios_system_autoupdate_schedule.py +++ b/lib/ansible/modules/network/fortios/fortios_system_autoupdate_schedule.py @@ -26,7 +26,7 @@ DOCUMENTATION = ''' module: fortios_system_autoupdate_schedule short_description: Configure update schedule in Fortinet's FortiOS and FortiGate. description: - - This module is able to configure a FortiGate or FortiOS device by allowing the + - This module is able to configure a FortiGate or FortiOS (FOS) device by allowing the user to set and modify system_autoupdate feature and schedule category. Examples include all parameters and values need to be adjusted to datasources before usage. Tested with FOS v6.0.5 @@ -269,7 +269,7 @@ def main(): fields = { "host": {"required": False, "type": "str"}, "username": {"required": False, "type": "str"}, - "password": {"required": False, "type": "str", "no_log": True}, + "password": {"required": False, "type": "str", "default": "", "no_log": True}, "vdom": {"required": False, "type": "str", "default": "root"}, "https": {"required": False, "type": "bool", "default": True}, "ssl_verify": {"required": False, "type": "bool", "default": True}, @@ -293,6 +293,7 @@ def main(): module = AnsibleModule(argument_spec=fields, supports_check_mode=False) + # legacy_mode refers to using fortiosapi instead of HTTPAPI legacy_mode = 'host' in module.params and module.params['host'] is not None and \ 'username' in module.params and module.params['username'] is not None and \ 'password' in module.params and module.params['password'] is not None diff --git a/lib/ansible/modules/network/fortios/fortios_system_autoupdate_tunneling.py b/lib/ansible/modules/network/fortios/fortios_system_autoupdate_tunneling.py index 45b134231ef..499a80728a3 100644 --- a/lib/ansible/modules/network/fortios/fortios_system_autoupdate_tunneling.py +++ b/lib/ansible/modules/network/fortios/fortios_system_autoupdate_tunneling.py @@ -26,7 +26,7 @@ DOCUMENTATION = ''' module: fortios_system_autoupdate_tunneling short_description: Configure web proxy tunnelling for the FDN in Fortinet's FortiOS and FortiGate. description: - - This module is able to configure a FortiGate or FortiOS device by allowing the + - This module is able to configure a FortiGate or FortiOS (FOS) device by allowing the user to set and modify system_autoupdate feature and tunneling category. Examples include all parameters and values need to be adjusted to datasources before usage. Tested with FOS v6.0.5 @@ -262,7 +262,7 @@ def main(): fields = { "host": {"required": False, "type": "str"}, "username": {"required": False, "type": "str"}, - "password": {"required": False, "type": "str", "no_log": True}, + "password": {"required": False, "type": "str", "default": "", "no_log": True}, "vdom": {"required": False, "type": "str", "default": "root"}, "https": {"required": False, "type": "bool", "default": True}, "ssl_verify": {"required": False, "type": "bool", "default": True}, @@ -283,6 +283,7 @@ def main(): module = AnsibleModule(argument_spec=fields, supports_check_mode=False) + # legacy_mode refers to using fortiosapi instead of HTTPAPI legacy_mode = 'host' in module.params and module.params['host'] is not None and \ 'username' in module.params and module.params['username'] is not None and \ 'password' in module.params and module.params['password'] is not None diff --git a/lib/ansible/modules/network/fortios/fortios_system_cluster_sync.py b/lib/ansible/modules/network/fortios/fortios_system_cluster_sync.py index 278c6b3785d..6f9780b039d 100644 --- a/lib/ansible/modules/network/fortios/fortios_system_cluster_sync.py +++ b/lib/ansible/modules/network/fortios/fortios_system_cluster_sync.py @@ -26,7 +26,7 @@ DOCUMENTATION = ''' module: fortios_system_cluster_sync short_description: Configure FortiGate Session Life Support Protocol (FGSP) session synchronization in Fortinet's FortiOS and FortiGate. description: - - This module is able to configure a FortiGate or FortiOS device by allowing the + - This module is able to configure a FortiGate or FortiOS (FOS) device by allowing the user to set and modify system feature and cluster_sync category. Examples include all parameters and values need to be adjusted to datasources before usage. Tested with FOS v6.0.5 @@ -76,6 +76,7 @@ options: description: - Indicates whether to create or remove the object. type: str + required: true choices: - present - absent @@ -377,7 +378,7 @@ def main(): fields = { "host": {"required": False, "type": "str"}, "username": {"required": False, "type": "str"}, - "password": {"required": False, "type": "str", "no_log": True}, + "password": {"required": False, "type": "str", "default": "", "no_log": True}, "vdom": {"required": False, "type": "str", "default": "root"}, "https": {"required": False, "type": "bool", "default": True}, "ssl_verify": {"required": False, "type": "bool", "default": True}, @@ -424,6 +425,7 @@ def main(): module = AnsibleModule(argument_spec=fields, supports_check_mode=False) + # legacy_mode refers to using fortiosapi instead of HTTPAPI legacy_mode = 'host' in module.params and module.params['host'] is not None and \ 'username' in module.params and module.params['username'] is not None and \ 'password' in module.params and module.params['password'] is not None diff --git a/lib/ansible/modules/network/fortios/fortios_system_console.py b/lib/ansible/modules/network/fortios/fortios_system_console.py index cd1099d1809..408621c212f 100644 --- a/lib/ansible/modules/network/fortios/fortios_system_console.py +++ b/lib/ansible/modules/network/fortios/fortios_system_console.py @@ -26,7 +26,7 @@ DOCUMENTATION = ''' module: fortios_system_console short_description: Configure console in Fortinet's FortiOS and FortiGate. description: - - This module is able to configure a FortiGate or FortiOS device by allowing the + - This module is able to configure a FortiGate or FortiOS (FOS) device by allowing the user to set and modify system feature and console category. Examples include all parameters and values need to be adjusted to datasources before usage. Tested with FOS v6.0.5 @@ -269,7 +269,7 @@ def main(): fields = { "host": {"required": False, "type": "str"}, "username": {"required": False, "type": "str"}, - "password": {"required": False, "type": "str", "no_log": True}, + "password": {"required": False, "type": "str", "default": "", "no_log": True}, "vdom": {"required": False, "type": "str", "default": "root"}, "https": {"required": False, "type": "bool", "default": True}, "ssl_verify": {"required": False, "type": "bool", "default": True}, @@ -293,6 +293,7 @@ def main(): module = AnsibleModule(argument_spec=fields, supports_check_mode=False) + # legacy_mode refers to using fortiosapi instead of HTTPAPI legacy_mode = 'host' in module.params and module.params['host'] is not None and \ 'username' in module.params and module.params['username'] is not None and \ 'password' in module.params and module.params['password'] is not None diff --git a/lib/ansible/modules/network/fortios/fortios_system_csf.py b/lib/ansible/modules/network/fortios/fortios_system_csf.py index d3ccb869b7d..a35637d76d1 100644 --- a/lib/ansible/modules/network/fortios/fortios_system_csf.py +++ b/lib/ansible/modules/network/fortios/fortios_system_csf.py @@ -26,7 +26,7 @@ DOCUMENTATION = ''' module: fortios_system_csf short_description: Add this FortiGate to a Security Fabric or set up a new Security Fabric on this FortiGate in Fortinet's FortiOS and FortiGate. description: - - This module is able to configure a FortiGate or FortiOS device by allowing the + - This module is able to configure a FortiGate or FortiOS (FOS) device by allowing the user to set and modify system feature and csf category. Examples include all parameters and values need to be adjusted to datasources before usage. Tested with FOS v6.0.5 @@ -174,7 +174,7 @@ options: type: str upstream_port: description: - - The port number to use to communicate with the FortiGate upstream from this FortiGate in the Security Fabric (default = 8013). + - The port number to use to communicate with the FortiGate upstream from this FortiGate in the Security Fabric . type: int ''' @@ -356,7 +356,7 @@ def main(): fields = { "host": {"required": False, "type": "str"}, "username": {"required": False, "type": "str"}, - "password": {"required": False, "type": "str", "no_log": True}, + "password": {"required": False, "type": "str", "default": "", "no_log": True}, "vdom": {"required": False, "type": "str", "default": "root"}, "https": {"required": False, "type": "bool", "default": True}, "ssl_verify": {"required": False, "type": "bool", "default": True}, @@ -400,6 +400,7 @@ def main(): module = AnsibleModule(argument_spec=fields, supports_check_mode=False) + # legacy_mode refers to using fortiosapi instead of HTTPAPI legacy_mode = 'host' in module.params and module.params['host'] is not None and \ 'username' in module.params and module.params['username'] is not None and \ 'password' in module.params and module.params['password'] is not None diff --git a/lib/ansible/modules/network/fortios/fortios_system_custom_language.py b/lib/ansible/modules/network/fortios/fortios_system_custom_language.py index 0db2470694e..ad58e8f2c78 100644 --- a/lib/ansible/modules/network/fortios/fortios_system_custom_language.py +++ b/lib/ansible/modules/network/fortios/fortios_system_custom_language.py @@ -26,7 +26,7 @@ DOCUMENTATION = ''' module: fortios_system_custom_language short_description: Configure custom languages in Fortinet's FortiOS and FortiGate. description: - - This module is able to configure a FortiGate or FortiOS device by allowing the + - This module is able to configure a FortiGate or FortiOS (FOS) device by allowing the user to set and modify system feature and custom_language category. Examples include all parameters and values need to be adjusted to datasources before usage. Tested with FOS v6.0.5 @@ -76,6 +76,7 @@ options: description: - Indicates whether to create or remove the object. type: str + required: true choices: - present - absent @@ -265,7 +266,7 @@ def main(): fields = { "host": {"required": False, "type": "str"}, "username": {"required": False, "type": "str"}, - "password": {"required": False, "type": "str", "no_log": True}, + "password": {"required": False, "type": "str", "default": "", "no_log": True}, "vdom": {"required": False, "type": "str", "default": "root"}, "https": {"required": False, "type": "bool", "default": True}, "ssl_verify": {"required": False, "type": "bool", "default": True}, @@ -285,6 +286,7 @@ def main(): module = AnsibleModule(argument_spec=fields, supports_check_mode=False) + # legacy_mode refers to using fortiosapi instead of HTTPAPI legacy_mode = 'host' in module.params and module.params['host'] is not None and \ 'username' in module.params and module.params['username'] is not None and \ 'password' in module.params and module.params['password'] is not None diff --git a/lib/ansible/modules/network/fortios/fortios_system_ddns.py b/lib/ansible/modules/network/fortios/fortios_system_ddns.py index 8ffc5c77b1f..eb8665e592f 100644 --- a/lib/ansible/modules/network/fortios/fortios_system_ddns.py +++ b/lib/ansible/modules/network/fortios/fortios_system_ddns.py @@ -26,7 +26,7 @@ DOCUMENTATION = ''' module: fortios_system_ddns short_description: Configure DDNS in Fortinet's FortiOS and FortiGate. description: - - This module is able to configure a FortiGate or FortiOS device by allowing the + - This module is able to configure a FortiGate or FortiOS (FOS) device by allowing the user to set and modify system feature and ddns category. Examples include all parameters and values need to be adjusted to datasources before usage. Tested with FOS v6.0.5 @@ -76,6 +76,7 @@ options: description: - Indicates whether to create or remove the object. type: str + required: true choices: - present - absent @@ -175,7 +176,7 @@ options: type: str update_interval: description: - - DDNS update interval (60 - 2592000 sec, default = 300). + - DDNS update interval (60 - 2592000 sec). type: int use_public_ip: description: @@ -373,7 +374,7 @@ def main(): fields = { "host": {"required": False, "type": "str"}, "username": {"required": False, "type": "str"}, - "password": {"required": False, "type": "str", "no_log": True}, + "password": {"required": False, "type": "str", "default": "", "no_log": True}, "vdom": {"required": False, "type": "str", "default": "root"}, "https": {"required": False, "type": "bool", "default": True}, "ssl_verify": {"required": False, "type": "bool", "default": True}, @@ -418,6 +419,7 @@ def main(): module = AnsibleModule(argument_spec=fields, supports_check_mode=False) + # legacy_mode refers to using fortiosapi instead of HTTPAPI legacy_mode = 'host' in module.params and module.params['host'] is not None and \ 'username' in module.params and module.params['username'] is not None and \ 'password' in module.params and module.params['password'] is not None diff --git a/lib/ansible/modules/network/fortios/fortios_system_dedicated_mgmt.py b/lib/ansible/modules/network/fortios/fortios_system_dedicated_mgmt.py index bc6784b2205..736a0f618a1 100644 --- a/lib/ansible/modules/network/fortios/fortios_system_dedicated_mgmt.py +++ b/lib/ansible/modules/network/fortios/fortios_system_dedicated_mgmt.py @@ -26,7 +26,7 @@ DOCUMENTATION = ''' module: fortios_system_dedicated_mgmt short_description: Configure dedicated management in Fortinet's FortiOS and FortiGate. description: - - This module is able to configure a FortiGate or FortiOS device by allowing the + - This module is able to configure a FortiGate or FortiOS (FOS) device by allowing the user to set and modify system feature and dedicated_mgmt category. Examples include all parameters and values need to be adjusted to datasources before usage. Tested with FOS v6.0.5 @@ -276,7 +276,7 @@ def main(): fields = { "host": {"required": False, "type": "str"}, "username": {"required": False, "type": "str"}, - "password": {"required": False, "type": "str", "no_log": True}, + "password": {"required": False, "type": "str", "default": "", "no_log": True}, "vdom": {"required": False, "type": "str", "default": "root"}, "https": {"required": False, "type": "bool", "default": True}, "ssl_verify": {"required": False, "type": "bool", "default": True}, @@ -300,6 +300,7 @@ def main(): module = AnsibleModule(argument_spec=fields, supports_check_mode=False) + # legacy_mode refers to using fortiosapi instead of HTTPAPI legacy_mode = 'host' in module.params and module.params['host'] is not None and \ 'username' in module.params and module.params['username'] is not None and \ 'password' in module.params and module.params['password'] is not None diff --git a/lib/ansible/modules/network/fortios/fortios_system_dhcp6_server.py b/lib/ansible/modules/network/fortios/fortios_system_dhcp6_server.py index 8a4c9daba41..b63c932ce7c 100644 --- a/lib/ansible/modules/network/fortios/fortios_system_dhcp6_server.py +++ b/lib/ansible/modules/network/fortios/fortios_system_dhcp6_server.py @@ -26,7 +26,7 @@ DOCUMENTATION = ''' module: fortios_system_dhcp6_server short_description: Configure DHCPv6 servers in Fortinet's FortiOS and FortiGate. description: - - This module is able to configure a FortiGate or FortiOS device by allowing the + - This module is able to configure a FortiGate or FortiOS (FOS) device by allowing the user to set and modify system_dhcp6 feature and server category. Examples include all parameters and values need to be adjusted to datasources before usage. Tested with FOS v6.0.5 @@ -76,6 +76,7 @@ options: description: - Indicates whether to create or remove the object. type: str + required: true choices: - present - absent @@ -408,7 +409,7 @@ def main(): fields = { "host": {"required": False, "type": "str"}, "username": {"required": False, "type": "str"}, - "password": {"required": False, "type": "str", "no_log": True}, + "password": {"required": False, "type": "str", "default": "", "no_log": True}, "vdom": {"required": False, "type": "str", "default": "root"}, "https": {"required": False, "type": "bool", "default": True}, "ssl_verify": {"required": False, "type": "bool", "default": True}, @@ -460,6 +461,7 @@ def main(): module = AnsibleModule(argument_spec=fields, supports_check_mode=False) + # legacy_mode refers to using fortiosapi instead of HTTPAPI legacy_mode = 'host' in module.params and module.params['host'] is not None and \ 'username' in module.params and module.params['username'] is not None and \ 'password' in module.params and module.params['password'] is not None diff --git a/lib/ansible/modules/network/fortios/fortios_system_dhcp_server.py b/lib/ansible/modules/network/fortios/fortios_system_dhcp_server.py index 9c5738b38e1..f5152944cd0 100644 --- a/lib/ansible/modules/network/fortios/fortios_system_dhcp_server.py +++ b/lib/ansible/modules/network/fortios/fortios_system_dhcp_server.py @@ -76,8 +76,10 @@ options: state: description: - Indicates whether to create or remove the object. + This attribute was present already in previous version in a deeper level. + It has been moved out to this outer level. type: str - required: true + required: false choices: - present - absent @@ -88,6 +90,17 @@ options: default: null type: dict suboptions: + state: + description: + - B(Deprecated) + - Starting with Ansible 2.9 we recommend using the top-level 'state' parameter. + - HORIZONTALLINE + - Indicates whether to create or remove the object. + type: str + required: false + choices: + - present + - absent auto_configuration: description: - Enable/disable auto configuration. @@ -708,7 +721,12 @@ def underscore_to_hyphen(data): def system_dhcp_server(data, fos): vdom = data['vdom'] - state = data['state'] + if 'state' in data and data['state']: + state = data['state'] + elif 'state' in data['system_dhcp_server'] and data['system_dhcp_server']: + state = data['system_dhcp_server']['state'] + else: + state = True system_dhcp_server_data = data['system_dhcp_server'] filtered_data = underscore_to_hyphen(filter_system_dhcp_server_data(system_dhcp_server_data)) @@ -748,11 +766,13 @@ def main(): "vdom": {"required": False, "type": "str", "default": "root"}, "https": {"required": False, "type": "bool", "default": True}, "ssl_verify": {"required": False, "type": "bool", "default": True}, - "state": {"required": True, "type": "str", + "state": {"required": False, "type": "str", "choices": ["present", "absent"]}, "system_dhcp_server": { "required": False, "type": "dict", "default": None, "options": { + "state": {"required": False, "type": "str", + "choices": ["present", "absent"]}, "auto_configuration": {"required": False, "type": "str", "choices": ["disable", "enable"]}, "conflicted_ip_timeout": {"required": False, "type": "int"}, diff --git a/lib/ansible/modules/network/fortios/fortios_system_dns_database.py b/lib/ansible/modules/network/fortios/fortios_system_dns_database.py index 303d501fa11..290f8bf33ba 100644 --- a/lib/ansible/modules/network/fortios/fortios_system_dns_database.py +++ b/lib/ansible/modules/network/fortios/fortios_system_dns_database.py @@ -26,7 +26,7 @@ DOCUMENTATION = ''' module: fortios_system_dns_database short_description: Configure DNS databases in Fortinet's FortiOS and FortiGate. description: - - This module is able to configure a FortiGate or FortiOS device by allowing the + - This module is able to configure a FortiGate or FortiOS (FOS) device by allowing the user to set and modify system feature and dns_database category. Examples include all parameters and values need to be adjusted to datasources before usage. Tested with FOS v6.0.5 @@ -76,6 +76,7 @@ options: description: - Indicates whether to create or remove the object. type: str + required: true choices: - present - absent @@ -397,7 +398,7 @@ def main(): fields = { "host": {"required": False, "type": "str"}, "username": {"required": False, "type": "str"}, - "password": {"required": False, "type": "str", "no_log": True}, + "password": {"required": False, "type": "str", "default": "", "no_log": True}, "vdom": {"required": False, "type": "str", "default": "root"}, "https": {"required": False, "type": "bool", "default": True}, "ssl_verify": {"required": False, "type": "bool", "default": True}, @@ -447,6 +448,7 @@ def main(): module = AnsibleModule(argument_spec=fields, supports_check_mode=False) + # legacy_mode refers to using fortiosapi instead of HTTPAPI legacy_mode = 'host' in module.params and module.params['host'] is not None and \ 'username' in module.params and module.params['username'] is not None and \ 'password' in module.params and module.params['password'] is not None diff --git a/lib/ansible/modules/network/fortios/fortios_system_dns_server.py b/lib/ansible/modules/network/fortios/fortios_system_dns_server.py index 0b58a362d43..1919519d5ff 100644 --- a/lib/ansible/modules/network/fortios/fortios_system_dns_server.py +++ b/lib/ansible/modules/network/fortios/fortios_system_dns_server.py @@ -26,7 +26,7 @@ DOCUMENTATION = ''' module: fortios_system_dns_server short_description: Configure DNS servers in Fortinet's FortiOS and FortiGate. description: - - This module is able to configure a FortiGate or FortiOS device by allowing the + - This module is able to configure a FortiGate or FortiOS (FOS) device by allowing the user to set and modify system feature and dns_server category. Examples include all parameters and values need to be adjusted to datasources before usage. Tested with FOS v6.0.5 @@ -76,6 +76,7 @@ options: description: - Indicates whether to create or remove the object. type: str + required: true choices: - present - absent @@ -269,7 +270,7 @@ def main(): fields = { "host": {"required": False, "type": "str"}, "username": {"required": False, "type": "str"}, - "password": {"required": False, "type": "str", "no_log": True}, + "password": {"required": False, "type": "str", "default": "", "no_log": True}, "vdom": {"required": False, "type": "str", "default": "root"}, "https": {"required": False, "type": "bool", "default": True}, "ssl_verify": {"required": False, "type": "bool", "default": True}, @@ -290,6 +291,7 @@ def main(): module = AnsibleModule(argument_spec=fields, supports_check_mode=False) + # legacy_mode refers to using fortiosapi instead of HTTPAPI legacy_mode = 'host' in module.params and module.params['host'] is not None and \ 'username' in module.params and module.params['username'] is not None and \ 'password' in module.params and module.params['password'] is not None diff --git a/lib/ansible/modules/network/fortios/fortios_system_dscp_based_priority.py b/lib/ansible/modules/network/fortios/fortios_system_dscp_based_priority.py index f637a05da3d..f2b73c9b56d 100644 --- a/lib/ansible/modules/network/fortios/fortios_system_dscp_based_priority.py +++ b/lib/ansible/modules/network/fortios/fortios_system_dscp_based_priority.py @@ -26,7 +26,7 @@ DOCUMENTATION = ''' module: fortios_system_dscp_based_priority short_description: Configure DSCP based priority table in Fortinet's FortiOS and FortiGate. description: - - This module is able to configure a FortiGate or FortiOS device by allowing the + - This module is able to configure a FortiGate or FortiOS (FOS) device by allowing the user to set and modify system feature and dscp_based_priority category. Examples include all parameters and values need to be adjusted to datasources before usage. Tested with FOS v6.0.5 @@ -76,6 +76,7 @@ options: description: - Indicates whether to create or remove the object. type: str + required: true choices: - present - absent @@ -269,7 +270,7 @@ def main(): fields = { "host": {"required": False, "type": "str"}, "username": {"required": False, "type": "str"}, - "password": {"required": False, "type": "str", "no_log": True}, + "password": {"required": False, "type": "str", "default": "", "no_log": True}, "vdom": {"required": False, "type": "str", "default": "root"}, "https": {"required": False, "type": "bool", "default": True}, "ssl_verify": {"required": False, "type": "bool", "default": True}, @@ -290,6 +291,7 @@ def main(): module = AnsibleModule(argument_spec=fields, supports_check_mode=False) + # legacy_mode refers to using fortiosapi instead of HTTPAPI legacy_mode = 'host' in module.params and module.params['host'] is not None and \ 'username' in module.params and module.params['username'] is not None and \ 'password' in module.params and module.params['password'] is not None diff --git a/lib/ansible/modules/network/fortios/fortios_system_email_server.py b/lib/ansible/modules/network/fortios/fortios_system_email_server.py index 3e0972c1d02..8944928b96b 100644 --- a/lib/ansible/modules/network/fortios/fortios_system_email_server.py +++ b/lib/ansible/modules/network/fortios/fortios_system_email_server.py @@ -27,7 +27,7 @@ module: fortios_system_email_server short_description: Configure the email server used by the FortiGate various things. For example, for sending email messages to users to support user authentication features in Fortinet's FortiOS and FortiGate. description: - - This module is able to configure a FortiGate or FortiOS device by allowing the + - This module is able to configure a FortiGate or FortiOS (FOS) device by allowing the user to set and modify system feature and email_server category. Examples include all parameters and values need to be adjusted to datasources before usage. Tested with FOS v6.0.5 @@ -121,7 +121,7 @@ options: type: str ssl_min_proto_version: description: - - Minimum supported protocol version for SSL/TLS connections (default is to follow system global setting). + - Minimum supported protocol version for SSL/TLS connections . type: str choices: - default @@ -317,7 +317,7 @@ def main(): fields = { "host": {"required": False, "type": "str"}, "username": {"required": False, "type": "str"}, - "password": {"required": False, "type": "str", "no_log": True}, + "password": {"required": False, "type": "str", "default": "", "no_log": True}, "vdom": {"required": False, "type": "str", "default": "root"}, "https": {"required": False, "type": "bool", "default": True}, "ssl_verify": {"required": False, "type": "bool", "default": True}, @@ -350,6 +350,7 @@ def main(): module = AnsibleModule(argument_spec=fields, supports_check_mode=False) + # legacy_mode refers to using fortiosapi instead of HTTPAPI legacy_mode = 'host' in module.params and module.params['host'] is not None and \ 'username' in module.params and module.params['username'] is not None and \ 'password' in module.params and module.params['password'] is not None diff --git a/lib/ansible/modules/network/fortios/fortios_system_external_resource.py b/lib/ansible/modules/network/fortios/fortios_system_external_resource.py index 90e744f0afa..59e4d8b6ae4 100644 --- a/lib/ansible/modules/network/fortios/fortios_system_external_resource.py +++ b/lib/ansible/modules/network/fortios/fortios_system_external_resource.py @@ -26,7 +26,7 @@ DOCUMENTATION = ''' module: fortios_system_external_resource short_description: Configure external resource in Fortinet's FortiOS and FortiGate. description: - - This module is able to configure a FortiGate or FortiOS device by allowing the + - This module is able to configure a FortiGate or FortiOS (FOS) device by allowing the user to set and modify system feature and external_resource category. Examples include all parameters and values need to be adjusted to datasources before usage. Tested with FOS v6.0.5 @@ -76,6 +76,7 @@ options: description: - Indicates whether to create or remove the object. type: str + required: true choices: - present - absent @@ -100,7 +101,7 @@ options: type: str refresh_rate: description: - - Time interval to refresh external resource (1 - 43200 min, default = 5 min). + - Time interval to refresh external resource (1 - 43200 min). type: int resource: description: @@ -294,7 +295,7 @@ def main(): fields = { "host": {"required": False, "type": "str"}, "username": {"required": False, "type": "str"}, - "password": {"required": False, "type": "str", "no_log": True}, + "password": {"required": False, "type": "str", "default": "", "no_log": True}, "vdom": {"required": False, "type": "str", "default": "root"}, "https": {"required": False, "type": "bool", "default": True}, "ssl_verify": {"required": False, "type": "bool", "default": True}, @@ -320,6 +321,7 @@ def main(): module = AnsibleModule(argument_spec=fields, supports_check_mode=False) + # legacy_mode refers to using fortiosapi instead of HTTPAPI legacy_mode = 'host' in module.params and module.params['host'] is not None and \ 'username' in module.params and module.params['username'] is not None and \ 'password' in module.params and module.params['password'] is not None diff --git a/lib/ansible/modules/network/fortios/fortios_system_fips_cc.py b/lib/ansible/modules/network/fortios/fortios_system_fips_cc.py index f4168eb95ae..891e8447004 100644 --- a/lib/ansible/modules/network/fortios/fortios_system_fips_cc.py +++ b/lib/ansible/modules/network/fortios/fortios_system_fips_cc.py @@ -26,7 +26,7 @@ DOCUMENTATION = ''' module: fortios_system_fips_cc short_description: Configure FIPS-CC mode in Fortinet's FortiOS and FortiGate. description: - - This module is able to configure a FortiGate or FortiOS device by allowing the + - This module is able to configure a FortiGate or FortiOS (FOS) device by allowing the user to set and modify system feature and fips_cc category. Examples include all parameters and values need to be adjusted to datasources before usage. Tested with FOS v6.0.5 @@ -255,7 +255,7 @@ def main(): fields = { "host": {"required": False, "type": "str"}, "username": {"required": False, "type": "str"}, - "password": {"required": False, "type": "str", "no_log": True}, + "password": {"required": False, "type": "str", "default": "", "no_log": True}, "vdom": {"required": False, "type": "str", "default": "root"}, "https": {"required": False, "type": "bool", "default": True}, "ssl_verify": {"required": False, "type": "bool", "default": True}, @@ -275,6 +275,7 @@ def main(): module = AnsibleModule(argument_spec=fields, supports_check_mode=False) + # legacy_mode refers to using fortiosapi instead of HTTPAPI legacy_mode = 'host' in module.params and module.params['host'] is not None and \ 'username' in module.params and module.params['username'] is not None and \ 'password' in module.params and module.params['password'] is not None diff --git a/lib/ansible/modules/network/fortios/fortios_system_fm.py b/lib/ansible/modules/network/fortios/fortios_system_fm.py index 33a21f9d404..178b065db37 100644 --- a/lib/ansible/modules/network/fortios/fortios_system_fm.py +++ b/lib/ansible/modules/network/fortios/fortios_system_fm.py @@ -26,7 +26,7 @@ DOCUMENTATION = ''' module: fortios_system_fm short_description: Configure FM in Fortinet's FortiOS and FortiGate. description: - - This module is able to configure a FortiGate or FortiOS device by allowing the + - This module is able to configure a FortiGate or FortiOS (FOS) device by allowing the user to set and modify system feature and fm category. Examples include all parameters and values need to be adjusted to datasources before usage. Tested with FOS v6.0.5 @@ -282,7 +282,7 @@ def main(): fields = { "host": {"required": False, "type": "str"}, "username": {"required": False, "type": "str"}, - "password": {"required": False, "type": "str", "no_log": True}, + "password": {"required": False, "type": "str", "default": "", "no_log": True}, "vdom": {"required": False, "type": "str", "default": "root"}, "https": {"required": False, "type": "bool", "default": True}, "ssl_verify": {"required": False, "type": "bool", "default": True}, @@ -308,6 +308,7 @@ def main(): module = AnsibleModule(argument_spec=fields, supports_check_mode=False) + # legacy_mode refers to using fortiosapi instead of HTTPAPI legacy_mode = 'host' in module.params and module.params['host'] is not None and \ 'username' in module.params and module.params['username'] is not None and \ 'password' in module.params and module.params['password'] is not None diff --git a/lib/ansible/modules/network/fortios/fortios_system_fortiguard.py b/lib/ansible/modules/network/fortios/fortios_system_fortiguard.py index 23488b88c9b..fa3ec9fd375 100644 --- a/lib/ansible/modules/network/fortios/fortios_system_fortiguard.py +++ b/lib/ansible/modules/network/fortios/fortios_system_fortiguard.py @@ -26,7 +26,7 @@ DOCUMENTATION = ''' module: fortios_system_fortiguard short_description: Configure FortiGuard services in Fortinet's FortiOS and FortiGate. description: - - This module is able to configure a FortiGate or FortiOS device by allowing the + - This module is able to configure a FortiGate or FortiOS (FOS) device by allowing the user to set and modify system feature and fortiguard category. Examples include all parameters and values need to be adjusted to datasources before usage. Tested with FOS v6.0.5 @@ -111,7 +111,7 @@ options: type: int antispam_timeout: description: - - Antispam query time out (1 - 30 sec, default = 7). + - Antispam query time out (1 - 30 sec). type: int auto_join_forticloud: description: @@ -141,11 +141,11 @@ options: - disable outbreak_prevention_cache_mpercent: description: - - Maximum percent of memory FortiGuard Virus Outbreak Prevention cache can use (1 - 15%, default = 2). + - Maximum percent of memory FortiGuard Virus Outbreak Prevention cache can use (1 - 15%). type: int outbreak_prevention_cache_ttl: description: - - Time-to-live for FortiGuard Virus Outbreak Prevention cache entries (300 - 86400 sec, default = 300). + - Time-to-live for FortiGuard Virus Outbreak Prevention cache entries (300 - 86400 sec). type: int outbreak_prevention_expiration: description: @@ -164,7 +164,7 @@ options: type: int outbreak_prevention_timeout: description: - - FortiGuard Virus Outbreak Prevention time out (1 - 30 sec, default = 7). + - FortiGuard Virus Outbreak Prevention time out (1 - 30 sec). type: int port: description: @@ -229,7 +229,7 @@ options: type: int webfilter_timeout: description: - - Web filter query time out (1 - 30 sec, default = 7). + - Web filter query time out (1 - 30 sec). type: int ''' @@ -427,7 +427,7 @@ def main(): fields = { "host": {"required": False, "type": "str"}, "username": {"required": False, "type": "str"}, - "password": {"required": False, "type": "str", "no_log": True}, + "password": {"required": False, "type": "str", "default": "", "no_log": True}, "vdom": {"required": False, "type": "str", "default": "root"}, "https": {"required": False, "type": "bool", "default": True}, "ssl_verify": {"required": False, "type": "bool", "default": True}, @@ -482,6 +482,7 @@ def main(): module = AnsibleModule(argument_spec=fields, supports_check_mode=False) + # legacy_mode refers to using fortiosapi instead of HTTPAPI legacy_mode = 'host' in module.params and module.params['host'] is not None and \ 'username' in module.params and module.params['username'] is not None and \ 'password' in module.params and module.params['password'] is not None diff --git a/lib/ansible/modules/network/fortios/fortios_system_fortimanager.py b/lib/ansible/modules/network/fortios/fortios_system_fortimanager.py index 19435ed3d52..e936b41fb3a 100644 --- a/lib/ansible/modules/network/fortios/fortios_system_fortimanager.py +++ b/lib/ansible/modules/network/fortios/fortios_system_fortimanager.py @@ -26,7 +26,7 @@ DOCUMENTATION = ''' module: fortios_system_fortimanager short_description: Configure FortiManager in Fortinet's FortiOS and FortiGate. description: - - This module is able to configure a FortiGate or FortiOS device by allowing the + - This module is able to configure a FortiGate or FortiOS (FOS) device by allowing the user to set and modify system feature and fortimanager category. Examples include all parameters and values need to be adjusted to datasources before usage. Tested with FOS v6.0.5 @@ -285,7 +285,7 @@ def main(): fields = { "host": {"required": False, "type": "str"}, "username": {"required": False, "type": "str"}, - "password": {"required": False, "type": "str", "no_log": True}, + "password": {"required": False, "type": "str", "default": "", "no_log": True}, "vdom": {"required": False, "type": "str", "default": "root"}, "https": {"required": False, "type": "bool", "default": True}, "ssl_verify": {"required": False, "type": "bool", "default": True}, @@ -312,6 +312,7 @@ def main(): module = AnsibleModule(argument_spec=fields, supports_check_mode=False) + # legacy_mode refers to using fortiosapi instead of HTTPAPI legacy_mode = 'host' in module.params and module.params['host'] is not None and \ 'username' in module.params and module.params['username'] is not None and \ 'password' in module.params and module.params['password'] is not None diff --git a/lib/ansible/modules/network/fortios/fortios_system_fortisandbox.py b/lib/ansible/modules/network/fortios/fortios_system_fortisandbox.py index 7e90931d007..45bcccc3a12 100644 --- a/lib/ansible/modules/network/fortios/fortios_system_fortisandbox.py +++ b/lib/ansible/modules/network/fortios/fortios_system_fortisandbox.py @@ -26,7 +26,7 @@ DOCUMENTATION = ''' module: fortios_system_fortisandbox short_description: Configure FortiSandbox in Fortinet's FortiOS and FortiGate. description: - - This module is able to configure a FortiGate or FortiOS device by allowing the + - This module is able to configure a FortiGate or FortiOS (FOS) device by allowing the user to set and modify system feature and fortisandbox category. Examples include all parameters and values need to be adjusted to datasources before usage. Tested with FOS v6.0.5 @@ -100,7 +100,7 @@ options: type: str ssl_min_proto_version: description: - - Minimum supported protocol version for SSL/TLS connections (default is to follow system global setting). + - Minimum supported protocol version for SSL/TLS connections . type: str choices: - default @@ -277,7 +277,7 @@ def main(): fields = { "host": {"required": False, "type": "str"}, "username": {"required": False, "type": "str"}, - "password": {"required": False, "type": "str", "no_log": True}, + "password": {"required": False, "type": "str", "default": "", "no_log": True}, "vdom": {"required": False, "type": "str", "default": "root"}, "https": {"required": False, "type": "bool", "default": True}, "ssl_verify": {"required": False, "type": "bool", "default": True}, @@ -302,6 +302,7 @@ def main(): module = AnsibleModule(argument_spec=fields, supports_check_mode=False) + # legacy_mode refers to using fortiosapi instead of HTTPAPI legacy_mode = 'host' in module.params and module.params['host'] is not None and \ 'username' in module.params and module.params['username'] is not None and \ 'password' in module.params and module.params['password'] is not None diff --git a/lib/ansible/modules/network/fortios/fortios_system_fsso_polling.py b/lib/ansible/modules/network/fortios/fortios_system_fsso_polling.py index 1d0ea7c80cf..ec6af242a98 100644 --- a/lib/ansible/modules/network/fortios/fortios_system_fsso_polling.py +++ b/lib/ansible/modules/network/fortios/fortios_system_fsso_polling.py @@ -26,7 +26,7 @@ DOCUMENTATION = ''' module: fortios_system_fsso_polling short_description: Configure Fortinet Single Sign On (FSSO) server in Fortinet's FortiOS and FortiGate. description: - - This module is able to configure a FortiGate or FortiOS device by allowing the + - This module is able to configure a FortiGate or FortiOS (FOS) device by allowing the user to set and modify system feature and fsso_polling category. Examples include all parameters and values need to be adjusted to datasources before usage. Tested with FOS v6.0.5 @@ -260,7 +260,7 @@ def main(): fields = { "host": {"required": False, "type": "str"}, "username": {"required": False, "type": "str"}, - "password": {"required": False, "type": "str", "no_log": True}, + "password": {"required": False, "type": "str", "default": "", "no_log": True}, "vdom": {"required": False, "type": "str", "default": "root"}, "https": {"required": False, "type": "bool", "default": True}, "ssl_verify": {"required": False, "type": "bool", "default": True}, @@ -281,6 +281,7 @@ def main(): module = AnsibleModule(argument_spec=fields, supports_check_mode=False) + # legacy_mode refers to using fortiosapi instead of HTTPAPI legacy_mode = 'host' in module.params and module.params['host'] is not None and \ 'username' in module.params and module.params['username'] is not None and \ 'password' in module.params and module.params['password'] is not None diff --git a/lib/ansible/modules/network/fortios/fortios_system_ftm_push.py b/lib/ansible/modules/network/fortios/fortios_system_ftm_push.py index 598fbd589db..d371e8216f0 100644 --- a/lib/ansible/modules/network/fortios/fortios_system_ftm_push.py +++ b/lib/ansible/modules/network/fortios/fortios_system_ftm_push.py @@ -26,7 +26,7 @@ DOCUMENTATION = ''' module: fortios_system_ftm_push short_description: Configure FortiToken Mobile push services in Fortinet's FortiOS and FortiGate. description: - - This module is able to configure a FortiGate or FortiOS device by allowing the + - This module is able to configure a FortiGate or FortiOS (FOS) device by allowing the user to set and modify system feature and ftm_push category. Examples include all parameters and values need to be adjusted to datasources before usage. Tested with FOS v6.0.5 @@ -84,7 +84,7 @@ options: type: str server_port: description: - - Port to communicate with FortiToken Mobile push services server (1 - 65535, default = 4433). + - Port to communicate with FortiToken Mobile push services server (1 - 65535). type: int status: description: @@ -251,7 +251,7 @@ def main(): fields = { "host": {"required": False, "type": "str"}, "username": {"required": False, "type": "str"}, - "password": {"required": False, "type": "str", "no_log": True}, + "password": {"required": False, "type": "str", "default": "", "no_log": True}, "vdom": {"required": False, "type": "str", "default": "root"}, "https": {"required": False, "type": "bool", "default": True}, "ssl_verify": {"required": False, "type": "bool", "default": True}, @@ -270,6 +270,7 @@ def main(): module = AnsibleModule(argument_spec=fields, supports_check_mode=False) + # legacy_mode refers to using fortiosapi instead of HTTPAPI legacy_mode = 'host' in module.params and module.params['host'] is not None and \ 'username' in module.params and module.params['username'] is not None and \ 'password' in module.params and module.params['password'] is not None diff --git a/lib/ansible/modules/network/fortios/fortios_system_geoip_override.py b/lib/ansible/modules/network/fortios/fortios_system_geoip_override.py index 04280915a2e..c0cce6aeeca 100644 --- a/lib/ansible/modules/network/fortios/fortios_system_geoip_override.py +++ b/lib/ansible/modules/network/fortios/fortios_system_geoip_override.py @@ -26,7 +26,7 @@ DOCUMENTATION = ''' module: fortios_system_geoip_override short_description: Configure geographical location mapping for IP address(es) to override mappings from FortiGuard in Fortinet's FortiOS and FortiGate. description: - - This module is able to configure a FortiGate or FortiOS device by allowing the + - This module is able to configure a FortiGate or FortiOS (FOS) device by allowing the user to set and modify system feature and geoip_override category. Examples include all parameters and values need to be adjusted to datasources before usage. Tested with FOS v6.0.5 @@ -76,6 +76,7 @@ options: description: - Indicates whether to create or remove the object. type: str + required: true choices: - present - absent @@ -289,7 +290,7 @@ def main(): fields = { "host": {"required": False, "type": "str"}, "username": {"required": False, "type": "str"}, - "password": {"required": False, "type": "str", "no_log": True}, + "password": {"required": False, "type": "str", "default": "", "no_log": True}, "vdom": {"required": False, "type": "str", "default": "root"}, "https": {"required": False, "type": "bool", "default": True}, "ssl_verify": {"required": False, "type": "bool", "default": True}, @@ -315,6 +316,7 @@ def main(): module = AnsibleModule(argument_spec=fields, supports_check_mode=False) + # legacy_mode refers to using fortiosapi instead of HTTPAPI legacy_mode = 'host' in module.params and module.params['host'] is not None and \ 'username' in module.params and module.params['username'] is not None and \ 'password' in module.params and module.params['password'] is not None diff --git a/lib/ansible/modules/network/fortios/fortios_system_gre_tunnel.py b/lib/ansible/modules/network/fortios/fortios_system_gre_tunnel.py index 1299fc11c8b..c7c0eb396a8 100644 --- a/lib/ansible/modules/network/fortios/fortios_system_gre_tunnel.py +++ b/lib/ansible/modules/network/fortios/fortios_system_gre_tunnel.py @@ -26,7 +26,7 @@ DOCUMENTATION = ''' module: fortios_system_gre_tunnel short_description: Configure GRE tunnel in Fortinet's FortiOS and FortiGate. description: - - This module is able to configure a FortiGate or FortiOS device by allowing the + - This module is able to configure a FortiGate or FortiOS (FOS) device by allowing the user to set and modify system feature and gre_tunnel category. Examples include all parameters and values need to be adjusted to datasources before usage. Tested with FOS v6.0.5 @@ -76,6 +76,7 @@ options: description: - Indicates whether to create or remove the object. type: str + required: true choices: - present - absent @@ -353,7 +354,7 @@ def main(): fields = { "host": {"required": False, "type": "str"}, "username": {"required": False, "type": "str"}, - "password": {"required": False, "type": "str", "no_log": True}, + "password": {"required": False, "type": "str", "default": "", "no_log": True}, "vdom": {"required": False, "type": "str", "default": "root"}, "https": {"required": False, "type": "bool", "default": True}, "ssl_verify": {"required": False, "type": "bool", "default": True}, @@ -392,6 +393,7 @@ def main(): module = AnsibleModule(argument_spec=fields, supports_check_mode=False) + # legacy_mode refers to using fortiosapi instead of HTTPAPI legacy_mode = 'host' in module.params and module.params['host'] is not None and \ 'username' in module.params and module.params['username'] is not None and \ 'password' in module.params and module.params['password'] is not None diff --git a/lib/ansible/modules/network/fortios/fortios_system_ha.py b/lib/ansible/modules/network/fortios/fortios_system_ha.py index dfd3bc384db..d7559e79a82 100644 --- a/lib/ansible/modules/network/fortios/fortios_system_ha.py +++ b/lib/ansible/modules/network/fortios/fortios_system_ha.py @@ -13,7 +13,7 @@ from __future__ import (absolute_import, division, print_function) # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License -# along with this program. If not, see +# along with this program. If not, see . __metaclass__ = type @@ -26,7 +26,7 @@ DOCUMENTATION = ''' module: fortios_system_ha short_description: Configure HA in Fortinet's FortiOS and FortiGate. description: - - This module is able to configure a FortiGate or FortiOS device by allowing the + - This module is able to configure a FortiGate or FortiOS (FOS) device by allowing the user to set and modify system feature and ha category. Examples include all parameters and values need to be adjusted to datasources before usage. Tested with FOS v6.0.5 @@ -741,7 +741,7 @@ def main(): fields = { "host": {"required": False, "type": "str"}, "username": {"required": False, "type": "str"}, - "password": {"required": False, "type": "str", "no_log": True}, + "password": {"required": False, "type": "str", "default": "", "no_log": True}, "vdom": {"required": False, "type": "str", "default": "root"}, "https": {"required": False, "type": "bool", "default": True}, "ssl_verify": {"required": False, "type": "bool", "default": True}, @@ -868,6 +868,7 @@ def main(): module = AnsibleModule(argument_spec=fields, supports_check_mode=False) + # legacy_mode refers to using fortiosapi instead of HTTPAPI legacy_mode = 'host' in module.params and module.params['host'] is not None and \ 'username' in module.params and module.params['username'] is not None and \ 'password' in module.params and module.params['password'] is not None diff --git a/lib/ansible/modules/network/fortios/fortios_system_ha_monitor.py b/lib/ansible/modules/network/fortios/fortios_system_ha_monitor.py index e929fa006db..735be13909d 100644 --- a/lib/ansible/modules/network/fortios/fortios_system_ha_monitor.py +++ b/lib/ansible/modules/network/fortios/fortios_system_ha_monitor.py @@ -26,7 +26,7 @@ DOCUMENTATION = ''' module: fortios_system_ha_monitor short_description: Configure HA monitor in Fortinet's FortiOS and FortiGate. description: - - This module is able to configure a FortiGate or FortiOS device by allowing the + - This module is able to configure a FortiGate or FortiOS (FOS) device by allowing the user to set and modify system feature and ha_monitor category. Examples include all parameters and values need to be adjusted to datasources before usage. Tested with FOS v6.0.5 @@ -251,7 +251,7 @@ def main(): fields = { "host": {"required": False, "type": "str"}, "username": {"required": False, "type": "str"}, - "password": {"required": False, "type": "str", "no_log": True}, + "password": {"required": False, "type": "str", "default": "", "no_log": True}, "vdom": {"required": False, "type": "str", "default": "root"}, "https": {"required": False, "type": "bool", "default": True}, "ssl_verify": {"required": False, "type": "bool", "default": True}, @@ -270,6 +270,7 @@ def main(): module = AnsibleModule(argument_spec=fields, supports_check_mode=False) + # legacy_mode refers to using fortiosapi instead of HTTPAPI legacy_mode = 'host' in module.params and module.params['host'] is not None and \ 'username' in module.params and module.params['username'] is not None and \ 'password' in module.params and module.params['password'] is not None diff --git a/lib/ansible/modules/network/fortios/fortios_system_interface.py b/lib/ansible/modules/network/fortios/fortios_system_interface.py index 004b6650ceb..306adc90070 100644 --- a/lib/ansible/modules/network/fortios/fortios_system_interface.py +++ b/lib/ansible/modules/network/fortios/fortios_system_interface.py @@ -76,8 +76,10 @@ options: state: description: - Indicates whether to create or remove the object. + This attribute was present already in previous version in a deeper level. + It has been moved out to this outer level. type: str - required: true + required: false choices: - present - absent @@ -88,6 +90,17 @@ options: default: null type: dict suboptions: + state: + description: + - B(Deprecated) + - Starting with Ansible 2.9 we recommend using the top-level 'state' parameter. + - HORIZONTALLINE + - Indicates whether to create or remove the object. + type: str + required: false + choices: + - present + - absent ac_name: description: - PPPoE server name. @@ -2042,7 +2055,12 @@ def underscore_to_hyphen(data): def system_interface(data, fos): vdom = data['vdom'] - state = data['state'] + if 'state' in data and data['state']: + state = data['state'] + elif 'state' in data['system_interface'] and data['system_interface']: + state = data['system_interface']['state'] + else: + state = True system_interface_data = data['system_interface'] system_interface_data = flatten_multilists_attributes(system_interface_data) filtered_data = underscore_to_hyphen(filter_system_interface_data(system_interface_data)) @@ -2083,11 +2101,13 @@ def main(): "vdom": {"required": False, "type": "str", "default": "root"}, "https": {"required": False, "type": "bool", "default": True}, "ssl_verify": {"required": False, "type": "bool", "default": True}, - "state": {"required": True, "type": "str", + "state": {"required": False, "type": "str", "choices": ["present", "absent"]}, "system_interface": { "required": False, "type": "dict", "default": None, "options": { + "state": {"required": False, "type": "str", + "choices": ["present", "absent"]}, "ac_name": {"required": False, "type": "str"}, "aggregate": {"required": False, "type": "str"}, "algorithm": {"required": False, "type": "str", diff --git a/lib/ansible/modules/network/fortios/fortios_system_ipip_tunnel.py b/lib/ansible/modules/network/fortios/fortios_system_ipip_tunnel.py index ab953585492..7a3246a5051 100644 --- a/lib/ansible/modules/network/fortios/fortios_system_ipip_tunnel.py +++ b/lib/ansible/modules/network/fortios/fortios_system_ipip_tunnel.py @@ -26,7 +26,7 @@ DOCUMENTATION = ''' module: fortios_system_ipip_tunnel short_description: Configure IP in IP Tunneling in Fortinet's FortiOS and FortiGate. description: - - This module is able to configure a FortiGate or FortiOS device by allowing the + - This module is able to configure a FortiGate or FortiOS (FOS) device by allowing the user to set and modify system feature and ipip_tunnel category. Examples include all parameters and values need to be adjusted to datasources before usage. Tested with FOS v6.0.5 @@ -76,6 +76,7 @@ options: description: - Indicates whether to create or remove the object. type: str + required: true choices: - present - absent @@ -271,7 +272,7 @@ def main(): fields = { "host": {"required": False, "type": "str"}, "username": {"required": False, "type": "str"}, - "password": {"required": False, "type": "str", "no_log": True}, + "password": {"required": False, "type": "str", "default": "", "no_log": True}, "vdom": {"required": False, "type": "str", "default": "root"}, "https": {"required": False, "type": "bool", "default": True}, "ssl_verify": {"required": False, "type": "bool", "default": True}, @@ -292,6 +293,7 @@ def main(): module = AnsibleModule(argument_spec=fields, supports_check_mode=False) + # legacy_mode refers to using fortiosapi instead of HTTPAPI legacy_mode = 'host' in module.params and module.params['host'] is not None and \ 'username' in module.params and module.params['username'] is not None and \ 'password' in module.params and module.params['password'] is not None