Skip to content

Commit

Permalink
Changes in inventory and lookup plugins documentation (#85)
Browse files Browse the repository at this point in the history
  • Loading branch information
anagha-infoblox authored Oct 11, 2021
1 parent 2295957 commit 7521e7c
Show file tree
Hide file tree
Showing 4 changed files with 50 additions and 23 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,46 +5,65 @@
# 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)
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: 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:
- 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:
- Accepts a key/value pair and uses it to filter the
host records to be returned.
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
'''
Expand All @@ -58,7 +77,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)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,24 +21,29 @@
options:
_terms:
description: The name of the object to return from 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: a dict object that is used to filter the return objects
description: A dict object that is used to filter the returned objects.
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 extensible attributes.
type: dict
'''

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
Expand Down Expand Up @@ -78,8 +83,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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,15 +20,18 @@
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
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
'''

EXAMPLES = """
Expand Down Expand Up @@ -60,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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 = """
Expand Down Expand Up @@ -65,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
Expand Down

0 comments on commit 7521e7c

Please sign in to comment.