1
0
Fork 0
mirror of https://github.com/ansible-collections/community.general.git synced 2024-09-14 20:13:21 +02:00
community.general/plugins/modules/net_tools/nios/nios_network.py

335 lines
11 KiB
Python
Raw Normal View History

2020-03-09 10:11:07 +01:00
#!/usr/bin/python
# -*- coding: utf-8 -*-
2020-03-09 10:11:07 +01:00
# 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_network
author: "Peter Sprygada (@privateip)"
short_description: Configure Infoblox NIOS network object
deprecated:
why: Please install the infoblox.nios_modules collection and use the corresponding module from it.
alternative: infoblox.nios_modules.nios_network
removed_in: 5.0.0
2020-03-09 10:11:07 +01:00
description:
- Adds and/or removes instances of network objects from
Infoblox NIOS servers. This module manages NIOS C(network) objects
using the Infoblox WAPI interface over REST.
- Supports both IPV4 and IPV6 internet protocols
requirements:
- infoblox-client
extends_documentation_fragment:
- community.general.nios
options:
network:
description:
- Specifies the network to add or remove from the system. The value
should use CIDR notation.
required: true
aliases:
- name
- cidr
Tidy up validate-modules ignores for modules: net_tools/nios (#1598) * Added ``normalize_ib_spec()`` * Added suboptions - ``http_pool_connections`` - ``http_pool_maxsize`` - ``silent_ssl_warnings`` * fixed validation-modules for plugins/modules/net_tools/nios/nios_a_record.py * fixed validation-modules for plugins/modules/net_tools/nios/nios_aaaa_record.py * fixed validation-modules for plugins/modules/net_tools/nios/nios_cname_record.py * fixed validation-modules for plugins/modules/net_tools/nios/nios_dns_view.py * fixed validation-modules for plugins/modules/net_tools/nios/nios_fixed_address.py * fixed validation-modules for plugins/modules/net_tools/nios/nios_host_record.py * fixed validation-modules for plugins/modules/net_tools/nios/nios_member.py * fixed validation-modules for plugins/modules/net_tools/nios/nios_mx_record.py * fixed validation-modules for plugins/modules/net_tools/nios/nios_naptr_record.py * fixed validation-modules for plugins/modules/net_tools/nios/nios_network.py * fixed validation-modules for plugins/modules/net_tools/nios/nios_network_view.py * fixed validation-modules for plugins/modules/net_tools/nios/nios_ptr_record.py * fixed validation-modules for plugins/modules/net_tools/nios/nios_srv_record.py * fixed validation-modules for plugins/modules/net_tools/nios/nios_txt_record.py * fixed validation-modules for plugins/modules/net_tools/nios/nios_zone.py * fixed validation-modules for plugins/modules/net_tools/nios/nios_nsgroup.py * Added function to normalize the ``ib_spec`` for ansible usage. * Tidy up validate-modules ignores for net_tools/nios modules * Update plugins/modules/net_tools/nios/nios_nsgroup.py Co-authored-by: Felix Fontein <felix@fontein.de> * Update plugins/modules/net_tools/nios/nios_nsgroup.py Co-authored-by: Felix Fontein <felix@fontein.de> * Update plugins/modules/net_tools/nios/nios_nsgroup.py Co-authored-by: Felix Fontein <felix@fontein.de> * Update plugins/modules/net_tools/nios/nios_nsgroup.py Co-authored-by: Felix Fontein <felix@fontein.de> * Update plugins/modules/net_tools/nios/nios_nsgroup.py Co-authored-by: Felix Fontein <felix@fontein.de> * Update plugins/modules/net_tools/nios/nios_nsgroup.py Co-authored-by: Felix Fontein <felix@fontein.de> * fixed missing defaults, per PR tests * added changelog fragment * Update changelogs/fragments/nios-fix-ib_spec.yaml Co-authored-by: Felix Fontein <felix@fontein.de> Co-authored-by: Felix Fontein <felix@fontein.de>
2021-01-11 22:14:46 +01:00
type: str
2020-03-09 10:11:07 +01:00
network_view:
description:
- Configures the name of the network view to associate with this
configured instance.
default: default
Tidy up validate-modules ignores for modules: net_tools/nios (#1598) * Added ``normalize_ib_spec()`` * Added suboptions - ``http_pool_connections`` - ``http_pool_maxsize`` - ``silent_ssl_warnings`` * fixed validation-modules for plugins/modules/net_tools/nios/nios_a_record.py * fixed validation-modules for plugins/modules/net_tools/nios/nios_aaaa_record.py * fixed validation-modules for plugins/modules/net_tools/nios/nios_cname_record.py * fixed validation-modules for plugins/modules/net_tools/nios/nios_dns_view.py * fixed validation-modules for plugins/modules/net_tools/nios/nios_fixed_address.py * fixed validation-modules for plugins/modules/net_tools/nios/nios_host_record.py * fixed validation-modules for plugins/modules/net_tools/nios/nios_member.py * fixed validation-modules for plugins/modules/net_tools/nios/nios_mx_record.py * fixed validation-modules for plugins/modules/net_tools/nios/nios_naptr_record.py * fixed validation-modules for plugins/modules/net_tools/nios/nios_network.py * fixed validation-modules for plugins/modules/net_tools/nios/nios_network_view.py * fixed validation-modules for plugins/modules/net_tools/nios/nios_ptr_record.py * fixed validation-modules for plugins/modules/net_tools/nios/nios_srv_record.py * fixed validation-modules for plugins/modules/net_tools/nios/nios_txt_record.py * fixed validation-modules for plugins/modules/net_tools/nios/nios_zone.py * fixed validation-modules for plugins/modules/net_tools/nios/nios_nsgroup.py * Added function to normalize the ``ib_spec`` for ansible usage. * Tidy up validate-modules ignores for net_tools/nios modules * Update plugins/modules/net_tools/nios/nios_nsgroup.py Co-authored-by: Felix Fontein <felix@fontein.de> * Update plugins/modules/net_tools/nios/nios_nsgroup.py Co-authored-by: Felix Fontein <felix@fontein.de> * Update plugins/modules/net_tools/nios/nios_nsgroup.py Co-authored-by: Felix Fontein <felix@fontein.de> * Update plugins/modules/net_tools/nios/nios_nsgroup.py Co-authored-by: Felix Fontein <felix@fontein.de> * Update plugins/modules/net_tools/nios/nios_nsgroup.py Co-authored-by: Felix Fontein <felix@fontein.de> * Update plugins/modules/net_tools/nios/nios_nsgroup.py Co-authored-by: Felix Fontein <felix@fontein.de> * fixed missing defaults, per PR tests * added changelog fragment * Update changelogs/fragments/nios-fix-ib_spec.yaml Co-authored-by: Felix Fontein <felix@fontein.de> Co-authored-by: Felix Fontein <felix@fontein.de>
2021-01-11 22:14:46 +01:00
type: str
2020-03-09 10:11:07 +01:00
options:
description:
- Configures the set of DHCP options to be included as part of
the configured network instance. This argument accepts a list
of values (see suboptions). When configuring suboptions at
least one of C(name) or C(num) must be specified.
type: list
elements: dict
2020-03-09 10:11:07 +01:00
suboptions:
name:
description:
- The name of the DHCP option to configure. The standard options are
C(router), C(router-templates), C(domain-name-servers), C(domain-name),
C(broadcast-address), C(broadcast-address-offset), C(dhcp-lease-time),
and C(dhcp6.name-servers).
Tidy up validate-modules ignores for modules: net_tools/nios (#1598) * Added ``normalize_ib_spec()`` * Added suboptions - ``http_pool_connections`` - ``http_pool_maxsize`` - ``silent_ssl_warnings`` * fixed validation-modules for plugins/modules/net_tools/nios/nios_a_record.py * fixed validation-modules for plugins/modules/net_tools/nios/nios_aaaa_record.py * fixed validation-modules for plugins/modules/net_tools/nios/nios_cname_record.py * fixed validation-modules for plugins/modules/net_tools/nios/nios_dns_view.py * fixed validation-modules for plugins/modules/net_tools/nios/nios_fixed_address.py * fixed validation-modules for plugins/modules/net_tools/nios/nios_host_record.py * fixed validation-modules for plugins/modules/net_tools/nios/nios_member.py * fixed validation-modules for plugins/modules/net_tools/nios/nios_mx_record.py * fixed validation-modules for plugins/modules/net_tools/nios/nios_naptr_record.py * fixed validation-modules for plugins/modules/net_tools/nios/nios_network.py * fixed validation-modules for plugins/modules/net_tools/nios/nios_network_view.py * fixed validation-modules for plugins/modules/net_tools/nios/nios_ptr_record.py * fixed validation-modules for plugins/modules/net_tools/nios/nios_srv_record.py * fixed validation-modules for plugins/modules/net_tools/nios/nios_txt_record.py * fixed validation-modules for plugins/modules/net_tools/nios/nios_zone.py * fixed validation-modules for plugins/modules/net_tools/nios/nios_nsgroup.py * Added function to normalize the ``ib_spec`` for ansible usage. * Tidy up validate-modules ignores for net_tools/nios modules * Update plugins/modules/net_tools/nios/nios_nsgroup.py Co-authored-by: Felix Fontein <felix@fontein.de> * Update plugins/modules/net_tools/nios/nios_nsgroup.py Co-authored-by: Felix Fontein <felix@fontein.de> * Update plugins/modules/net_tools/nios/nios_nsgroup.py Co-authored-by: Felix Fontein <felix@fontein.de> * Update plugins/modules/net_tools/nios/nios_nsgroup.py Co-authored-by: Felix Fontein <felix@fontein.de> * Update plugins/modules/net_tools/nios/nios_nsgroup.py Co-authored-by: Felix Fontein <felix@fontein.de> * Update plugins/modules/net_tools/nios/nios_nsgroup.py Co-authored-by: Felix Fontein <felix@fontein.de> * fixed missing defaults, per PR tests * added changelog fragment * Update changelogs/fragments/nios-fix-ib_spec.yaml Co-authored-by: Felix Fontein <felix@fontein.de> Co-authored-by: Felix Fontein <felix@fontein.de>
2021-01-11 22:14:46 +01:00
type: str
2020-03-09 10:11:07 +01:00
num:
description:
- The number of the DHCP option to configure
Tidy up validate-modules ignores for modules: net_tools/nios (#1598) * Added ``normalize_ib_spec()`` * Added suboptions - ``http_pool_connections`` - ``http_pool_maxsize`` - ``silent_ssl_warnings`` * fixed validation-modules for plugins/modules/net_tools/nios/nios_a_record.py * fixed validation-modules for plugins/modules/net_tools/nios/nios_aaaa_record.py * fixed validation-modules for plugins/modules/net_tools/nios/nios_cname_record.py * fixed validation-modules for plugins/modules/net_tools/nios/nios_dns_view.py * fixed validation-modules for plugins/modules/net_tools/nios/nios_fixed_address.py * fixed validation-modules for plugins/modules/net_tools/nios/nios_host_record.py * fixed validation-modules for plugins/modules/net_tools/nios/nios_member.py * fixed validation-modules for plugins/modules/net_tools/nios/nios_mx_record.py * fixed validation-modules for plugins/modules/net_tools/nios/nios_naptr_record.py * fixed validation-modules for plugins/modules/net_tools/nios/nios_network.py * fixed validation-modules for plugins/modules/net_tools/nios/nios_network_view.py * fixed validation-modules for plugins/modules/net_tools/nios/nios_ptr_record.py * fixed validation-modules for plugins/modules/net_tools/nios/nios_srv_record.py * fixed validation-modules for plugins/modules/net_tools/nios/nios_txt_record.py * fixed validation-modules for plugins/modules/net_tools/nios/nios_zone.py * fixed validation-modules for plugins/modules/net_tools/nios/nios_nsgroup.py * Added function to normalize the ``ib_spec`` for ansible usage. * Tidy up validate-modules ignores for net_tools/nios modules * Update plugins/modules/net_tools/nios/nios_nsgroup.py Co-authored-by: Felix Fontein <felix@fontein.de> * Update plugins/modules/net_tools/nios/nios_nsgroup.py Co-authored-by: Felix Fontein <felix@fontein.de> * Update plugins/modules/net_tools/nios/nios_nsgroup.py Co-authored-by: Felix Fontein <felix@fontein.de> * Update plugins/modules/net_tools/nios/nios_nsgroup.py Co-authored-by: Felix Fontein <felix@fontein.de> * Update plugins/modules/net_tools/nios/nios_nsgroup.py Co-authored-by: Felix Fontein <felix@fontein.de> * Update plugins/modules/net_tools/nios/nios_nsgroup.py Co-authored-by: Felix Fontein <felix@fontein.de> * fixed missing defaults, per PR tests * added changelog fragment * Update changelogs/fragments/nios-fix-ib_spec.yaml Co-authored-by: Felix Fontein <felix@fontein.de> Co-authored-by: Felix Fontein <felix@fontein.de>
2021-01-11 22:14:46 +01:00
type: int
2020-03-09 10:11:07 +01:00
value:
description:
- The value of the DHCP option specified by C(name)
required: true
Tidy up validate-modules ignores for modules: net_tools/nios (#1598) * Added ``normalize_ib_spec()`` * Added suboptions - ``http_pool_connections`` - ``http_pool_maxsize`` - ``silent_ssl_warnings`` * fixed validation-modules for plugins/modules/net_tools/nios/nios_a_record.py * fixed validation-modules for plugins/modules/net_tools/nios/nios_aaaa_record.py * fixed validation-modules for plugins/modules/net_tools/nios/nios_cname_record.py * fixed validation-modules for plugins/modules/net_tools/nios/nios_dns_view.py * fixed validation-modules for plugins/modules/net_tools/nios/nios_fixed_address.py * fixed validation-modules for plugins/modules/net_tools/nios/nios_host_record.py * fixed validation-modules for plugins/modules/net_tools/nios/nios_member.py * fixed validation-modules for plugins/modules/net_tools/nios/nios_mx_record.py * fixed validation-modules for plugins/modules/net_tools/nios/nios_naptr_record.py * fixed validation-modules for plugins/modules/net_tools/nios/nios_network.py * fixed validation-modules for plugins/modules/net_tools/nios/nios_network_view.py * fixed validation-modules for plugins/modules/net_tools/nios/nios_ptr_record.py * fixed validation-modules for plugins/modules/net_tools/nios/nios_srv_record.py * fixed validation-modules for plugins/modules/net_tools/nios/nios_txt_record.py * fixed validation-modules for plugins/modules/net_tools/nios/nios_zone.py * fixed validation-modules for plugins/modules/net_tools/nios/nios_nsgroup.py * Added function to normalize the ``ib_spec`` for ansible usage. * Tidy up validate-modules ignores for net_tools/nios modules * Update plugins/modules/net_tools/nios/nios_nsgroup.py Co-authored-by: Felix Fontein <felix@fontein.de> * Update plugins/modules/net_tools/nios/nios_nsgroup.py Co-authored-by: Felix Fontein <felix@fontein.de> * Update plugins/modules/net_tools/nios/nios_nsgroup.py Co-authored-by: Felix Fontein <felix@fontein.de> * Update plugins/modules/net_tools/nios/nios_nsgroup.py Co-authored-by: Felix Fontein <felix@fontein.de> * Update plugins/modules/net_tools/nios/nios_nsgroup.py Co-authored-by: Felix Fontein <felix@fontein.de> * Update plugins/modules/net_tools/nios/nios_nsgroup.py Co-authored-by: Felix Fontein <felix@fontein.de> * fixed missing defaults, per PR tests * added changelog fragment * Update changelogs/fragments/nios-fix-ib_spec.yaml Co-authored-by: Felix Fontein <felix@fontein.de> Co-authored-by: Felix Fontein <felix@fontein.de>
2021-01-11 22:14:46 +01:00
type: str
2020-03-09 10:11:07 +01:00
use_option:
description:
- Only applies to a subset of options (see NIOS API documentation)
type: bool
default: 'yes'
vendor_class:
description:
- The name of the space this DHCP option is associated to
default: DHCP
Tidy up validate-modules ignores for modules: net_tools/nios (#1598) * Added ``normalize_ib_spec()`` * Added suboptions - ``http_pool_connections`` - ``http_pool_maxsize`` - ``silent_ssl_warnings`` * fixed validation-modules for plugins/modules/net_tools/nios/nios_a_record.py * fixed validation-modules for plugins/modules/net_tools/nios/nios_aaaa_record.py * fixed validation-modules for plugins/modules/net_tools/nios/nios_cname_record.py * fixed validation-modules for plugins/modules/net_tools/nios/nios_dns_view.py * fixed validation-modules for plugins/modules/net_tools/nios/nios_fixed_address.py * fixed validation-modules for plugins/modules/net_tools/nios/nios_host_record.py * fixed validation-modules for plugins/modules/net_tools/nios/nios_member.py * fixed validation-modules for plugins/modules/net_tools/nios/nios_mx_record.py * fixed validation-modules for plugins/modules/net_tools/nios/nios_naptr_record.py * fixed validation-modules for plugins/modules/net_tools/nios/nios_network.py * fixed validation-modules for plugins/modules/net_tools/nios/nios_network_view.py * fixed validation-modules for plugins/modules/net_tools/nios/nios_ptr_record.py * fixed validation-modules for plugins/modules/net_tools/nios/nios_srv_record.py * fixed validation-modules for plugins/modules/net_tools/nios/nios_txt_record.py * fixed validation-modules for plugins/modules/net_tools/nios/nios_zone.py * fixed validation-modules for plugins/modules/net_tools/nios/nios_nsgroup.py * Added function to normalize the ``ib_spec`` for ansible usage. * Tidy up validate-modules ignores for net_tools/nios modules * Update plugins/modules/net_tools/nios/nios_nsgroup.py Co-authored-by: Felix Fontein <felix@fontein.de> * Update plugins/modules/net_tools/nios/nios_nsgroup.py Co-authored-by: Felix Fontein <felix@fontein.de> * Update plugins/modules/net_tools/nios/nios_nsgroup.py Co-authored-by: Felix Fontein <felix@fontein.de> * Update plugins/modules/net_tools/nios/nios_nsgroup.py Co-authored-by: Felix Fontein <felix@fontein.de> * Update plugins/modules/net_tools/nios/nios_nsgroup.py Co-authored-by: Felix Fontein <felix@fontein.de> * Update plugins/modules/net_tools/nios/nios_nsgroup.py Co-authored-by: Felix Fontein <felix@fontein.de> * fixed missing defaults, per PR tests * added changelog fragment * Update changelogs/fragments/nios-fix-ib_spec.yaml Co-authored-by: Felix Fontein <felix@fontein.de> Co-authored-by: Felix Fontein <felix@fontein.de>
2021-01-11 22:14:46 +01:00
type: str
2020-03-09 10:11:07 +01:00
extattrs:
description:
- Allows for the configuration of Extensible Attributes on the
instance of the object. This argument accepts a set of key / value
pairs for configuration.
Tidy up validate-modules ignores for modules: net_tools/nios (#1598) * Added ``normalize_ib_spec()`` * Added suboptions - ``http_pool_connections`` - ``http_pool_maxsize`` - ``silent_ssl_warnings`` * fixed validation-modules for plugins/modules/net_tools/nios/nios_a_record.py * fixed validation-modules for plugins/modules/net_tools/nios/nios_aaaa_record.py * fixed validation-modules for plugins/modules/net_tools/nios/nios_cname_record.py * fixed validation-modules for plugins/modules/net_tools/nios/nios_dns_view.py * fixed validation-modules for plugins/modules/net_tools/nios/nios_fixed_address.py * fixed validation-modules for plugins/modules/net_tools/nios/nios_host_record.py * fixed validation-modules for plugins/modules/net_tools/nios/nios_member.py * fixed validation-modules for plugins/modules/net_tools/nios/nios_mx_record.py * fixed validation-modules for plugins/modules/net_tools/nios/nios_naptr_record.py * fixed validation-modules for plugins/modules/net_tools/nios/nios_network.py * fixed validation-modules for plugins/modules/net_tools/nios/nios_network_view.py * fixed validation-modules for plugins/modules/net_tools/nios/nios_ptr_record.py * fixed validation-modules for plugins/modules/net_tools/nios/nios_srv_record.py * fixed validation-modules for plugins/modules/net_tools/nios/nios_txt_record.py * fixed validation-modules for plugins/modules/net_tools/nios/nios_zone.py * fixed validation-modules for plugins/modules/net_tools/nios/nios_nsgroup.py * Added function to normalize the ``ib_spec`` for ansible usage. * Tidy up validate-modules ignores for net_tools/nios modules * Update plugins/modules/net_tools/nios/nios_nsgroup.py Co-authored-by: Felix Fontein <felix@fontein.de> * Update plugins/modules/net_tools/nios/nios_nsgroup.py Co-authored-by: Felix Fontein <felix@fontein.de> * Update plugins/modules/net_tools/nios/nios_nsgroup.py Co-authored-by: Felix Fontein <felix@fontein.de> * Update plugins/modules/net_tools/nios/nios_nsgroup.py Co-authored-by: Felix Fontein <felix@fontein.de> * Update plugins/modules/net_tools/nios/nios_nsgroup.py Co-authored-by: Felix Fontein <felix@fontein.de> * Update plugins/modules/net_tools/nios/nios_nsgroup.py Co-authored-by: Felix Fontein <felix@fontein.de> * fixed missing defaults, per PR tests * added changelog fragment * Update changelogs/fragments/nios-fix-ib_spec.yaml Co-authored-by: Felix Fontein <felix@fontein.de> Co-authored-by: Felix Fontein <felix@fontein.de>
2021-01-11 22:14:46 +01:00
type: dict
2020-03-09 10:11:07 +01:00
comment:
description:
- Configures a text string comment to be associated with the instance
of this object. The provided text string will be configured on the
object instance.
Tidy up validate-modules ignores for modules: net_tools/nios (#1598) * Added ``normalize_ib_spec()`` * Added suboptions - ``http_pool_connections`` - ``http_pool_maxsize`` - ``silent_ssl_warnings`` * fixed validation-modules for plugins/modules/net_tools/nios/nios_a_record.py * fixed validation-modules for plugins/modules/net_tools/nios/nios_aaaa_record.py * fixed validation-modules for plugins/modules/net_tools/nios/nios_cname_record.py * fixed validation-modules for plugins/modules/net_tools/nios/nios_dns_view.py * fixed validation-modules for plugins/modules/net_tools/nios/nios_fixed_address.py * fixed validation-modules for plugins/modules/net_tools/nios/nios_host_record.py * fixed validation-modules for plugins/modules/net_tools/nios/nios_member.py * fixed validation-modules for plugins/modules/net_tools/nios/nios_mx_record.py * fixed validation-modules for plugins/modules/net_tools/nios/nios_naptr_record.py * fixed validation-modules for plugins/modules/net_tools/nios/nios_network.py * fixed validation-modules for plugins/modules/net_tools/nios/nios_network_view.py * fixed validation-modules for plugins/modules/net_tools/nios/nios_ptr_record.py * fixed validation-modules for plugins/modules/net_tools/nios/nios_srv_record.py * fixed validation-modules for plugins/modules/net_tools/nios/nios_txt_record.py * fixed validation-modules for plugins/modules/net_tools/nios/nios_zone.py * fixed validation-modules for plugins/modules/net_tools/nios/nios_nsgroup.py * Added function to normalize the ``ib_spec`` for ansible usage. * Tidy up validate-modules ignores for net_tools/nios modules * Update plugins/modules/net_tools/nios/nios_nsgroup.py Co-authored-by: Felix Fontein <felix@fontein.de> * Update plugins/modules/net_tools/nios/nios_nsgroup.py Co-authored-by: Felix Fontein <felix@fontein.de> * Update plugins/modules/net_tools/nios/nios_nsgroup.py Co-authored-by: Felix Fontein <felix@fontein.de> * Update plugins/modules/net_tools/nios/nios_nsgroup.py Co-authored-by: Felix Fontein <felix@fontein.de> * Update plugins/modules/net_tools/nios/nios_nsgroup.py Co-authored-by: Felix Fontein <felix@fontein.de> * Update plugins/modules/net_tools/nios/nios_nsgroup.py Co-authored-by: Felix Fontein <felix@fontein.de> * fixed missing defaults, per PR tests * added changelog fragment * Update changelogs/fragments/nios-fix-ib_spec.yaml Co-authored-by: Felix Fontein <felix@fontein.de> Co-authored-by: Felix Fontein <felix@fontein.de>
2021-01-11 22:14:46 +01:00
type: str
2020-03-09 10:11:07 +01:00
container:
description:
- If set to true it'll create the network container to be added or removed
from the system.
type: bool
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
Tidy up validate-modules ignores for modules: net_tools/nios (#1598) * Added ``normalize_ib_spec()`` * Added suboptions - ``http_pool_connections`` - ``http_pool_maxsize`` - ``silent_ssl_warnings`` * fixed validation-modules for plugins/modules/net_tools/nios/nios_a_record.py * fixed validation-modules for plugins/modules/net_tools/nios/nios_aaaa_record.py * fixed validation-modules for plugins/modules/net_tools/nios/nios_cname_record.py * fixed validation-modules for plugins/modules/net_tools/nios/nios_dns_view.py * fixed validation-modules for plugins/modules/net_tools/nios/nios_fixed_address.py * fixed validation-modules for plugins/modules/net_tools/nios/nios_host_record.py * fixed validation-modules for plugins/modules/net_tools/nios/nios_member.py * fixed validation-modules for plugins/modules/net_tools/nios/nios_mx_record.py * fixed validation-modules for plugins/modules/net_tools/nios/nios_naptr_record.py * fixed validation-modules for plugins/modules/net_tools/nios/nios_network.py * fixed validation-modules for plugins/modules/net_tools/nios/nios_network_view.py * fixed validation-modules for plugins/modules/net_tools/nios/nios_ptr_record.py * fixed validation-modules for plugins/modules/net_tools/nios/nios_srv_record.py * fixed validation-modules for plugins/modules/net_tools/nios/nios_txt_record.py * fixed validation-modules for plugins/modules/net_tools/nios/nios_zone.py * fixed validation-modules for plugins/modules/net_tools/nios/nios_nsgroup.py * Added function to normalize the ``ib_spec`` for ansible usage. * Tidy up validate-modules ignores for net_tools/nios modules * Update plugins/modules/net_tools/nios/nios_nsgroup.py Co-authored-by: Felix Fontein <felix@fontein.de> * Update plugins/modules/net_tools/nios/nios_nsgroup.py Co-authored-by: Felix Fontein <felix@fontein.de> * Update plugins/modules/net_tools/nios/nios_nsgroup.py Co-authored-by: Felix Fontein <felix@fontein.de> * Update plugins/modules/net_tools/nios/nios_nsgroup.py Co-authored-by: Felix Fontein <felix@fontein.de> * Update plugins/modules/net_tools/nios/nios_nsgroup.py Co-authored-by: Felix Fontein <felix@fontein.de> * Update plugins/modules/net_tools/nios/nios_nsgroup.py Co-authored-by: Felix Fontein <felix@fontein.de> * fixed missing defaults, per PR tests * added changelog fragment * Update changelogs/fragments/nios-fix-ib_spec.yaml Co-authored-by: Felix Fontein <felix@fontein.de> Co-authored-by: Felix Fontein <felix@fontein.de>
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: Configure a network ipv4
community.general.nios_network:
2020-03-09 10:11:07 +01:00
network: 192.168.10.0/24
comment: this is a test comment
state: present
provider:
host: "{{ inventory_hostname_short }}"
username: admin
password: admin
connection: local
2020-05-16 15:07:51 +02:00
- name: Configure a network ipv6
community.general.nios_network:
2020-03-09 10:11:07 +01:00
network: fe80::/64
comment: this is a test comment
state: present
provider:
host: "{{ inventory_hostname_short }}"
username: admin
password: admin
connection: local
2020-05-16 15:07:51 +02:00
- name: Set dhcp options for a network ipv4
community.general.nios_network:
2020-03-09 10:11:07 +01:00
network: 192.168.10.0/24
comment: this is a test comment
options:
- name: domain-name
value: ansible.com
state: present
provider:
host: "{{ inventory_hostname_short }}"
username: admin
password: admin
connection: local
2020-05-16 15:07:51 +02:00
- name: Remove a network ipv4
community.general.nios_network:
2020-03-09 10:11:07 +01:00
network: 192.168.10.0/24
state: absent
provider:
host: "{{ inventory_hostname_short }}"
username: admin
password: admin
connection: local
2020-05-16 15:07:51 +02:00
- name: Configure a ipv4 network container
community.general.nios_network:
2020-03-09 10:11:07 +01:00
network: 192.168.10.0/24
container: true
comment: test network container
state: present
provider:
host: "{{ inventory_hostname_short }}"
username: admin
password: admin
connection: local
2020-05-16 15:07:51 +02:00
- name: Configure a ipv6 network container
community.general.nios_network:
2020-03-09 10:11:07 +01:00
network: fe80::/64
container: true
comment: test network container
state: present
provider:
host: "{{ inventory_hostname_short }}"
username: admin
password: admin
connection: local
2020-05-16 15:07:51 +02:00
- name: Remove a ipv4 network container
community.general.nios_network:
2020-03-09 10:11:07 +01:00
networkr: 192.168.10.0/24
container: true
comment: test network container
state: absent
provider:
host: "{{ inventory_hostname_short }}"
username: admin
password: admin
connection: local
'''
RETURN = ''' # '''
import socket
2020-03-09 10:11:07 +01:00
from ansible.module_utils.basic import AnsibleModule
from ansible.module_utils.six import iteritems
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_IPV4_NETWORK, NIOS_IPV6_NETWORK
from ansible_collections.community.general.plugins.module_utils.net_tools.nios.api import NIOS_IPV4_NETWORK_CONTAINER, NIOS_IPV6_NETWORK_CONTAINER
Tidy up validate-modules ignores for modules: net_tools/nios (#1598) * Added ``normalize_ib_spec()`` * Added suboptions - ``http_pool_connections`` - ``http_pool_maxsize`` - ``silent_ssl_warnings`` * fixed validation-modules for plugins/modules/net_tools/nios/nios_a_record.py * fixed validation-modules for plugins/modules/net_tools/nios/nios_aaaa_record.py * fixed validation-modules for plugins/modules/net_tools/nios/nios_cname_record.py * fixed validation-modules for plugins/modules/net_tools/nios/nios_dns_view.py * fixed validation-modules for plugins/modules/net_tools/nios/nios_fixed_address.py * fixed validation-modules for plugins/modules/net_tools/nios/nios_host_record.py * fixed validation-modules for plugins/modules/net_tools/nios/nios_member.py * fixed validation-modules for plugins/modules/net_tools/nios/nios_mx_record.py * fixed validation-modules for plugins/modules/net_tools/nios/nios_naptr_record.py * fixed validation-modules for plugins/modules/net_tools/nios/nios_network.py * fixed validation-modules for plugins/modules/net_tools/nios/nios_network_view.py * fixed validation-modules for plugins/modules/net_tools/nios/nios_ptr_record.py * fixed validation-modules for plugins/modules/net_tools/nios/nios_srv_record.py * fixed validation-modules for plugins/modules/net_tools/nios/nios_txt_record.py * fixed validation-modules for plugins/modules/net_tools/nios/nios_zone.py * fixed validation-modules for plugins/modules/net_tools/nios/nios_nsgroup.py * Added function to normalize the ``ib_spec`` for ansible usage. * Tidy up validate-modules ignores for net_tools/nios modules * Update plugins/modules/net_tools/nios/nios_nsgroup.py Co-authored-by: Felix Fontein <felix@fontein.de> * Update plugins/modules/net_tools/nios/nios_nsgroup.py Co-authored-by: Felix Fontein <felix@fontein.de> * Update plugins/modules/net_tools/nios/nios_nsgroup.py Co-authored-by: Felix Fontein <felix@fontein.de> * Update plugins/modules/net_tools/nios/nios_nsgroup.py Co-authored-by: Felix Fontein <felix@fontein.de> * Update plugins/modules/net_tools/nios/nios_nsgroup.py Co-authored-by: Felix Fontein <felix@fontein.de> * Update plugins/modules/net_tools/nios/nios_nsgroup.py Co-authored-by: Felix Fontein <felix@fontein.de> * fixed missing defaults, per PR tests * added changelog fragment * Update changelogs/fragments/nios-fix-ib_spec.yaml Co-authored-by: Felix Fontein <felix@fontein.de> Co-authored-by: Felix Fontein <felix@fontein.de>
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
# The following function validate_ip_address has been taken from
# https://github.com/ansible-collections/ansible.netcommon/blob/20124ecbb420daa0f5bb9cdaa865a952657aa0e7/plugins/module_utils/network/common/utils.py#L496
# The code there is licensed under BSD 2-clause.
# Copyright (c) 2016 Red Hat Inc.
def validate_ip_address(address):
try:
socket.inet_aton(address)
except socket.error:
return False
return address.count(".") == 3
# The following function validate_ip_v6_address has been taken from
# https://github.com/ansible-collections/ansible.netcommon/blob/20124ecbb420daa0f5bb9cdaa865a952657aa0e7/plugins/module_utils/network/common/utils.py#L504
# The code there is licensed under BSD 2-clause.
# Copyright (c) 2016 Red Hat Inc.
def validate_ip_v6_address(address):
try:
socket.inet_pton(socket.AF_INET6, address)
except socket.error:
return False
return True
2020-03-09 10:11:07 +01:00
def options(module):
''' Transforms the module argument into a valid WAPI struct
This function will transform the options argument into a structure that
is a valid WAPI structure in the format of:
{
name: <value>,
num: <value>,
value: <value>,
use_option: <value>,
vendor_class: <value>
}
It will remove any options that are set to None since WAPI will error on
that condition. It will also verify that either `name` or `num` is
set in the structure but does not validate the values are equal.
The remainder of the value validation is performed by WAPI
'''
options = list()
for item in module.params['options']:
opt = dict([(k, v) for k, v in iteritems(item) if v is not None])
if 'name' not in opt and 'num' not in opt:
module.fail_json(msg='one of `name` or `num` is required for option value')
options.append(opt)
return options
def check_ip_addr_type(obj_filter, ib_spec):
'''This function will check if the argument ip is type v4/v6 and return appropriate infoblox
network/networkcontainer type
'''
ip = obj_filter['network']
if 'container' in obj_filter and obj_filter['container']:
check_ip = ip.split('/')
del ib_spec['container'] # removing the container key from post arguments
del ib_spec['options'] # removing option argument as for network container it's not supported
if validate_ip_address(check_ip[0]):
return NIOS_IPV4_NETWORK_CONTAINER, ib_spec
elif validate_ip_v6_address(check_ip[0]):
return NIOS_IPV6_NETWORK_CONTAINER, ib_spec
else:
check_ip = ip.split('/')
del ib_spec['container'] # removing the container key from post arguments
if validate_ip_address(check_ip[0]):
return NIOS_IPV4_NETWORK, ib_spec
elif validate_ip_v6_address(check_ip[0]):
return NIOS_IPV6_NETWORK, ib_spec
def check_vendor_specific_dhcp_option(module, ib_spec):
'''This function will check if the argument dhcp option belongs to vendor-specific and if yes then will remove
use_options flag which is not supported with vendor-specific dhcp options.
'''
for key, value in iteritems(ib_spec):
if isinstance(module.params[key], list):
temp_dict = module.params[key][0]
if 'num' in temp_dict:
if temp_dict['num'] in (43, 124, 125):
del module.params[key][0]['use_option']
return ib_spec
def main():
''' Main entry point for module execution
'''
option_spec = dict(
# one of name or num is required; enforced by the function options()
name=dict(),
num=dict(type='int'),
value=dict(required=True),
use_option=dict(type='bool', default=True),
vendor_class=dict(default='DHCP')
)
ib_spec = dict(
network=dict(required=True, aliases=['name', 'cidr'], ib_req=True),
network_view=dict(default='default', ib_req=True),
options=dict(type='list', elements='dict', options=option_spec, transform=options),
extattrs=dict(type='dict'),
comment=dict(),
container=dict(type='bool', ib_req=True)
)
argument_spec = dict(
provider=dict(required=True),
state=dict(default='present', choices=['present', 'absent'])
)
Tidy up validate-modules ignores for modules: net_tools/nios (#1598) * Added ``normalize_ib_spec()`` * Added suboptions - ``http_pool_connections`` - ``http_pool_maxsize`` - ``silent_ssl_warnings`` * fixed validation-modules for plugins/modules/net_tools/nios/nios_a_record.py * fixed validation-modules for plugins/modules/net_tools/nios/nios_aaaa_record.py * fixed validation-modules for plugins/modules/net_tools/nios/nios_cname_record.py * fixed validation-modules for plugins/modules/net_tools/nios/nios_dns_view.py * fixed validation-modules for plugins/modules/net_tools/nios/nios_fixed_address.py * fixed validation-modules for plugins/modules/net_tools/nios/nios_host_record.py * fixed validation-modules for plugins/modules/net_tools/nios/nios_member.py * fixed validation-modules for plugins/modules/net_tools/nios/nios_mx_record.py * fixed validation-modules for plugins/modules/net_tools/nios/nios_naptr_record.py * fixed validation-modules for plugins/modules/net_tools/nios/nios_network.py * fixed validation-modules for plugins/modules/net_tools/nios/nios_network_view.py * fixed validation-modules for plugins/modules/net_tools/nios/nios_ptr_record.py * fixed validation-modules for plugins/modules/net_tools/nios/nios_srv_record.py * fixed validation-modules for plugins/modules/net_tools/nios/nios_txt_record.py * fixed validation-modules for plugins/modules/net_tools/nios/nios_zone.py * fixed validation-modules for plugins/modules/net_tools/nios/nios_nsgroup.py * Added function to normalize the ``ib_spec`` for ansible usage. * Tidy up validate-modules ignores for net_tools/nios modules * Update plugins/modules/net_tools/nios/nios_nsgroup.py Co-authored-by: Felix Fontein <felix@fontein.de> * Update plugins/modules/net_tools/nios/nios_nsgroup.py Co-authored-by: Felix Fontein <felix@fontein.de> * Update plugins/modules/net_tools/nios/nios_nsgroup.py Co-authored-by: Felix Fontein <felix@fontein.de> * Update plugins/modules/net_tools/nios/nios_nsgroup.py Co-authored-by: Felix Fontein <felix@fontein.de> * Update plugins/modules/net_tools/nios/nios_nsgroup.py Co-authored-by: Felix Fontein <felix@fontein.de> * Update plugins/modules/net_tools/nios/nios_nsgroup.py Co-authored-by: Felix Fontein <felix@fontein.de> * fixed missing defaults, per PR tests * added changelog fragment * Update changelogs/fragments/nios-fix-ib_spec.yaml Co-authored-by: Felix Fontein <felix@fontein.de> Co-authored-by: Felix Fontein <felix@fontein.de>
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)
# to get the argument ipaddr
obj_filter = dict([(k, module.params[k]) for k, v in iteritems(ib_spec) if v.get('ib_req')])
network_type, ib_spec = check_ip_addr_type(obj_filter, ib_spec)
wapi = WapiModule(module)
# to check for vendor specific dhcp option
ib_spec = check_vendor_specific_dhcp_option(module, ib_spec)
result = wapi.run(network_type, ib_spec)
module.exit_json(**result)
if __name__ == '__main__':
main()