From 226b631ed2ed6c1522ec016b0048014b001c9933 Mon Sep 17 00:00:00 2001 From: anagha-infoblox Date: Thu, 7 Oct 2021 01:07:13 +0530 Subject: [PATCH 1/8] description and name changes in description --- .../plugins/inventory/nios_inventory.py | 26 ++++++++++++++----- .../plugins/lookup/nios_lookup.py | 8 ++++-- .../plugins/lookup/nios_next_ip.py | 3 +++ .../plugins/lookup/nios_next_network.py | 8 ++++-- 4 files changed, 35 insertions(+), 10 deletions(-) diff --git a/ansible_collections/infoblox/nios_modules/plugins/inventory/nios_inventory.py b/ansible_collections/infoblox/nios_modules/plugins/inventory/nios_inventory.py index 984e57bd..746a70e7 100644 --- a/ansible_collections/infoblox/nios_modules/plugins/inventory/nios_inventory.py +++ b/ansible_collections/infoblox/nios_modules/plugins/inventory/nios_inventory.py @@ -5,7 +5,7 @@ # GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) DOCUMENTATION = r''' - name: Infoblox + name: nios_inventory plugin_type: inventory author: - Will Tome (@willtome) @@ -15,19 +15,31 @@ - Infoblox inventory plugin options: host: - description: Infoblox server + description: + - Specifies the DNS host name or address for connecting to the remote + instance of NIOS WAPI over REST. + - Value can also be specified using C(INFOBLOX_HOST) environment + variable. type: string required: True env: - name: INFOBLOX_HOST username: - description: username + description: + - Configures the username to use to authenticate the connection to + the remote instance of NIOS. + - Value can also be specified using C(INFOBLOX_USERNAME) environment + variable. type: string required: True env: - name: INFOBLOX_USERNAME password: - description: password + description: + - Specifies the password to use to authenticate the connection to + the remote instance of NIOS. + - Value can also be specified using C(INFOBLOX_PASSWORD) environment + variable. type: string secret: true env: @@ -35,16 +47,18 @@ extattrs: description: restrict returned hosts by extensible attributes default: {} + type: dict hostfilter: description: restrict returned hosts default: {} + type: dict requirements: - python >= 3.4 - infoblox-client ''' EXAMPLES = r''' -plugin: infoblox +plugin: infoblox.nios_modules.nios_inventory host: blox.example.com username: admin ''' @@ -58,7 +72,7 @@ class InventoryModule(BaseInventoryPlugin): - NAME = 'infoblox' + NAME = 'nios_inventory' def parse(self, inventory, loader, path, cache=True): # Plugin interface (2) super(InventoryModule, self).parse(inventory, loader, path) diff --git a/ansible_collections/infoblox/nios_modules/plugins/lookup/nios_lookup.py b/ansible_collections/infoblox/nios_modules/plugins/lookup/nios_lookup.py index ea7e7315..5d95a18e 100644 --- a/ansible_collections/infoblox/nios_modules/plugins/lookup/nios_lookup.py +++ b/ansible_collections/infoblox/nios_modules/plugins/lookup/nios_lookup.py @@ -23,12 +23,16 @@ _terms: description: The name of the object to return from NIOS required: True + type: str return_fields: description: The list of field names to return for the specified object. + type: list filter: - description: a dict object that is used to filter the return objects + description: A dict object that is used to filter the return objects. + type: dict extattrs: - description: a dict object that is used to filter on extattrs + description: A dict object that is used to filter on extattrs. + type: dict ''' EXAMPLES = """ diff --git a/ansible_collections/infoblox/nios_modules/plugins/lookup/nios_next_ip.py b/ansible_collections/infoblox/nios_modules/plugins/lookup/nios_next_ip.py index 06c3dd1b..f557d7bd 100644 --- a/ansible_collections/infoblox/nios_modules/plugins/lookup/nios_next_ip.py +++ b/ansible_collections/infoblox/nios_modules/plugins/lookup/nios_next_ip.py @@ -22,13 +22,16 @@ _terms: description: The CIDR network to retrieve the next addresses from required: True + type: str num: description: The number of IP addresses to return required: false default: 1 + type: int exclude: description: List of IP's that need to be excluded from returned IP addresses required: false + type: list ''' EXAMPLES = """ diff --git a/ansible_collections/infoblox/nios_modules/plugins/lookup/nios_next_network.py b/ansible_collections/infoblox/nios_modules/plugins/lookup/nios_next_network.py index cbb0723a..fd9a7b29 100644 --- a/ansible_collections/infoblox/nios_modules/plugins/lookup/nios_next_network.py +++ b/ansible_collections/infoblox/nios_modules/plugins/lookup/nios_next_network.py @@ -23,20 +23,24 @@ description: The CIDR network to retrieve the next network from next available network within the specified container. required: True + type: str cidr: description: - The CIDR of the network to retrieve the next network from next available network within the specified container. Also, Requested CIDR must be specified and greater than the parent CIDR. required: True default: 24 + type: str num: - description: The number of network addresses to return from network-container + description: The number of network addresses to return from network-container. required: false default: 1 + type: int exclude: - description: Network addresses returned from network-container excluding list of user's input network range + description: Network addresses returned from network-container excluding list of user's input network range. required: false default: '' + type: list ''' EXAMPLES = """ From 3402b07043bf509c701252e4048aba264c3018cf Mon Sep 17 00:00:00 2001 From: anagha-infoblox Date: Thu, 7 Oct 2021 16:34:39 +0530 Subject: [PATCH 2/8] Changes in description --- .../nios_modules/plugins/inventory/nios_inventory.py | 11 ++++++++--- .../nios_modules/plugins/lookup/nios_lookup.py | 6 +++--- .../nios_modules/plugins/lookup/nios_next_ip.py | 6 +++--- 3 files changed, 14 insertions(+), 9 deletions(-) diff --git a/ansible_collections/infoblox/nios_modules/plugins/inventory/nios_inventory.py b/ansible_collections/infoblox/nios_modules/plugins/inventory/nios_inventory.py index 746a70e7..a7391593 100644 --- a/ansible_collections/infoblox/nios_modules/plugins/inventory/nios_inventory.py +++ b/ansible_collections/infoblox/nios_modules/plugins/inventory/nios_inventory.py @@ -12,7 +12,8 @@ short_description: Infoblox inventory plugin version_added: "1.0.0" description: - - Infoblox inventory plugin + - This plugin allows you to query the Infoblox Grid for host records and + use the response data to populate the inventory file. options: host: description: @@ -45,11 +46,15 @@ env: - name: INFOBLOX_PASSWORD extattrs: - description: restrict returned hosts by extensible attributes + description: + - Allows you to filter the returned host record based on the + extensible attributes assigned to them. default: {} type: dict hostfilter: - description: restrict returned hosts + description: + - This accepts a key/value pair and uses it to filter the + host records to be returned. default: {} type: dict requirements: diff --git a/ansible_collections/infoblox/nios_modules/plugins/lookup/nios_lookup.py b/ansible_collections/infoblox/nios_modules/plugins/lookup/nios_lookup.py index 5d95a18e..7cfdfe49 100644 --- a/ansible_collections/infoblox/nios_modules/plugins/lookup/nios_lookup.py +++ b/ansible_collections/infoblox/nios_modules/plugins/lookup/nios_lookup.py @@ -21,7 +21,7 @@ options: _terms: - description: The name of the object to return from NIOS + description: The name of the object to return from the NIOS. required: True type: str return_fields: @@ -38,11 +38,11 @@ EXAMPLES = """ - name: fetch all networkview objects ansible.builtin.set_fact: - networkviews: "{{ lookup('infoblox.nios_modules.nios', 'networkview', provider={'host': 'nios01', 'username': 'admin', 'password': 'password'}) }}" + networkviews: "{{ lookup('infoblox.nios_modules.nios_lookup', 'networkview', provider={'host': 'nios01', 'username': 'admin', 'password': 'password'}) }}" - name: fetch the default dns view ansible.builtin.set_fact: - dns_views: "{{ lookup('infoblox.nios_modules.nios', 'view', filter={'name': 'default'}, + dns_views: "{{ lookup('infoblox.nios_modules.nios_lookup', 'view', filter={'name': 'default'}, provider={'host': 'nios01', 'username': 'admin', 'password': 'password'}) }}" # all of the examples below use credentials that are set using env variables diff --git a/ansible_collections/infoblox/nios_modules/plugins/lookup/nios_next_ip.py b/ansible_collections/infoblox/nios_modules/plugins/lookup/nios_next_ip.py index f557d7bd..b2747f6b 100644 --- a/ansible_collections/infoblox/nios_modules/plugins/lookup/nios_next_ip.py +++ b/ansible_collections/infoblox/nios_modules/plugins/lookup/nios_next_ip.py @@ -20,16 +20,16 @@ options: _terms: - description: The CIDR network to retrieve the next addresses from + description: The CIDR network to retrieve the next addresses from. required: True type: str num: - description: The number of IP addresses to return + description: The number of IP addresses to return. required: false default: 1 type: int exclude: - description: List of IP's that need to be excluded from returned IP addresses + description: List of IP's that need to be excluded from returned IP addresses. required: false type: list ''' From 9776b8348f2fcfc9158dad3c6eadf2da427104c0 Mon Sep 17 00:00:00 2001 From: anagha-infoblox Date: Thu, 7 Oct 2021 16:41:10 +0530 Subject: [PATCH 3/8] Fixed sanity issue --- .../nios_modules/plugins/inventory/nios_inventory.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/ansible_collections/infoblox/nios_modules/plugins/inventory/nios_inventory.py b/ansible_collections/infoblox/nios_modules/plugins/inventory/nios_inventory.py index a7391593..7110186b 100644 --- a/ansible_collections/infoblox/nios_modules/plugins/inventory/nios_inventory.py +++ b/ansible_collections/infoblox/nios_modules/plugins/inventory/nios_inventory.py @@ -12,7 +12,7 @@ short_description: Infoblox inventory plugin version_added: "1.0.0" description: - - This plugin allows you to query the Infoblox Grid for host records and + - This plugin allows you to query the Infoblox Grid for host records and use the response data to populate the inventory file. options: host: @@ -47,13 +47,13 @@ - name: INFOBLOX_PASSWORD extattrs: description: - - Allows you to filter the returned host record based on the + - Allows you to filter the returned host record based on the extensible attributes assigned to them. default: {} type: dict hostfilter: description: - - This accepts a key/value pair and uses it to filter the + - This accepts a key/value pair and uses it to filter the host records to be returned. default: {} type: dict From 54323451fcca63a21957a16b85223469f8dea7f3 Mon Sep 17 00:00:00 2001 From: anagha-infoblox Date: Thu, 7 Oct 2021 16:51:08 +0530 Subject: [PATCH 4/8] remove commented imports --- .../infoblox/nios_modules/plugins/lookup/nios_lookup.py | 2 -- .../infoblox/nios_modules/plugins/lookup/nios_next_ip.py | 1 - .../infoblox/nios_modules/plugins/lookup/nios_next_network.py | 1 - 3 files changed, 4 deletions(-) diff --git a/ansible_collections/infoblox/nios_modules/plugins/lookup/nios_lookup.py b/ansible_collections/infoblox/nios_modules/plugins/lookup/nios_lookup.py index 7cfdfe49..73edc704 100644 --- a/ansible_collections/infoblox/nios_modules/plugins/lookup/nios_lookup.py +++ b/ansible_collections/infoblox/nios_modules/plugins/lookup/nios_lookup.py @@ -82,8 +82,6 @@ """ from ansible.plugins.lookup import LookupBase -# from ansible_collections.community.general.plugins.module_utils.net_tools.nios.api import WapiLookup -# from ansible_collections.community.general.plugins.module_utils.net_tools.nios.api import normalize_extattrs, flatten_extattrs from ansible.errors import AnsibleError from ..module_utils.api import WapiLookup from ..module_utils.api import normalize_extattrs, flatten_extattrs diff --git a/ansible_collections/infoblox/nios_modules/plugins/lookup/nios_next_ip.py b/ansible_collections/infoblox/nios_modules/plugins/lookup/nios_next_ip.py index b2747f6b..0203a076 100644 --- a/ansible_collections/infoblox/nios_modules/plugins/lookup/nios_next_ip.py +++ b/ansible_collections/infoblox/nios_modules/plugins/lookup/nios_next_ip.py @@ -63,7 +63,6 @@ """ from ansible.plugins.lookup import LookupBase -# from ansible_collections.community.general.plugins.module_utils.net_tools.nios.api import WapiLookup from ansible.module_utils._text import to_text from ansible.errors import AnsibleError from ..module_utils.api import WapiLookup diff --git a/ansible_collections/infoblox/nios_modules/plugins/lookup/nios_next_network.py b/ansible_collections/infoblox/nios_modules/plugins/lookup/nios_next_network.py index fd9a7b29..dc7442bd 100644 --- a/ansible_collections/infoblox/nios_modules/plugins/lookup/nios_next_network.py +++ b/ansible_collections/infoblox/nios_modules/plugins/lookup/nios_next_network.py @@ -69,7 +69,6 @@ """ from ansible.plugins.lookup import LookupBase -# from ansible_collections.community.general.plugins.module_utils.net_tools.nios.api import WapiLookup from ansible.module_utils._text import to_text from ansible.errors import AnsibleError from ..module_utils.api import WapiLookup From 1da9cf938a2de65812e93f3dc107136039ca11ce Mon Sep 17 00:00:00 2001 From: anagha-infoblox Date: Thu, 7 Oct 2021 19:48:27 +0530 Subject: [PATCH 5/8] Addressed review comments --- .../infoblox/nios_modules/plugins/lookup/nios_lookup.py | 5 +++-- .../infoblox/nios_modules/plugins/lookup/nios_next_ip.py | 4 ++-- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/ansible_collections/infoblox/nios_modules/plugins/lookup/nios_lookup.py b/ansible_collections/infoblox/nios_modules/plugins/lookup/nios_lookup.py index 73edc704..61667b14 100644 --- a/ansible_collections/infoblox/nios_modules/plugins/lookup/nios_lookup.py +++ b/ansible_collections/infoblox/nios_modules/plugins/lookup/nios_lookup.py @@ -28,10 +28,11 @@ description: The list of field names to return for the specified object. type: list filter: - description: A dict object that is used to filter the return objects. + description: + - The name of the network object to be returned from the Infoblox appliance. type: dict extattrs: - description: A dict object that is used to filter on extattrs. + description: A dict object that is used to filter based on extattrs. type: dict ''' diff --git a/ansible_collections/infoblox/nios_modules/plugins/lookup/nios_next_ip.py b/ansible_collections/infoblox/nios_modules/plugins/lookup/nios_next_ip.py index 0203a076..2e77a866 100644 --- a/ansible_collections/infoblox/nios_modules/plugins/lookup/nios_next_ip.py +++ b/ansible_collections/infoblox/nios_modules/plugins/lookup/nios_next_ip.py @@ -20,11 +20,11 @@ options: _terms: - description: The CIDR network to retrieve the next addresses from. + description: The CIDR network to retrieve the next address(es) from. required: True type: str num: - description: The number of IP addresses to return. + description: The number of IP address(es) to return. required: false default: 1 type: int From e8983b9f24326454ecbab2b81a140409ceb14327 Mon Sep 17 00:00:00 2001 From: anagha-infoblox Date: Thu, 7 Oct 2021 19:51:43 +0530 Subject: [PATCH 6/8] Addressed review comments --- .../infoblox/nios_modules/plugins/lookup/nios_lookup.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/ansible_collections/infoblox/nios_modules/plugins/lookup/nios_lookup.py b/ansible_collections/infoblox/nios_modules/plugins/lookup/nios_lookup.py index 61667b14..5da5c254 100644 --- a/ansible_collections/infoblox/nios_modules/plugins/lookup/nios_lookup.py +++ b/ansible_collections/infoblox/nios_modules/plugins/lookup/nios_lookup.py @@ -21,18 +21,18 @@ options: _terms: - description: The name of the object to return from the NIOS. + description: + - The name of the network object to be returned from the Infoblox appliance. required: True type: str return_fields: description: The list of field names to return for the specified object. type: list filter: - description: - - The name of the network object to be returned from the Infoblox appliance. + description: A dict object that is used to filter the returned objects. type: dict extattrs: - description: A dict object that is used to filter based on extattrs. + description: A dict object that is used to filter based on extensible attributes. type: dict ''' From 51df0e82930a86c52a00a13362d97c37d7e338b3 Mon Sep 17 00:00:00 2001 From: anagha-infoblox Date: Thu, 7 Oct 2021 19:53:28 +0530 Subject: [PATCH 7/8] Fixed sanity error --- .../infoblox/nios_modules/plugins/lookup/nios_lookup.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ansible_collections/infoblox/nios_modules/plugins/lookup/nios_lookup.py b/ansible_collections/infoblox/nios_modules/plugins/lookup/nios_lookup.py index 5da5c254..cfdecd7f 100644 --- a/ansible_collections/infoblox/nios_modules/plugins/lookup/nios_lookup.py +++ b/ansible_collections/infoblox/nios_modules/plugins/lookup/nios_lookup.py @@ -21,7 +21,7 @@ options: _terms: - description: + description: - The name of the network object to be returned from the Infoblox appliance. required: True type: str From 22f37c0346bd94a72fa43746f92996f11639d612 Mon Sep 17 00:00:00 2001 From: anagha-infoblox Date: Thu, 7 Oct 2021 19:58:08 +0530 Subject: [PATCH 8/8] Update nios_inventory.py --- .../infoblox/nios_modules/plugins/inventory/nios_inventory.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ansible_collections/infoblox/nios_modules/plugins/inventory/nios_inventory.py b/ansible_collections/infoblox/nios_modules/plugins/inventory/nios_inventory.py index 7110186b..20817cf2 100644 --- a/ansible_collections/infoblox/nios_modules/plugins/inventory/nios_inventory.py +++ b/ansible_collections/infoblox/nios_modules/plugins/inventory/nios_inventory.py @@ -53,7 +53,7 @@ type: dict hostfilter: description: - - This accepts a key/value pair and uses it to filter the + - Accepts a key/value pair and uses it to filter the host records to be returned. default: {} type: dict