mirror of
https://github.com/ansible-collections/community.general.git
synced 2026-05-07 22:02:50 +00:00
Fix for updating the name in case of host record and network view and also display meaningful error in case of connection timeout (#40597)
* To fix following github issues 35774, 36574 and 39494 * To fix following github issues 35774, 36574 and 39494 * To fix following github issues 35774, 36574 and 39494 * To fix following github issues 35774, 36574 and 39494 * To fix following github issues 35774, 36574 and 39494 * To fix following github issues 35774, 36574 and 39494 * removed old_name new entry to make ui cleaner * removed old_name new entry to make ui cleaner * removed old_name new entry to make ui cleaner * removed old_name new entry to make ui cleaner * removed old_name new entry to make ui cleaner * removed old_name new entry to make ui cleaner * to resolve the bug 40709 * reslove shippable error * reslove shippable error * reslove shippable error * reslove shippable error * reslove shippable error * reslove shippable error * reslove shippable error * reslove shippable error * reslove shippable error * to fix shippable nios automation error * modified the name input parsing method * modified the name input parsing method * modified the name input parsing method * modified the name input parsing method * modified the name input parsing method * modified the name input parsing method * modified the name input parsing method * modified the name input parsing method * modified the name input parsing method * shippable error fix * shippable error fix * shippable error fix * shippable error fix * shippable error fix * review comment fix * shippable error fix * shippable error fix
This commit is contained in:
@@ -20,14 +20,16 @@ description:
|
||||
- Adds and/or removes instances of DNS view objects from
|
||||
Infoblox NIOS servers. This module manages NIOS C(view) objects
|
||||
using the Infoblox WAPI interface over REST.
|
||||
- Updates instances of DNS view object from Infoblox NIOS servers.
|
||||
requirements:
|
||||
- infoblox_client
|
||||
extends_documentation_fragment: nios
|
||||
options:
|
||||
name:
|
||||
description:
|
||||
- Specifies the name of the DNS view to add and/or remove from the
|
||||
system configuration based on the setting of the C(state) argument.
|
||||
- Specifies the fully qualified hostname to add or remove from
|
||||
the system. User can also update the hostname as it is possible
|
||||
to pass a dict containing I(new_name), I(old_name). See examples.
|
||||
required: true
|
||||
aliases:
|
||||
- view
|
||||
@@ -73,7 +75,6 @@ EXAMPLES = '''
|
||||
username: admin
|
||||
password: admin
|
||||
connection: local
|
||||
|
||||
- name: update the comment for dns view
|
||||
nios_dns_view:
|
||||
name: ansible-dns
|
||||
@@ -84,7 +85,6 @@ EXAMPLES = '''
|
||||
username: admin
|
||||
password: admin
|
||||
connection: local
|
||||
|
||||
- name: remove the dns view instance
|
||||
nios_dns_view:
|
||||
name: ansible-dns
|
||||
@@ -94,12 +94,22 @@ EXAMPLES = '''
|
||||
username: admin
|
||||
password: admin
|
||||
connection: local
|
||||
- name: update the dns view instance
|
||||
nios_dns_view:
|
||||
name: {new_name: ansible-dns-new, old_name: ansible-dns}
|
||||
state: present
|
||||
provider:
|
||||
host: "{{ inventory_hostname_short }}"
|
||||
username: admin
|
||||
password: admin
|
||||
connection: local
|
||||
'''
|
||||
|
||||
RETURN = ''' # '''
|
||||
|
||||
from ansible.module_utils.basic import AnsibleModule
|
||||
from ansible.module_utils.net_tools.nios.api import WapiModule
|
||||
from ansible.module_utils.net_tools.nios.api import NIOS_DNS_VIEW
|
||||
|
||||
|
||||
def main():
|
||||
@@ -125,7 +135,7 @@ def main():
|
||||
supports_check_mode=True)
|
||||
|
||||
wapi = WapiModule(module)
|
||||
result = wapi.run('view', ib_spec)
|
||||
result = wapi.run(NIOS_DNS_VIEW, ib_spec)
|
||||
|
||||
module.exit_json(**result)
|
||||
|
||||
|
||||
@@ -20,6 +20,7 @@ description:
|
||||
- Adds and/or removes instances of host record objects from
|
||||
Infoblox NIOS servers. This module manages NIOS C(record:host) objects
|
||||
using the Infoblox WAPI interface over REST.
|
||||
- Updates instances of host record object from Infoblox NIOS servers.
|
||||
requirements:
|
||||
- infoblox_client
|
||||
extends_documentation_fragment: nios
|
||||
@@ -27,7 +28,8 @@ options:
|
||||
name:
|
||||
description:
|
||||
- Specifies the fully qualified hostname to add or remove from
|
||||
the system
|
||||
the system. User can also update the hostname as it is possible
|
||||
to pass a dict containing I(new_name), I(old_name). See examples.
|
||||
required: true
|
||||
view:
|
||||
description:
|
||||
@@ -103,7 +105,6 @@ EXAMPLES = '''
|
||||
username: admin
|
||||
password: admin
|
||||
connection: local
|
||||
|
||||
- name: add a comment to an existing host record
|
||||
nios_host_record:
|
||||
name: host.ansible.com
|
||||
@@ -116,7 +117,6 @@ EXAMPLES = '''
|
||||
username: admin
|
||||
password: admin
|
||||
connection: local
|
||||
|
||||
- name: remove a host record from the system
|
||||
nios_host_record:
|
||||
name: host.ansible.com
|
||||
@@ -126,6 +126,17 @@ EXAMPLES = '''
|
||||
username: admin
|
||||
password: admin
|
||||
connection: local
|
||||
- name: update an ipv4 host record
|
||||
nios_host_record:
|
||||
name: {new_name: host-new.ansible.com, old_name: host.ansible.com}
|
||||
ipv4:
|
||||
- address: 192.168.10.1
|
||||
state: present
|
||||
provider:
|
||||
host: "{{ inventory_hostname_short }}"
|
||||
username: admin
|
||||
password: admin
|
||||
connection: local
|
||||
'''
|
||||
|
||||
RETURN = ''' # '''
|
||||
@@ -133,19 +144,17 @@ RETURN = ''' # '''
|
||||
from ansible.module_utils.basic import AnsibleModule
|
||||
from ansible.module_utils.six import iteritems
|
||||
from ansible.module_utils.net_tools.nios.api import WapiModule
|
||||
from ansible.module_utils.net_tools.nios.api import NIOS_HOST_RECORD
|
||||
|
||||
|
||||
def ipaddr(module, key, filtered_keys=None):
|
||||
''' Transforms the input value into a struct supported by WAPI
|
||||
|
||||
This function will transform the input from the playbook into a struct
|
||||
that is valid for WAPI in the form of:
|
||||
|
||||
{
|
||||
ipv4addr: <value>,
|
||||
mac: <value>
|
||||
}
|
||||
|
||||
This function does not validate the values are properly formatted or in
|
||||
the acceptable range, that is left to WAPI.
|
||||
'''
|
||||
@@ -201,7 +210,7 @@ def main():
|
||||
supports_check_mode=True)
|
||||
|
||||
wapi = WapiModule(module)
|
||||
result = wapi.run('record:host', ib_spec)
|
||||
result = wapi.run(NIOS_HOST_RECORD, ib_spec)
|
||||
|
||||
module.exit_json(**result)
|
||||
|
||||
|
||||
@@ -98,7 +98,6 @@ EXAMPLES = '''
|
||||
username: admin
|
||||
password: admin
|
||||
connection: local
|
||||
|
||||
- name: configure a network ipv6
|
||||
nios_network:
|
||||
network: fe80::/64
|
||||
@@ -109,7 +108,6 @@ EXAMPLES = '''
|
||||
username: admin
|
||||
password: admin
|
||||
connection: local
|
||||
|
||||
- name: set dhcp options for a network ipv4
|
||||
nios_network:
|
||||
network: 192.168.10.0/24
|
||||
@@ -123,7 +121,6 @@ EXAMPLES = '''
|
||||
username: admin
|
||||
password: admin
|
||||
connection: local
|
||||
|
||||
- name: remove a network ipv4
|
||||
nios_network:
|
||||
network: 192.168.10.0/24
|
||||
@@ -141,14 +138,14 @@ from ansible.module_utils.basic import AnsibleModule
|
||||
from ansible.module_utils.six import iteritems
|
||||
from ansible.module_utils.net_tools.nios.api import WapiModule
|
||||
from ansible.module_utils.network.common.utils import validate_ip_address, validate_ip_v6_address
|
||||
from ansible.module_utils.net_tools.nios.api import NIOS_IPV4_NETWORK
|
||||
from ansible.module_utils.net_tools.nios.api import NIOS_IPV6_NETWORK
|
||||
|
||||
|
||||
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>,
|
||||
@@ -156,11 +153,9 @@ def options(module):
|
||||
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()
|
||||
@@ -178,9 +173,9 @@ def check_ip_addr_type(ip):
|
||||
check_ip = ip.split('/')
|
||||
|
||||
if validate_ip_address(check_ip[0]):
|
||||
return 'network'
|
||||
return NIOS_IPV4_NETWORK
|
||||
elif validate_ip_v6_address(check_ip[0]):
|
||||
return 'ipv6network'
|
||||
return NIOS_IPV6_NETWORK
|
||||
|
||||
|
||||
def main():
|
||||
|
||||
@@ -20,14 +20,16 @@ description:
|
||||
- Adds and/or removes instances of network view objects from
|
||||
Infoblox NIOS servers. This module manages NIOS C(networkview) objects
|
||||
using the Infoblox WAPI interface over REST.
|
||||
- Updates instances of network view object from Infoblox NIOS servers.
|
||||
requirements:
|
||||
- infoblox_client
|
||||
extends_documentation_fragment: nios
|
||||
options:
|
||||
name:
|
||||
description:
|
||||
- Specifies the name of the network view to either add or remove
|
||||
from the configuration.
|
||||
- Specifies the fully qualified hostname to add or remove from
|
||||
the system. User can also update the hostname as it is possible
|
||||
to pass a dict containing I(new_name), I(old_name). See examples.
|
||||
required: true
|
||||
aliases:
|
||||
- network_view
|
||||
@@ -63,7 +65,6 @@ EXAMPLES = '''
|
||||
username: admin
|
||||
password: admin
|
||||
connection: local
|
||||
|
||||
- name: update the comment for network view
|
||||
nios_network_view:
|
||||
name: ansible
|
||||
@@ -74,7 +75,6 @@ EXAMPLES = '''
|
||||
username: admin
|
||||
password: admin
|
||||
connection: local
|
||||
|
||||
- name: remove the network view
|
||||
nios_network_view:
|
||||
name: ansible
|
||||
@@ -84,12 +84,22 @@ EXAMPLES = '''
|
||||
username: admin
|
||||
password: admin
|
||||
connection: local
|
||||
- name: update a existing network view
|
||||
nios_network_view:
|
||||
name: {new_name: ansible-new, old_name: ansible}
|
||||
state: present
|
||||
provider:
|
||||
host: "{{ inventory_hostname_short }}"
|
||||
username: admin
|
||||
password: admin
|
||||
connection: local
|
||||
'''
|
||||
|
||||
RETURN = ''' # '''
|
||||
|
||||
from ansible.module_utils.basic import AnsibleModule
|
||||
from ansible.module_utils.net_tools.nios.api import WapiModule
|
||||
from ansible.module_utils.net_tools.nios.api import NIOS_NETWORK_VIEW
|
||||
|
||||
|
||||
def main():
|
||||
@@ -97,7 +107,6 @@ def main():
|
||||
'''
|
||||
ib_spec = dict(
|
||||
name=dict(required=True, aliases=['network_view'], ib_req=True),
|
||||
|
||||
extattrs=dict(type='dict'),
|
||||
comment=dict(),
|
||||
)
|
||||
@@ -114,7 +123,7 @@ def main():
|
||||
supports_check_mode=True)
|
||||
|
||||
wapi = WapiModule(module)
|
||||
result = wapi.run('networkview', ib_spec)
|
||||
result = wapi.run(NIOS_NETWORK_VIEW, ib_spec)
|
||||
|
||||
module.exit_json(**result)
|
||||
|
||||
|
||||
@@ -115,7 +115,6 @@ EXAMPLES = '''
|
||||
username: admin
|
||||
password: admin
|
||||
connection: local
|
||||
|
||||
- name: update the comment and ext attributes for an existing zone
|
||||
nios_zone:
|
||||
name: ansible.com
|
||||
@@ -128,7 +127,6 @@ EXAMPLES = '''
|
||||
username: admin
|
||||
password: admin
|
||||
connection: local
|
||||
|
||||
- name: remove the dns zone
|
||||
nios_zone:
|
||||
name: ansible.com
|
||||
@@ -144,6 +142,7 @@ RETURN = ''' # '''
|
||||
|
||||
from ansible.module_utils.basic import AnsibleModule
|
||||
from ansible.module_utils.net_tools.nios.api import WapiModule
|
||||
from ansible.module_utils.net_tools.nios.api import NIOS_ZONE
|
||||
|
||||
|
||||
def main():
|
||||
@@ -182,7 +181,7 @@ def main():
|
||||
])
|
||||
|
||||
wapi = WapiModule(module)
|
||||
result = wapi.run('zone_auth', ib_spec)
|
||||
result = wapi.run(NIOS_ZONE, ib_spec)
|
||||
|
||||
module.exit_json(**result)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user