2020-03-09 10:11:07 +01:00
|
|
|
#!/usr/bin/python
|
|
|
|
# Copyright (c) 2018 Red Hat, Inc.
|
|
|
|
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
|
|
|
|
|
|
|
|
from __future__ import absolute_import, division, print_function
|
|
|
|
__metaclass__ = type
|
|
|
|
|
|
|
|
DOCUMENTATION = '''
|
|
|
|
---
|
|
|
|
module: nios_member
|
|
|
|
author: "Krishna Vasudevan (@krisvasudevan)"
|
|
|
|
short_description: Configure Infoblox NIOS members
|
|
|
|
description:
|
|
|
|
- Adds and/or removes Infoblox NIOS servers. This module manages NIOS C(member) objects using the Infoblox WAPI interface over REST.
|
|
|
|
requirements:
|
|
|
|
- infoblox-client
|
|
|
|
extends_documentation_fragment:
|
|
|
|
- community.general.nios
|
|
|
|
|
|
|
|
options:
|
|
|
|
host_name:
|
|
|
|
description:
|
|
|
|
- Specifies the host name of the member to either add or remove from
|
|
|
|
the NIOS instance.
|
|
|
|
required: true
|
|
|
|
aliases:
|
|
|
|
- name
|
2021-01-11 22:14:46 +01:00
|
|
|
type: str
|
2020-03-09 10:11:07 +01:00
|
|
|
vip_setting:
|
|
|
|
description:
|
|
|
|
- Configures the network settings for the grid member.
|
2020-11-27 08:01:02 +01:00
|
|
|
type: list
|
|
|
|
elements: dict
|
2020-03-09 10:11:07 +01:00
|
|
|
suboptions:
|
|
|
|
address:
|
|
|
|
description:
|
|
|
|
- The IPv4 Address of the Grid Member
|
2021-01-11 22:14:46 +01:00
|
|
|
type: str
|
2020-03-09 10:11:07 +01:00
|
|
|
subnet_mask:
|
|
|
|
description:
|
|
|
|
- The subnet mask for the Grid Member
|
2021-01-11 22:14:46 +01:00
|
|
|
type: str
|
2020-03-09 10:11:07 +01:00
|
|
|
gateway:
|
|
|
|
description:
|
|
|
|
- The default gateway for the Grid Member
|
2021-01-11 22:14:46 +01:00
|
|
|
type: str
|
2020-03-09 10:11:07 +01:00
|
|
|
ipv6_setting:
|
|
|
|
description:
|
|
|
|
- Configures the IPv6 settings for the grid member.
|
2020-11-27 08:01:02 +01:00
|
|
|
type: list
|
|
|
|
elements: dict
|
2020-03-09 10:11:07 +01:00
|
|
|
suboptions:
|
|
|
|
virtual_ip:
|
|
|
|
description:
|
|
|
|
- The IPv6 Address of the Grid Member
|
2021-01-11 22:14:46 +01:00
|
|
|
type: str
|
2020-03-09 10:11:07 +01:00
|
|
|
cidr_prefix:
|
|
|
|
description:
|
|
|
|
- The IPv6 CIDR prefix for the Grid Member
|
2021-01-11 22:14:46 +01:00
|
|
|
type: int
|
2020-03-09 10:11:07 +01:00
|
|
|
gateway:
|
|
|
|
description:
|
|
|
|
- The gateway address for the Grid Member
|
2021-01-11 22:14:46 +01:00
|
|
|
type: str
|
2020-03-09 10:11:07 +01:00
|
|
|
config_addr_type:
|
|
|
|
description:
|
|
|
|
- Address configuration type (IPV4/IPV6/BOTH)
|
|
|
|
default: IPV4
|
2021-01-11 22:14:46 +01:00
|
|
|
type: str
|
2020-03-09 10:11:07 +01:00
|
|
|
comment:
|
|
|
|
description:
|
|
|
|
- A descriptive comment of the Grid member.
|
2021-01-11 22:14:46 +01:00
|
|
|
type: str
|
2020-03-09 10:11:07 +01:00
|
|
|
extattrs:
|
|
|
|
description:
|
|
|
|
- Extensible attributes associated with the object.
|
2021-01-11 22:14:46 +01:00
|
|
|
type: dict
|
2020-03-09 10:11:07 +01:00
|
|
|
enable_ha:
|
|
|
|
description:
|
|
|
|
- If set to True, the member has two physical nodes (HA pair).
|
|
|
|
type: bool
|
2021-01-11 22:14:46 +01:00
|
|
|
default: false
|
2020-03-09 10:11:07 +01:00
|
|
|
router_id:
|
|
|
|
description:
|
|
|
|
- Virtual router identifier. Provide this ID if "ha_enabled" is set to "true". This is a unique VRID number (from 1 to 255) for the local subnet.
|
2021-01-11 22:14:46 +01:00
|
|
|
type: int
|
2020-03-09 10:11:07 +01:00
|
|
|
lan2_enabled:
|
|
|
|
description:
|
|
|
|
- When set to "true", the LAN2 port is enabled as an independent port or as a port for failover purposes.
|
|
|
|
type: bool
|
2021-01-11 22:14:46 +01:00
|
|
|
default: false
|
2020-03-09 10:11:07 +01:00
|
|
|
lan2_port_setting:
|
|
|
|
description:
|
|
|
|
- Settings for the Grid member LAN2 port if 'lan2_enabled' is set to "true".
|
2020-11-27 08:01:02 +01:00
|
|
|
type: list
|
|
|
|
elements: dict
|
2020-03-09 10:11:07 +01:00
|
|
|
suboptions:
|
|
|
|
enabled:
|
|
|
|
description:
|
|
|
|
- If set to True, then it has its own IP settings.
|
|
|
|
type: bool
|
|
|
|
network_setting:
|
|
|
|
description:
|
|
|
|
- If the 'enable' field is set to True, this defines IPv4 network settings for LAN2.
|
2020-11-27 08:01:02 +01:00
|
|
|
type: list
|
|
|
|
elements: dict
|
2020-03-09 10:11:07 +01:00
|
|
|
suboptions:
|
|
|
|
address:
|
|
|
|
description:
|
|
|
|
- The IPv4 Address of LAN2
|
2021-01-11 22:14:46 +01:00
|
|
|
type: str
|
2020-03-09 10:11:07 +01:00
|
|
|
subnet_mask:
|
|
|
|
description:
|
|
|
|
- The subnet mask of LAN2
|
2021-01-11 22:14:46 +01:00
|
|
|
type: str
|
2020-03-09 10:11:07 +01:00
|
|
|
gateway:
|
|
|
|
description:
|
|
|
|
- The default gateway of LAN2
|
2021-01-11 22:14:46 +01:00
|
|
|
type: str
|
2020-03-09 10:11:07 +01:00
|
|
|
v6_network_setting:
|
|
|
|
description:
|
|
|
|
- If the 'enable' field is set to True, this defines IPv6 network settings for LAN2.
|
2020-11-27 08:01:02 +01:00
|
|
|
type: list
|
|
|
|
elements: dict
|
2020-03-09 10:11:07 +01:00
|
|
|
suboptions:
|
|
|
|
virtual_ip:
|
|
|
|
description:
|
|
|
|
- The IPv6 Address of LAN2
|
2021-01-11 22:14:46 +01:00
|
|
|
type: str
|
2020-03-09 10:11:07 +01:00
|
|
|
cidr_prefix:
|
|
|
|
description:
|
|
|
|
- The IPv6 CIDR prefix of LAN2
|
2021-01-11 22:14:46 +01:00
|
|
|
type: int
|
2020-03-09 10:11:07 +01:00
|
|
|
gateway:
|
|
|
|
description:
|
|
|
|
- The gateway address of LAN2
|
2021-01-11 22:14:46 +01:00
|
|
|
type: str
|
2020-03-09 10:11:07 +01:00
|
|
|
platform:
|
|
|
|
description:
|
|
|
|
- Configures the Hardware Platform.
|
|
|
|
default: INFOBLOX
|
2021-01-11 22:14:46 +01:00
|
|
|
type: str
|
2020-03-09 10:11:07 +01:00
|
|
|
node_info:
|
|
|
|
description:
|
|
|
|
- Configures the node information list with detailed status report on the operations of the Grid Member.
|
2020-11-27 08:01:02 +01:00
|
|
|
type: list
|
|
|
|
elements: dict
|
2020-03-09 10:11:07 +01:00
|
|
|
suboptions:
|
|
|
|
lan2_physical_setting:
|
|
|
|
description:
|
|
|
|
- Physical port settings for the LAN2 interface.
|
2020-11-27 08:01:02 +01:00
|
|
|
type: list
|
|
|
|
elements: dict
|
2020-03-09 10:11:07 +01:00
|
|
|
suboptions:
|
|
|
|
auto_port_setting_enabled:
|
|
|
|
description:
|
|
|
|
- Enable or disalbe the auto port setting.
|
|
|
|
type: bool
|
|
|
|
duplex:
|
|
|
|
description:
|
|
|
|
- The port duplex; if speed is 1000, duplex must be FULL.
|
2021-01-11 22:14:46 +01:00
|
|
|
type: str
|
2020-03-09 10:11:07 +01:00
|
|
|
speed:
|
|
|
|
description:
|
|
|
|
- The port speed; if speed is 1000, duplex is FULL.
|
2021-01-11 22:14:46 +01:00
|
|
|
type: str
|
2020-03-09 10:11:07 +01:00
|
|
|
lan_ha_port_setting:
|
|
|
|
description:
|
|
|
|
- LAN/HA port settings for the node.
|
2020-11-27 08:01:02 +01:00
|
|
|
type: list
|
|
|
|
elements: dict
|
2020-03-09 10:11:07 +01:00
|
|
|
suboptions:
|
|
|
|
ha_ip_address:
|
|
|
|
description:
|
|
|
|
- HA IP address.
|
2021-01-11 22:14:46 +01:00
|
|
|
type: str
|
2020-03-09 10:11:07 +01:00
|
|
|
ha_port_setting:
|
|
|
|
description:
|
|
|
|
- Physical port settings for the HA interface.
|
2020-11-27 08:01:02 +01:00
|
|
|
type: list
|
|
|
|
elements: dict
|
2020-03-09 10:11:07 +01:00
|
|
|
suboptions:
|
|
|
|
auto_port_setting_enabled:
|
|
|
|
description:
|
|
|
|
- Enable or disalbe the auto port setting.
|
|
|
|
type: bool
|
|
|
|
duplex:
|
|
|
|
description:
|
|
|
|
- The port duplex; if speed is 1000, duplex must be FULL.
|
2021-01-11 22:14:46 +01:00
|
|
|
type: str
|
2020-03-09 10:11:07 +01:00
|
|
|
speed:
|
|
|
|
description:
|
|
|
|
- The port speed; if speed is 1000, duplex is FULL.
|
2021-01-11 22:14:46 +01:00
|
|
|
type: str
|
2020-03-09 10:11:07 +01:00
|
|
|
lan_port_setting:
|
|
|
|
description:
|
|
|
|
- Physical port settings for the LAN interface.
|
2020-11-27 08:01:02 +01:00
|
|
|
type: list
|
|
|
|
elements: dict
|
2020-03-09 10:11:07 +01:00
|
|
|
suboptions:
|
|
|
|
auto_port_setting_enabled:
|
|
|
|
description:
|
|
|
|
- Enable or disalbe the auto port setting.
|
|
|
|
type: bool
|
|
|
|
duplex:
|
|
|
|
description:
|
|
|
|
- The port duplex; if speed is 1000, duplex must be FULL.
|
2021-01-11 22:14:46 +01:00
|
|
|
type: str
|
2020-03-09 10:11:07 +01:00
|
|
|
speed:
|
|
|
|
description:
|
|
|
|
- The port speed; if speed is 1000, duplex is FULL.
|
2021-01-11 22:14:46 +01:00
|
|
|
type: str
|
2020-03-09 10:11:07 +01:00
|
|
|
mgmt_ipv6addr:
|
|
|
|
description:
|
|
|
|
- Public IPv6 address for the LAN1 interface.
|
2021-01-11 22:14:46 +01:00
|
|
|
type: str
|
2020-03-09 10:11:07 +01:00
|
|
|
mgmt_lan:
|
|
|
|
description:
|
|
|
|
- Public IPv4 address for the LAN1 interface.
|
2021-01-11 22:14:46 +01:00
|
|
|
type: str
|
2020-03-09 10:11:07 +01:00
|
|
|
mgmt_network_setting:
|
|
|
|
description:
|
|
|
|
- Network settings for the MGMT port of the node.
|
2020-11-27 08:01:02 +01:00
|
|
|
type: list
|
|
|
|
elements: dict
|
2020-03-09 10:11:07 +01:00
|
|
|
suboptions:
|
|
|
|
address:
|
|
|
|
description:
|
|
|
|
- The IPv4 Address of MGMT
|
2021-01-11 22:14:46 +01:00
|
|
|
type: str
|
2020-03-09 10:11:07 +01:00
|
|
|
subnet_mask:
|
|
|
|
description:
|
|
|
|
- The subnet mask of MGMT
|
2021-01-11 22:14:46 +01:00
|
|
|
type: str
|
2020-03-09 10:11:07 +01:00
|
|
|
gateway:
|
|
|
|
description:
|
|
|
|
- The default gateway of MGMT
|
2021-01-11 22:14:46 +01:00
|
|
|
type: str
|
2020-03-09 10:11:07 +01:00
|
|
|
v6_mgmt_network_setting:
|
|
|
|
description:
|
|
|
|
- The network settings for the IPv6 MGMT port of the node.
|
2020-11-27 08:01:02 +01:00
|
|
|
type: list
|
|
|
|
elements: dict
|
2020-03-09 10:11:07 +01:00
|
|
|
suboptions:
|
|
|
|
virtual_ip:
|
|
|
|
description:
|
|
|
|
- The IPv6 Address of MGMT
|
2021-01-11 22:14:46 +01:00
|
|
|
type: str
|
2020-03-09 10:11:07 +01:00
|
|
|
cidr_prefix:
|
|
|
|
description:
|
|
|
|
- The IPv6 CIDR prefix of MGMT
|
2021-01-11 22:14:46 +01:00
|
|
|
type: int
|
2020-03-09 10:11:07 +01:00
|
|
|
gateway:
|
|
|
|
description:
|
|
|
|
- The gateway address of MGMT
|
2021-01-11 22:14:46 +01:00
|
|
|
type: str
|
2020-03-09 10:11:07 +01:00
|
|
|
mgmt_port_setting:
|
|
|
|
description:
|
|
|
|
- Settings for the member MGMT port.
|
2020-11-27 08:01:02 +01:00
|
|
|
type: list
|
|
|
|
elements: dict
|
2020-03-09 10:11:07 +01:00
|
|
|
suboptions:
|
|
|
|
enabled:
|
|
|
|
description:
|
|
|
|
- Determines if MGMT port settings should be enabled.
|
|
|
|
type: bool
|
|
|
|
security_access_enabled:
|
|
|
|
description:
|
|
|
|
- Determines if security access on the MGMT port is enabled or not.
|
|
|
|
type: bool
|
|
|
|
vpn_enabled:
|
|
|
|
description:
|
|
|
|
- Determines if VPN on the MGMT port is enabled or not.
|
|
|
|
type: bool
|
|
|
|
upgrade_group:
|
|
|
|
description:
|
|
|
|
- The name of the upgrade group to which this Grid member belongs.
|
|
|
|
default: Default
|
2021-01-11 22:14:46 +01:00
|
|
|
type: str
|
2020-03-09 10:11:07 +01:00
|
|
|
use_syslog_proxy_setting:
|
|
|
|
description:
|
|
|
|
- Use flag for external_syslog_server_enable , syslog_servers, syslog_proxy_setting, syslog_size
|
|
|
|
type: bool
|
|
|
|
external_syslog_server_enable:
|
|
|
|
description:
|
|
|
|
- Determines if external syslog servers should be enabled
|
|
|
|
type: bool
|
|
|
|
syslog_servers:
|
|
|
|
description:
|
|
|
|
- The list of external syslog servers.
|
2020-11-27 08:01:02 +01:00
|
|
|
type: list
|
|
|
|
elements: dict
|
2020-03-09 10:11:07 +01:00
|
|
|
suboptions:
|
|
|
|
address:
|
|
|
|
description:
|
|
|
|
- The server address.
|
2021-01-11 22:14:46 +01:00
|
|
|
type: str
|
2020-03-09 10:11:07 +01:00
|
|
|
category_list:
|
|
|
|
description:
|
|
|
|
- The list of all syslog logging categories.
|
2021-01-11 22:14:46 +01:00
|
|
|
type: list
|
|
|
|
elements: str
|
2020-03-09 10:11:07 +01:00
|
|
|
connection_type:
|
|
|
|
description:
|
|
|
|
- The connection type for communicating with this server.(STCP/TCP?UDP)
|
|
|
|
default: UDP
|
2021-01-11 22:14:46 +01:00
|
|
|
type: str
|
2020-03-09 10:11:07 +01:00
|
|
|
local_interface:
|
|
|
|
description:
|
|
|
|
- The local interface through which the appliance sends syslog messages to the syslog server.(ANY/LAN/MGMT)
|
|
|
|
default: ANY
|
2021-01-11 22:14:46 +01:00
|
|
|
type: str
|
2020-03-09 10:11:07 +01:00
|
|
|
message_node_id:
|
|
|
|
description:
|
|
|
|
- Identify the node in the syslog message. (HOSTNAME/IP_HOSTNAME/LAN/MGMT)
|
|
|
|
default: LAN
|
2021-01-11 22:14:46 +01:00
|
|
|
type: str
|
2020-03-09 10:11:07 +01:00
|
|
|
message_source:
|
|
|
|
description:
|
|
|
|
- The source of syslog messages to be sent to the external syslog server.
|
|
|
|
default: ANY
|
2021-01-11 22:14:46 +01:00
|
|
|
type: str
|
2020-03-09 10:11:07 +01:00
|
|
|
only_category_list:
|
|
|
|
description:
|
|
|
|
- The list of selected syslog logging categories. The appliance forwards syslog messages that belong to the selected categories.
|
|
|
|
type: bool
|
|
|
|
port:
|
|
|
|
description:
|
|
|
|
- The port this server listens on.
|
|
|
|
default: 514
|
2021-01-11 22:14:46 +01:00
|
|
|
type: int
|
2020-03-09 10:11:07 +01:00
|
|
|
severity:
|
|
|
|
description:
|
|
|
|
- The severity filter. The appliance sends log messages of the specified severity and above to the external syslog server.
|
|
|
|
default: DEBUG
|
2021-01-11 22:14:46 +01:00
|
|
|
type: str
|
2020-03-09 10:11:07 +01:00
|
|
|
pre_provisioning:
|
|
|
|
description:
|
|
|
|
- Pre-provisioning information.
|
2020-11-27 08:01:02 +01:00
|
|
|
type: list
|
|
|
|
elements: dict
|
2020-03-09 10:11:07 +01:00
|
|
|
suboptions:
|
|
|
|
hardware_info:
|
|
|
|
description:
|
|
|
|
- An array of structures that describe the hardware being pre-provisioned.
|
2020-11-27 08:01:02 +01:00
|
|
|
type: list
|
|
|
|
elements: dict
|
2020-03-09 10:11:07 +01:00
|
|
|
suboptions:
|
|
|
|
hwmodel:
|
|
|
|
description:
|
|
|
|
- Hardware model
|
2021-01-11 22:14:46 +01:00
|
|
|
type: str
|
2020-03-09 10:11:07 +01:00
|
|
|
hwtype:
|
|
|
|
description:
|
|
|
|
- Hardware type.
|
2021-01-11 22:14:46 +01:00
|
|
|
type: str
|
2020-03-09 10:11:07 +01:00
|
|
|
licenses:
|
|
|
|
description:
|
|
|
|
- An array of license types.
|
2021-01-11 22:14:46 +01:00
|
|
|
type: list
|
|
|
|
elements: str
|
2020-03-09 10:11:07 +01:00
|
|
|
create_token:
|
|
|
|
description:
|
|
|
|
- Flag for initiating a create token request for pre-provisioned members.
|
|
|
|
type: bool
|
|
|
|
default: False
|
|
|
|
state:
|
|
|
|
description:
|
|
|
|
- Configures the intended state of the instance of the object on
|
|
|
|
the NIOS server. When this value is set to C(present), the object
|
|
|
|
is configured on the device and when this value is set to C(absent)
|
|
|
|
the value is removed (if necessary) from the device.
|
|
|
|
default: present
|
|
|
|
choices:
|
|
|
|
- present
|
|
|
|
- absent
|
2021-01-11 22:14:46 +01:00
|
|
|
type: str
|
2020-03-09 10:11:07 +01:00
|
|
|
'''
|
|
|
|
|
|
|
|
EXAMPLES = '''
|
2020-05-16 15:07:51 +02:00
|
|
|
- name: Add a member to the grid with IPv4 address
|
2020-07-13 21:50:31 +02:00
|
|
|
community.general.nios_member:
|
2020-03-09 10:11:07 +01:00
|
|
|
host_name: member01.localdomain
|
|
|
|
vip_setting:
|
|
|
|
- address: 192.168.1.100
|
|
|
|
subnet_mask: 255.255.255.0
|
|
|
|
gateway: 192.168.1.1
|
|
|
|
config_addr_type: IPV4
|
|
|
|
platform: VNIOS
|
|
|
|
comment: "Created by Ansible"
|
|
|
|
state: present
|
|
|
|
provider:
|
|
|
|
host: "{{ inventory_hostname_short }}"
|
|
|
|
username: admin
|
|
|
|
password: admin
|
|
|
|
connection: local
|
2020-05-16 15:07:51 +02:00
|
|
|
- name: Add a HA member to the grid
|
2020-07-13 21:50:31 +02:00
|
|
|
community.general.nios_member:
|
2020-03-09 10:11:07 +01:00
|
|
|
host_name: memberha.localdomain
|
|
|
|
vip_setting:
|
|
|
|
- address: 192.168.1.100
|
|
|
|
subnet_mask: 255.255.255.0
|
|
|
|
gateway: 192.168.1.1
|
|
|
|
config_addr_type: IPV4
|
|
|
|
platform: VNIOS
|
|
|
|
enable_ha: true
|
|
|
|
router_id: 150
|
|
|
|
node_info:
|
|
|
|
- lan_ha_port_setting:
|
|
|
|
- ha_ip_address: 192.168.1.70
|
|
|
|
mgmt_lan: 192.168.1.80
|
|
|
|
- lan_ha_port_setting:
|
|
|
|
- ha_ip_address: 192.168.1.71
|
|
|
|
mgmt_lan: 192.168.1.81
|
|
|
|
comment: "Created by Ansible"
|
|
|
|
state: present
|
|
|
|
provider:
|
|
|
|
host: "{{ inventory_hostname_short }}"
|
|
|
|
username: admin
|
|
|
|
password: admin
|
|
|
|
connection: local
|
2020-05-16 15:07:51 +02:00
|
|
|
- name: Update the member with pre-provisioning details specified
|
2020-07-13 21:50:31 +02:00
|
|
|
community.general.nios_member:
|
2020-03-09 10:11:07 +01:00
|
|
|
name: member01.localdomain
|
|
|
|
pre_provisioning:
|
|
|
|
- hardware_info:
|
|
|
|
- hwmodel: IB-VM-820
|
|
|
|
hwtype: IB-VNIOS
|
|
|
|
licenses:
|
|
|
|
- dns
|
|
|
|
- dhcp
|
|
|
|
- enterprise
|
|
|
|
- vnios
|
|
|
|
comment: "Updated by Ansible"
|
|
|
|
state: present
|
|
|
|
provider:
|
|
|
|
host: "{{ inventory_hostname_short }}"
|
|
|
|
username: admin
|
|
|
|
password: admin
|
|
|
|
connection: local
|
2020-05-16 15:07:51 +02:00
|
|
|
- name: Remove the member
|
2020-07-13 21:50:31 +02:00
|
|
|
community.general.nios_member:
|
2020-03-09 10:11:07 +01:00
|
|
|
name: member01.localdomain
|
|
|
|
state: absent
|
|
|
|
provider:
|
|
|
|
host: "{{ inventory_hostname_short }}"
|
|
|
|
username: admin
|
|
|
|
password: admin
|
|
|
|
connection: local
|
|
|
|
'''
|
|
|
|
|
|
|
|
RETURN = ''' # '''
|
|
|
|
|
|
|
|
from ansible.module_utils.basic import AnsibleModule
|
|
|
|
from ansible_collections.community.general.plugins.module_utils.net_tools.nios.api import WapiModule
|
|
|
|
from ansible_collections.community.general.plugins.module_utils.net_tools.nios.api import NIOS_MEMBER
|
2021-01-11 22:14:46 +01:00
|
|
|
from ansible_collections.community.general.plugins.module_utils.net_tools.nios.api import normalize_ib_spec
|
2020-03-09 10:11:07 +01:00
|
|
|
|
|
|
|
|
|
|
|
def main():
|
|
|
|
''' Main entry point for module execution
|
|
|
|
'''
|
|
|
|
ipv4_spec = dict(
|
|
|
|
address=dict(),
|
|
|
|
subnet_mask=dict(),
|
|
|
|
gateway=dict(),
|
|
|
|
)
|
|
|
|
|
|
|
|
ipv6_spec = dict(
|
|
|
|
virtual_ip=dict(),
|
|
|
|
cidr_prefix=dict(type='int'),
|
|
|
|
gateway=dict(),
|
|
|
|
)
|
|
|
|
|
|
|
|
port_spec = dict(
|
|
|
|
auto_port_setting_enabled=dict(type='bool'),
|
|
|
|
duplex=dict(),
|
|
|
|
speed=dict(),
|
|
|
|
)
|
|
|
|
|
|
|
|
lan2_port_spec = dict(
|
|
|
|
enabled=dict(type='bool'),
|
|
|
|
network_setting=dict(type='list', elements='dict', options=ipv4_spec),
|
|
|
|
v6_network_setting=dict(type='list', elements='dict', options=ipv6_spec),
|
|
|
|
)
|
|
|
|
|
|
|
|
ha_port_spec = dict(
|
|
|
|
ha_ip_address=dict(),
|
|
|
|
ha_port_setting=dict(type='list', elements='dict', options=port_spec),
|
|
|
|
lan_port_setting=dict(type='list', elements='dict', options=port_spec),
|
|
|
|
mgmt_lan=dict(),
|
|
|
|
mgmt_ipv6addr=dict(),
|
|
|
|
)
|
|
|
|
|
|
|
|
node_spec = dict(
|
|
|
|
lan2_physical_setting=dict(type='list', elements='dict', options=port_spec),
|
|
|
|
lan_ha_port_setting=dict(type='list', elements='dict', options=ha_port_spec),
|
|
|
|
mgmt_network_setting=dict(type='list', elements='dict', options=ipv4_spec),
|
|
|
|
v6_mgmt_network_setting=dict(type='list', elements='dict', options=ipv6_spec),
|
|
|
|
)
|
|
|
|
|
|
|
|
mgmt_port_spec = dict(
|
|
|
|
enabled=dict(type='bool'),
|
|
|
|
security_access_enabled=dict(type='bool'),
|
|
|
|
vpn_enabled=dict(type='bool'),
|
|
|
|
)
|
|
|
|
|
|
|
|
syslog_spec = dict(
|
|
|
|
address=dict(),
|
2021-01-11 22:14:46 +01:00
|
|
|
category_list=dict(type='list', elements='str'),
|
2020-03-09 10:11:07 +01:00
|
|
|
connection_type=dict(default='UDP'),
|
|
|
|
local_interface=dict(default='ANY'),
|
|
|
|
message_node_id=dict(default='LAN'),
|
|
|
|
message_source=dict(default='ANY'),
|
|
|
|
only_category_list=dict(type='bool'),
|
|
|
|
port=dict(type='int', default=514),
|
|
|
|
severity=dict(default='DEBUG'),
|
|
|
|
)
|
|
|
|
|
|
|
|
hw_spec = dict(
|
|
|
|
hwmodel=dict(),
|
|
|
|
hwtype=dict(),
|
|
|
|
)
|
|
|
|
|
|
|
|
pre_prov_spec = dict(
|
|
|
|
hardware_info=dict(type='list', elements='dict', options=hw_spec),
|
2021-01-11 22:14:46 +01:00
|
|
|
licenses=dict(type='list', elements='str'),
|
2020-03-09 10:11:07 +01:00
|
|
|
)
|
|
|
|
|
|
|
|
ib_spec = dict(
|
|
|
|
host_name=dict(required=True, aliases=['name'], ib_req=True),
|
|
|
|
vip_setting=dict(type='list', elements='dict', options=ipv4_spec),
|
|
|
|
ipv6_setting=dict(type='list', elements='dict', options=ipv6_spec),
|
|
|
|
config_addr_type=dict(default='IPV4'),
|
|
|
|
comment=dict(),
|
|
|
|
enable_ha=dict(type='bool', default=False),
|
|
|
|
router_id=dict(type='int'),
|
|
|
|
lan2_enabled=dict(type='bool', default=False),
|
|
|
|
lan2_port_setting=dict(type='list', elements='dict', options=lan2_port_spec),
|
|
|
|
platform=dict(default='INFOBLOX'),
|
|
|
|
node_info=dict(type='list', elements='dict', options=node_spec),
|
|
|
|
mgmt_port_setting=dict(type='list', elements='dict', options=mgmt_port_spec),
|
|
|
|
upgrade_group=dict(default='Default'),
|
|
|
|
use_syslog_proxy_setting=dict(type='bool'),
|
|
|
|
external_syslog_server_enable=dict(type='bool'),
|
|
|
|
syslog_servers=dict(type='list', elements='dict', options=syslog_spec),
|
|
|
|
pre_provisioning=dict(type='list', elements='dict', options=pre_prov_spec),
|
|
|
|
extattrs=dict(type='dict'),
|
|
|
|
create_token=dict(type='bool', default=False),
|
|
|
|
)
|
|
|
|
|
|
|
|
argument_spec = dict(
|
|
|
|
provider=dict(required=True),
|
|
|
|
state=dict(default='present', choices=['present', 'absent'])
|
|
|
|
)
|
|
|
|
|
2021-01-11 22:14:46 +01:00
|
|
|
argument_spec.update(normalize_ib_spec(ib_spec))
|
2020-03-09 10:11:07 +01:00
|
|
|
argument_spec.update(WapiModule.provider_spec)
|
|
|
|
|
|
|
|
module = AnsibleModule(argument_spec=argument_spec,
|
|
|
|
supports_check_mode=True)
|
|
|
|
|
|
|
|
wapi = WapiModule(module)
|
|
|
|
result = wapi.run(NIOS_MEMBER, ib_spec)
|
|
|
|
module.exit_json(**result)
|
|
|
|
|
|
|
|
|
|
|
|
if __name__ == '__main__':
|
|
|
|
main()
|