diff --git a/docs/getting_started/contributing/modules/new_module.rst b/docs/getting_started/contributing/modules/new_module.rst index 7e92e557..a51e3538 100644 --- a/docs/getting_started/contributing/modules/new_module.rst +++ b/docs/getting_started/contributing/modules/new_module.rst @@ -99,13 +99,13 @@ It is almost the same as the ``QUERY_TYPE``, but this is used to build the query Create the Module Python File ---------------------------------- -Copy an existing module file from ``plugins/modules`` and name it ``versa_route_target.py``. +Copy an existing module file from ``plugins/modules`` and name it ``route_target.py``. Now we need to update the ``DOCUMENTATION`` variable to match the module we're creating. .. note:: There are builtin options that you shouldn't have to change such as ``url``, ``token``, ``state``, - ``query_params``, and ``validate_certs``. + ``query_params``, and ``validate_certs``. These are added to the documentation automatically with the ``extends_documentation_fragment`` option. .. code-block:: python @@ -123,40 +123,26 @@ Now we need to update the ``DOCUMENTATION`` variable to match the module we're c requirements: - pynautobot version_added: "1.0.0" + extends_documentation_fragment: + - networktocode.nautobot.fragments.base + - networktocode.nautobot.fragments.tags + - networktocode.nautobot.fragments.custom_fields options: - ... - data: - type: dict + name: description: - - Defines the route target configuration - suboptions: - name: - description: - - Route target name - required: true - type: str - tenant: - description: - - The tenant that the route target will be assigned to - required: false - type: raw - description: - description: - - Tag description - required: false - type: str - tags: - description: - - Any tags that the device may need to be associated with - required: false - type: list - custom_fields: - description: - - must exist in Nautobot - required: false - type: dict + - Route target name required: true - ... + type: str + tenant: + description: + - The tenant that the route target will be assigned to + required: false + type: raw + description: + description: + - Tag description + required: false + type: str """ @@ -243,16 +229,18 @@ Now we import the necessary components from the collection that make up the meat .. code-block:: python from ansible_collections.networktocode.nautobot.plugins.module_utils.utils import ( - NautobotAnsibleModule, NAUTOBOT_ARG_SPEC, + TAGS_ARG_SPEC, + CUSTOM_FIELDS_ARG_SPEC, ) from ansible_collections.networktocode.nautobot.plugins.module_utils.ipam import ( NautobotIpamModule, NB_ROUTE_TARGETS, ) + from ansible.module_utils.basic import AnsibleModule from copy import deepcopy -We import our custom ``NautobotAnsibleModule`` to properly validate our data and our base argument spec (``NAUTOBOT_ARG_SPEC``) that all modules should implement. +We import our base argument spec (``NAUTOBOT_ARG_SPEC``) that all modules should implement as well as the argument spec for tags and custom fields since this module will support those as well. .. code-block:: python @@ -262,6 +250,7 @@ We import our custom ``NautobotAnsibleModule`` to properly validate our data and state=dict(required=False, default="present", choices=["present", "absent"]), query_params=dict(required=False, type="list", elements="str"), validate_certs=dict(type="raw", default=True), + api_version=dict(type="str", required=False), ) Let's move onto the ``main()`` function in the module and take a look at the required argument spec. @@ -273,6 +262,8 @@ Let's move onto the ``main()`` function in the module and take a look at the req Main entry point for module execution """ argument_spec = deepcopy(NAUTOBOT_ARG_SPEC) + argument_spec.update(deepcopy(TAGS_ARG_SPEC)) + argument_spec.update(deepcopy(CUSTOM_FIELDS_ARG_SPEC)) argument_spec.update( dict( data=dict( @@ -282,8 +273,6 @@ Let's move onto the ``main()`` function in the module and take a look at the req name=dict(required=True, type="str"), tenant=dict(required=False, type="raw"), description=dict(required=False, type="str"), - tags=dict(required=False, type="list"), - custom_fields=dict(required=False, type="dict"), ), ), ) @@ -296,12 +285,12 @@ the sanity tests that will run when a PR is submitted to the project and both th def main(): ... - module = NautobotAnsibleModule(argument_spec=argument_spec, supports_check_mode=True) + module = AnsibleModule(argument_spec=argument_spec, supports_check_mode=True) route_target = NautobotIpamModule(module, NB_ROUTE_TARGETS) route_target.run() -We then initialize our custom ``NautobotAnsibleModule`` that will be passed into our custom ``NautobotIpamModule`` and then execute the ``run`` method. +We then initialize the standard ``AnsibleModule`` that will be passed into our custom ``NautobotIpamModule`` and then execute the ``run`` method. That is all that our module needs to implement at this point. We can test this locally by installing the collection locally and testing this within a playbook by following the directions :ref:`here`. Here is the output of the a playbook I created using the examples we documented with the only changes being the ``url`` and ``token``. diff --git a/plugins/module_utils/utils.py b/plugins/module_utils/utils.py index bd31b644..979c6a8f 100644 --- a/plugins/module_utils/utils.py +++ b/plugins/module_utils/utils.py @@ -436,6 +436,14 @@ api_version=dict(type="str", required=False), ) +TAGS_ARG_SPEC = dict( + tags=dict(required=False, type="list", elements="raw"), +) + +CUSTOM_FIELDS_ARG_SPEC = dict( + custom_fields=dict(required=False, type="dict"), +) + def is_truthy(arg): """ diff --git a/plugins/modules/circuit.py b/plugins/modules/circuit.py index e6dbdd6a..e1401ff5 100644 --- a/plugins/modules/circuit.py +++ b/plugins/modules/circuit.py @@ -134,7 +134,11 @@ type: str """ -from ansible_collections.networktocode.nautobot.plugins.module_utils.utils import NAUTOBOT_ARG_SPEC +from ansible_collections.networktocode.nautobot.plugins.module_utils.utils import ( + NAUTOBOT_ARG_SPEC, + TAGS_ARG_SPEC, + CUSTOM_FIELDS_ARG_SPEC, +) from ansible_collections.networktocode.nautobot.plugins.module_utils.circuits import ( NautobotCircuitsModule, NB_CIRCUITS, @@ -148,6 +152,8 @@ def main(): Main entry point for module execution """ argument_spec = deepcopy(NAUTOBOT_ARG_SPEC) + argument_spec.update(deepcopy(TAGS_ARG_SPEC)) + argument_spec.update(deepcopy(CUSTOM_FIELDS_ARG_SPEC)) argument_spec.update( dict( cid=dict(required=True, type="str"), @@ -159,8 +165,6 @@ def main(): commit_rate=dict(required=False, type="int"), description=dict(required=False, type="str"), comments=dict(required=False, type="str"), - tags=dict(required=False, type="list", elements="raw"), - custom_fields=dict(required=False, type="dict"), ) ) diff --git a/plugins/modules/cluster.py b/plugins/modules/cluster.py index afeec028..9fee1d42 100644 --- a/plugins/modules/cluster.py +++ b/plugins/modules/cluster.py @@ -118,7 +118,11 @@ type: str """ -from ansible_collections.networktocode.nautobot.plugins.module_utils.utils import NAUTOBOT_ARG_SPEC +from ansible_collections.networktocode.nautobot.plugins.module_utils.utils import ( + NAUTOBOT_ARG_SPEC, + TAGS_ARG_SPEC, + CUSTOM_FIELDS_ARG_SPEC, +) from ansible_collections.networktocode.nautobot.plugins.module_utils.virtualization import ( NautobotVirtualizationModule, NB_CLUSTERS, @@ -132,6 +136,8 @@ def main(): Main entry point for module execution """ argument_spec = deepcopy(NAUTOBOT_ARG_SPEC) + argument_spec.update(deepcopy(TAGS_ARG_SPEC)) + argument_spec.update(deepcopy(CUSTOM_FIELDS_ARG_SPEC)) argument_spec.update( dict( name=dict(required=True, type="str"), @@ -140,8 +146,6 @@ def main(): location=dict(required=False, type="raw"), tenant=dict(required=False, type="raw"), comments=dict(required=False, type="str"), - tags=dict(required=False, type="list", elements="raw"), - custom_fields=dict(required=False, type="dict"), ) ) diff --git a/plugins/modules/console_port.py b/plugins/modules/console_port.py index 672c7ed0..e5801508 100644 --- a/plugins/modules/console_port.py +++ b/plugins/modules/console_port.py @@ -95,7 +95,10 @@ type: str """ -from ansible_collections.networktocode.nautobot.plugins.module_utils.utils import NAUTOBOT_ARG_SPEC +from ansible_collections.networktocode.nautobot.plugins.module_utils.utils import ( + NAUTOBOT_ARG_SPEC, + TAGS_ARG_SPEC, +) from ansible_collections.networktocode.nautobot.plugins.module_utils.dcim import ( NautobotDcimModule, NB_CONSOLE_PORTS, @@ -109,13 +112,13 @@ def main(): Main entry point for module execution """ argument_spec = deepcopy(NAUTOBOT_ARG_SPEC) + argument_spec.update(deepcopy(TAGS_ARG_SPEC)) argument_spec.update( dict( device=dict(required=True, type="raw"), name=dict(required=True, type="str"), type=dict(required=False, type="str"), description=dict(required=False, type="str"), - tags=dict(required=False, type="list", elements="raw"), ) ) diff --git a/plugins/modules/console_server_port.py b/plugins/modules/console_server_port.py index 23b9805a..a884cf21 100644 --- a/plugins/modules/console_server_port.py +++ b/plugins/modules/console_server_port.py @@ -95,7 +95,10 @@ type: str """ -from ansible_collections.networktocode.nautobot.plugins.module_utils.utils import NAUTOBOT_ARG_SPEC +from ansible_collections.networktocode.nautobot.plugins.module_utils.utils import ( + NAUTOBOT_ARG_SPEC, + TAGS_ARG_SPEC, +) from ansible_collections.networktocode.nautobot.plugins.module_utils.dcim import ( NautobotDcimModule, NB_CONSOLE_SERVER_PORTS, @@ -109,13 +112,13 @@ def main(): Main entry point for module execution """ argument_spec = deepcopy(NAUTOBOT_ARG_SPEC) + argument_spec.update(deepcopy(TAGS_ARG_SPEC)) argument_spec.update( dict( device=dict(required=True, type="raw"), name=dict(required=True, type="str"), type=dict(required=False, type="str"), description=dict(required=False, type="str"), - tags=dict(required=False, type="list", elements="raw"), ) ) diff --git a/plugins/modules/contact.py b/plugins/modules/contact.py index 9dfe1450..b76bf21a 100644 --- a/plugins/modules/contact.py +++ b/plugins/modules/contact.py @@ -99,7 +99,11 @@ type: str """ -from ansible_collections.networktocode.nautobot.plugins.module_utils.utils import NAUTOBOT_ARG_SPEC +from ansible_collections.networktocode.nautobot.plugins.module_utils.utils import ( + NAUTOBOT_ARG_SPEC, + TAGS_ARG_SPEC, + CUSTOM_FIELDS_ARG_SPEC, +) from ansible_collections.networktocode.nautobot.plugins.module_utils.extras import ( NautobotExtrasModule, NB_CONTACT, @@ -113,6 +117,8 @@ def main(): Main entry point for module execution """ argument_spec = deepcopy(NAUTOBOT_ARG_SPEC) + argument_spec.update(deepcopy(TAGS_ARG_SPEC)) + argument_spec.update(deepcopy(CUSTOM_FIELDS_ARG_SPEC)) argument_spec.update( dict( name=dict(required=True, type="str"), @@ -121,8 +127,6 @@ def main(): address=dict(required=False, type="str"), teams=dict(required=False, type="list", elements="raw"), comments=dict(required=False, type="str"), - tags=dict(required=False, type="list", elements="raw"), - custom_fields=dict(required=False, type="dict"), ) ) diff --git a/plugins/modules/controller.py b/plugins/modules/controller.py index fd333ae1..6265cf6b 100644 --- a/plugins/modules/controller.py +++ b/plugins/modules/controller.py @@ -127,7 +127,11 @@ type: str """ -from ansible_collections.networktocode.nautobot.plugins.module_utils.utils import NAUTOBOT_ARG_SPEC +from ansible_collections.networktocode.nautobot.plugins.module_utils.utils import ( + NAUTOBOT_ARG_SPEC, + TAGS_ARG_SPEC, + CUSTOM_FIELDS_ARG_SPEC, +) from ansible_collections.networktocode.nautobot.plugins.module_utils.dcim import ( NautobotDcimModule, NB_CONTROLLERS, @@ -141,6 +145,8 @@ def main(): Main entry point for module execution """ argument_spec = deepcopy(NAUTOBOT_ARG_SPEC) + argument_spec.update(deepcopy(TAGS_ARG_SPEC)) + argument_spec.update(deepcopy(CUSTOM_FIELDS_ARG_SPEC)) argument_spec.update( dict( name=dict(required=True, type="str"), @@ -152,8 +158,6 @@ def main(): tenant=dict(required=False, type="raw"), platform=dict(required=False, type="raw"), status=dict(required=False, type="raw"), - tags=dict(required=False, type="list", elements="raw"), - custom_fields=dict(required=False, type="dict"), controller_device_redundancy_group=dict(required=False, type="str"), ) ) diff --git a/plugins/modules/device.py b/plugins/modules/device.py index 243a60ba..3e39e105 100644 --- a/plugins/modules/device.py +++ b/plugins/modules/device.py @@ -243,7 +243,11 @@ type: str """ -from ansible_collections.networktocode.nautobot.plugins.module_utils.utils import NAUTOBOT_ARG_SPEC +from ansible_collections.networktocode.nautobot.plugins.module_utils.utils import ( + NAUTOBOT_ARG_SPEC, + TAGS_ARG_SPEC, + CUSTOM_FIELDS_ARG_SPEC, +) from ansible_collections.networktocode.nautobot.plugins.module_utils.dcim import ( NautobotDcimModule, NB_DEVICES, @@ -258,6 +262,8 @@ def main(): Main entry point for module execution """ argument_spec = deepcopy(NAUTOBOT_ARG_SPEC) + argument_spec.update(deepcopy(TAGS_ARG_SPEC)) + argument_spec.update(deepcopy(CUSTOM_FIELDS_ARG_SPEC)) argument_spec.update( dict( name=dict(required=True, type="str"), @@ -283,9 +289,7 @@ def main(): vc_position=dict(required=False, type="int"), vc_priority=dict(required=False, type="int"), comments=dict(required=False, type="str"), - tags=dict(required=False, type="list", elements="raw"), local_config_context_data=dict(required=False, type="dict"), - custom_fields=dict(required=False, type="dict"), device_redundancy_group=dict(required=False, type="raw"), device_redundancy_group_priority=dict(required=False, type="int"), ) diff --git a/plugins/modules/device_bay.py b/plugins/modules/device_bay.py index cd56a428..a9e1f35a 100644 --- a/plugins/modules/device_bay.py +++ b/plugins/modules/device_bay.py @@ -93,7 +93,10 @@ type: str """ -from ansible_collections.networktocode.nautobot.plugins.module_utils.utils import NAUTOBOT_ARG_SPEC +from ansible_collections.networktocode.nautobot.plugins.module_utils.utils import ( + NAUTOBOT_ARG_SPEC, + TAGS_ARG_SPEC, +) from ansible_collections.networktocode.nautobot.plugins.module_utils.dcim import ( NautobotDcimModule, NB_DEVICE_BAYS, @@ -107,13 +110,13 @@ def main(): Main entry point for module execution """ argument_spec = deepcopy(NAUTOBOT_ARG_SPEC) + argument_spec.update(deepcopy(TAGS_ARG_SPEC)) argument_spec.update( dict( device=dict(required=False, type="raw"), name=dict(required=True, type="str"), description=dict(required=False, type="str"), installed_device=dict(required=False, type="raw"), - tags=dict(required=False, type="list", elements="raw"), ) ) diff --git a/plugins/modules/device_interface.py b/plugins/modules/device_interface.py index 2d5c6e6e..17bc6227 100644 --- a/plugins/modules/device_interface.py +++ b/plugins/modules/device_interface.py @@ -248,7 +248,11 @@ type: str """ -from ansible_collections.networktocode.nautobot.plugins.module_utils.utils import NAUTOBOT_ARG_SPEC +from ansible_collections.networktocode.nautobot.plugins.module_utils.utils import ( + NAUTOBOT_ARG_SPEC, + TAGS_ARG_SPEC, + CUSTOM_FIELDS_ARG_SPEC, +) from ansible_collections.networktocode.nautobot.plugins.module_utils.dcim import ( NautobotDcimModule, NB_INTERFACES, @@ -262,6 +266,8 @@ def main(): Main entry point for module execution """ argument_spec = deepcopy(NAUTOBOT_ARG_SPEC) + argument_spec.update(deepcopy(TAGS_ARG_SPEC)) + argument_spec.update(deepcopy(CUSTOM_FIELDS_ARG_SPEC)) argument_spec.update( dict( update_vc_child=dict(type="bool", required=False, default=False), @@ -281,8 +287,6 @@ def main(): mode=dict(required=False, type="raw"), untagged_vlan=dict(required=False, type="raw"), tagged_vlans=dict(required=False, type="raw"), - tags=dict(required=False, type="list", elements="raw"), - custom_fields=dict(required=False, type="dict"), ) ) diff --git a/plugins/modules/device_redundancy_group.py b/plugins/modules/device_redundancy_group.py index 12ed6175..9e18ce53 100644 --- a/plugins/modules/device_redundancy_group.py +++ b/plugins/modules/device_redundancy_group.py @@ -114,7 +114,11 @@ type: str """ -from ansible_collections.networktocode.nautobot.plugins.module_utils.utils import NAUTOBOT_ARG_SPEC +from ansible_collections.networktocode.nautobot.plugins.module_utils.utils import ( + NAUTOBOT_ARG_SPEC, + TAGS_ARG_SPEC, + CUSTOM_FIELDS_ARG_SPEC, +) from ansible_collections.networktocode.nautobot.plugins.module_utils.dcim import ( NautobotDcimModule, NB_DEVICE_REDUNDANCY_GROUPS, @@ -128,6 +132,8 @@ def main(): Main entry point for module execution """ argument_spec = deepcopy(NAUTOBOT_ARG_SPEC) + argument_spec.update(deepcopy(TAGS_ARG_SPEC)) + argument_spec.update(deepcopy(CUSTOM_FIELDS_ARG_SPEC)) argument_spec.update( dict( name=dict(required=True, type="str"), @@ -139,8 +145,6 @@ def main(): choices=["active-active", "active-passive"], ), secrets_group=dict(required=False, type="raw"), - tags=dict(required=False, type="list", elements="raw"), - custom_fields=dict(required=False, type="dict"), ) ) diff --git a/plugins/modules/device_type.py b/plugins/modules/device_type.py index 88aa1727..e7da89e8 100644 --- a/plugins/modules/device_type.py +++ b/plugins/modules/device_type.py @@ -119,7 +119,11 @@ type: str """ -from ansible_collections.networktocode.nautobot.plugins.module_utils.utils import NAUTOBOT_ARG_SPEC +from ansible_collections.networktocode.nautobot.plugins.module_utils.utils import ( + NAUTOBOT_ARG_SPEC, + TAGS_ARG_SPEC, + CUSTOM_FIELDS_ARG_SPEC, +) from ansible_collections.networktocode.nautobot.plugins.module_utils.dcim import ( NautobotDcimModule, NB_DEVICE_TYPES, @@ -133,6 +137,8 @@ def main(): Main entry point for module execution """ argument_spec = deepcopy(NAUTOBOT_ARG_SPEC) + argument_spec.update(deepcopy(TAGS_ARG_SPEC)) + argument_spec.update(deepcopy(CUSTOM_FIELDS_ARG_SPEC)) argument_spec.update( dict( manufacturer=dict(required=False, type="raw"), @@ -146,8 +152,6 @@ def main(): type="str", ), comments=dict(required=False, type="str"), - tags=dict(required=False, type="list", elements="raw"), - custom_fields=dict(required=False, type="dict"), ) ) diff --git a/plugins/modules/front_port.py b/plugins/modules/front_port.py index 095f9327..b29d6198 100644 --- a/plugins/modules/front_port.py +++ b/plugins/modules/front_port.py @@ -113,7 +113,10 @@ type: str """ -from ansible_collections.networktocode.nautobot.plugins.module_utils.utils import NAUTOBOT_ARG_SPEC +from ansible_collections.networktocode.nautobot.plugins.module_utils.utils import ( + NAUTOBOT_ARG_SPEC, + TAGS_ARG_SPEC, +) from ansible_collections.networktocode.nautobot.plugins.module_utils.dcim import ( NautobotDcimModule, NB_FRONT_PORTS, @@ -127,6 +130,7 @@ def main(): Main entry point for module execution """ argument_spec = deepcopy(NAUTOBOT_ARG_SPEC) + argument_spec.update(deepcopy(TAGS_ARG_SPEC)) argument_spec.update( dict( device=dict(required=True, type="raw"), @@ -135,7 +139,6 @@ def main(): rear_port=dict(required=True, type="raw"), rear_port_position=dict(required=False, type="int"), description=dict(required=False, type="str"), - tags=dict(required=False, type="list", elements="raw"), ) ) diff --git a/plugins/modules/inventory_item.py b/plugins/modules/inventory_item.py index c8148adb..acb311a6 100644 --- a/plugins/modules/inventory_item.py +++ b/plugins/modules/inventory_item.py @@ -122,7 +122,11 @@ type: str """ -from ansible_collections.networktocode.nautobot.plugins.module_utils.utils import NAUTOBOT_ARG_SPEC +from ansible_collections.networktocode.nautobot.plugins.module_utils.utils import ( + NAUTOBOT_ARG_SPEC, + TAGS_ARG_SPEC, + CUSTOM_FIELDS_ARG_SPEC, +) from ansible_collections.networktocode.nautobot.plugins.module_utils.dcim import ( NautobotDcimModule, NB_INVENTORY_ITEMS, @@ -136,6 +140,8 @@ def main(): Main entry point for module execution """ argument_spec = deepcopy(NAUTOBOT_ARG_SPEC) + argument_spec.update(deepcopy(TAGS_ARG_SPEC)) + argument_spec.update(deepcopy(CUSTOM_FIELDS_ARG_SPEC)) argument_spec.update( dict( device=dict(required=True, type="raw"), @@ -146,8 +152,6 @@ def main(): asset_tag=dict(required=False, type="str"), description=dict(required=False, type="str"), discovered=dict(required=False, type="bool", default=False), - custom_fields=dict(required=False, type="dict"), - tags=dict(required=False, type="list", elements="raw"), ) ) diff --git a/plugins/modules/ip_address.py b/plugins/modules/ip_address.py index c188f078..070ad201 100644 --- a/plugins/modules/ip_address.py +++ b/plugins/modules/ip_address.py @@ -180,7 +180,11 @@ type: str """ -from ansible_collections.networktocode.nautobot.plugins.module_utils.utils import NAUTOBOT_ARG_SPEC +from ansible_collections.networktocode.nautobot.plugins.module_utils.utils import ( + NAUTOBOT_ARG_SPEC, + TAGS_ARG_SPEC, + CUSTOM_FIELDS_ARG_SPEC, +) from ansible_collections.networktocode.nautobot.plugins.module_utils.ipam import ( NautobotIpamModule, NB_IP_ADDRESSES, @@ -194,6 +198,8 @@ def main(): Main entry point for module execution """ argument_spec = deepcopy(NAUTOBOT_ARG_SPEC) + argument_spec.update(deepcopy(TAGS_ARG_SPEC)) + argument_spec.update(deepcopy(CUSTOM_FIELDS_ARG_SPEC)) # state choices present, absent, new argument_spec["state"] = dict(required=False, default="present", choices=["present", "absent", "new"]) argument_spec.update( @@ -212,8 +218,6 @@ def main(): nat_inside=dict(required=False, type="raw"), dns_name=dict(required=False, type="str"), namespace=dict(required=False, type="str", default="Global"), - tags=dict(required=False, type="list", elements="raw"), - custom_fields=dict(required=False, type="dict"), ) ) diff --git a/plugins/modules/location.py b/plugins/modules/location.py index 06085260..148c9ab5 100644 --- a/plugins/modules/location.py +++ b/plugins/modules/location.py @@ -197,7 +197,11 @@ type: str """ -from ansible_collections.networktocode.nautobot.plugins.module_utils.utils import NAUTOBOT_ARG_SPEC +from ansible_collections.networktocode.nautobot.plugins.module_utils.utils import ( + NAUTOBOT_ARG_SPEC, + TAGS_ARG_SPEC, + CUSTOM_FIELDS_ARG_SPEC, +) from ansible_collections.networktocode.nautobot.plugins.module_utils.dcim import ( NautobotDcimModule, NB_LOCATIONS, @@ -211,6 +215,8 @@ def main(): Main entry point for module execution """ argument_spec = deepcopy(NAUTOBOT_ARG_SPEC) + argument_spec.update(deepcopy(TAGS_ARG_SPEC)) + argument_spec.update(deepcopy(CUSTOM_FIELDS_ARG_SPEC)) argument_spec.update( dict( id=dict(required=False, type="str"), @@ -231,8 +237,6 @@ def main(): contact_phone=dict(required=False, type="str"), contact_email=dict(required=False, type="str"), comments=dict(required=False, type="str"), - tags=dict(required=False, type="list", elements="raw"), - custom_fields=dict(required=False, type="dict"), ) ) diff --git a/plugins/modules/location_type.py b/plugins/modules/location_type.py index 23570443..444d19a5 100644 --- a/plugins/modules/location_type.py +++ b/plugins/modules/location_type.py @@ -101,7 +101,10 @@ type: str """ -from ansible_collections.networktocode.nautobot.plugins.module_utils.utils import NAUTOBOT_ARG_SPEC +from ansible_collections.networktocode.nautobot.plugins.module_utils.utils import ( + NAUTOBOT_ARG_SPEC, + CUSTOM_FIELDS_ARG_SPEC, +) from ansible_collections.networktocode.nautobot.plugins.module_utils.dcim import ( NautobotDcimModule, NB_LOCATION_TYPES, @@ -115,6 +118,7 @@ def main(): Main entry point for module execution """ argument_spec = deepcopy(NAUTOBOT_ARG_SPEC) + argument_spec.update(deepcopy(CUSTOM_FIELDS_ARG_SPEC)) argument_spec.update( dict( name=dict(required=True, type="str"), @@ -122,7 +126,6 @@ def main(): parent_location_type=dict(required=False, type="raw", aliases=["parent"]), nestable=dict(required=False, type="bool"), content_types=dict(required=False, type="list", elements="str"), - custom_fields=dict(required=False, type="dict"), ) ) diff --git a/plugins/modules/namespace.py b/plugins/modules/namespace.py index 96a5ba38..544fe421 100644 --- a/plugins/modules/namespace.py +++ b/plugins/modules/namespace.py @@ -81,7 +81,11 @@ type: str """ -from ansible_collections.networktocode.nautobot.plugins.module_utils.utils import NAUTOBOT_ARG_SPEC +from ansible_collections.networktocode.nautobot.plugins.module_utils.utils import ( + NAUTOBOT_ARG_SPEC, + TAGS_ARG_SPEC, + CUSTOM_FIELDS_ARG_SPEC, +) from ansible_collections.networktocode.nautobot.plugins.module_utils.dcim import ( NautobotDcimModule, NB_NAMESPACES, @@ -95,13 +99,13 @@ def main(): Main entry point for module execution """ argument_spec = deepcopy(NAUTOBOT_ARG_SPEC) + argument_spec.update(deepcopy(TAGS_ARG_SPEC)) + argument_spec.update(deepcopy(CUSTOM_FIELDS_ARG_SPEC)) argument_spec.update( dict( name=dict(required=True, type="str"), description=dict(required=False, type="str"), location=dict(required=False, type="raw"), - tags=dict(required=False, type="list", elements="raw"), - custom_fields=dict(required=False, type="dict"), ) ) diff --git a/plugins/modules/power_feed.py b/plugins/modules/power_feed.py index 4be58a12..ee971a9c 100644 --- a/plugins/modules/power_feed.py +++ b/plugins/modules/power_feed.py @@ -155,7 +155,11 @@ type: str """ -from ansible_collections.networktocode.nautobot.plugins.module_utils.utils import NAUTOBOT_ARG_SPEC +from ansible_collections.networktocode.nautobot.plugins.module_utils.utils import ( + NAUTOBOT_ARG_SPEC, + TAGS_ARG_SPEC, + CUSTOM_FIELDS_ARG_SPEC, +) from ansible_collections.networktocode.nautobot.plugins.module_utils.dcim import ( NautobotDcimModule, NB_POWER_FEEDS, @@ -169,6 +173,8 @@ def main(): Main entry point for module execution """ argument_spec = deepcopy(NAUTOBOT_ARG_SPEC) + argument_spec.update(deepcopy(TAGS_ARG_SPEC)) + argument_spec.update(deepcopy(CUSTOM_FIELDS_ARG_SPEC)) argument_spec.update( dict( power_panel=dict(required=True, type="raw"), @@ -189,8 +195,6 @@ def main(): amperage=dict(required=False, type="int"), max_utilization=dict(required=False, type="int"), comments=dict(required=False, type="str"), - tags=dict(required=False, type="list", elements="raw"), - custom_fields=dict(required=False, type="dict"), ) ) diff --git a/plugins/modules/power_outlet.py b/plugins/modules/power_outlet.py index b476054d..986330da 100644 --- a/plugins/modules/power_outlet.py +++ b/plugins/modules/power_outlet.py @@ -113,7 +113,10 @@ type: str """ -from ansible_collections.networktocode.nautobot.plugins.module_utils.utils import NAUTOBOT_ARG_SPEC +from ansible_collections.networktocode.nautobot.plugins.module_utils.utils import ( + NAUTOBOT_ARG_SPEC, + TAGS_ARG_SPEC, +) from ansible_collections.networktocode.nautobot.plugins.module_utils.dcim import ( NautobotDcimModule, NB_POWER_OUTLETS, @@ -127,6 +130,7 @@ def main(): Main entry point for module execution """ argument_spec = deepcopy(NAUTOBOT_ARG_SPEC) + argument_spec.update(deepcopy(TAGS_ARG_SPEC)) argument_spec.update( dict( device=dict(required=True, type="raw"), @@ -135,7 +139,6 @@ def main(): power_port=dict(required=False, type="raw"), feed_leg=dict(required=False, choices=["A", "B", "C"], type="str"), description=dict(required=False, type="str"), - tags=dict(required=False, type="list", elements="raw"), ) ) diff --git a/plugins/modules/power_port.py b/plugins/modules/power_port.py index 78b9e80a..f7752598 100644 --- a/plugins/modules/power_port.py +++ b/plugins/modules/power_port.py @@ -109,7 +109,10 @@ type: str """ -from ansible_collections.networktocode.nautobot.plugins.module_utils.utils import NAUTOBOT_ARG_SPEC +from ansible_collections.networktocode.nautobot.plugins.module_utils.utils import ( + NAUTOBOT_ARG_SPEC, + TAGS_ARG_SPEC, +) from ansible_collections.networktocode.nautobot.plugins.module_utils.dcim import ( NautobotDcimModule, NB_POWER_PORTS, @@ -123,6 +126,7 @@ def main(): Main entry point for module execution """ argument_spec = deepcopy(NAUTOBOT_ARG_SPEC) + argument_spec.update(deepcopy(TAGS_ARG_SPEC)) argument_spec.update( dict( device=dict(required=True, type="raw"), @@ -131,7 +135,6 @@ def main(): allocated_draw=dict(required=False, type="int"), maximum_draw=dict(required=False, type="int"), description=dict(required=False, type="str"), - tags=dict(required=False, type="list", elements="raw"), ) ) diff --git a/plugins/modules/prefix.py b/plugins/modules/prefix.py index e49b1076..8e00664d 100644 --- a/plugins/modules/prefix.py +++ b/plugins/modules/prefix.py @@ -212,7 +212,11 @@ """ -from ansible_collections.networktocode.nautobot.plugins.module_utils.utils import NAUTOBOT_ARG_SPEC +from ansible_collections.networktocode.nautobot.plugins.module_utils.utils import ( + NAUTOBOT_ARG_SPEC, + TAGS_ARG_SPEC, + CUSTOM_FIELDS_ARG_SPEC, +) from ansible_collections.networktocode.nautobot.plugins.module_utils.ipam import ( NautobotIpamModule, NB_PREFIXES, @@ -226,6 +230,8 @@ def main(): Main entry point for module execution """ argument_spec = deepcopy(NAUTOBOT_ARG_SPEC) + argument_spec.update(deepcopy(TAGS_ARG_SPEC)) + argument_spec.update(deepcopy(CUSTOM_FIELDS_ARG_SPEC)) argument_spec.update( dict( ip_version=dict(required=False, type="int"), @@ -244,8 +250,6 @@ def main(): ), description=dict(required=False, type="str"), namespace=dict(required=False, type="str", default="Global"), - tags=dict(required=False, type="list", elements="raw"), - custom_fields=dict(required=False, type="dict"), first_available=dict(required=False, type="bool", default=False), ) ) diff --git a/plugins/modules/provider.py b/plugins/modules/provider.py index abc0e062..0b055bab 100644 --- a/plugins/modules/provider.py +++ b/plugins/modules/provider.py @@ -114,7 +114,11 @@ type: str """ -from ansible_collections.networktocode.nautobot.plugins.module_utils.utils import NAUTOBOT_ARG_SPEC +from ansible_collections.networktocode.nautobot.plugins.module_utils.utils import ( + NAUTOBOT_ARG_SPEC, + TAGS_ARG_SPEC, + CUSTOM_FIELDS_ARG_SPEC, +) from ansible_collections.networktocode.nautobot.plugins.module_utils.circuits import ( NautobotCircuitsModule, NB_PROVIDERS, @@ -128,6 +132,8 @@ def main(): Main entry point for module execution """ argument_spec = deepcopy(NAUTOBOT_ARG_SPEC) + argument_spec.update(deepcopy(TAGS_ARG_SPEC)) + argument_spec.update(deepcopy(CUSTOM_FIELDS_ARG_SPEC)) argument_spec.update( dict( name=dict(required=True, type="str"), @@ -137,8 +143,6 @@ def main(): noc_contact=dict(required=False, type="str"), admin_contact=dict(required=False, type="str"), comments=dict(required=False, type="str"), - tags=dict(required=False, type="list", elements="raw"), - custom_fields=dict(required=False, type="dict"), ), ) diff --git a/plugins/modules/rack.py b/plugins/modules/rack.py index 072ab1f2..d975c455 100644 --- a/plugins/modules/rack.py +++ b/plugins/modules/rack.py @@ -175,7 +175,11 @@ type: str """ -from ansible_collections.networktocode.nautobot.plugins.module_utils.utils import NAUTOBOT_ARG_SPEC +from ansible_collections.networktocode.nautobot.plugins.module_utils.utils import ( + NAUTOBOT_ARG_SPEC, + TAGS_ARG_SPEC, + CUSTOM_FIELDS_ARG_SPEC, +) from ansible_collections.networktocode.nautobot.plugins.module_utils.dcim import ( NautobotDcimModule, NB_RACKS, @@ -189,6 +193,8 @@ def main(): Main entry point for module execution """ argument_spec = deepcopy(NAUTOBOT_ARG_SPEC) + argument_spec.update(deepcopy(TAGS_ARG_SPEC)) + argument_spec.update(deepcopy(CUSTOM_FIELDS_ARG_SPEC)) argument_spec.update( dict( name=dict(required=True, type="str"), @@ -212,8 +218,6 @@ def main(): choices=["Millimeters", "Inches"], ), comments=dict(required=False, type="str"), - tags=dict(required=False, type="list", elements="raw"), - custom_fields=dict(required=False, type="dict"), ) ) diff --git a/plugins/modules/rear_port.py b/plugins/modules/rear_port.py index 72dd4000..ba44b8a5 100644 --- a/plugins/modules/rear_port.py +++ b/plugins/modules/rear_port.py @@ -104,7 +104,10 @@ type: str """ -from ansible_collections.networktocode.nautobot.plugins.module_utils.utils import NAUTOBOT_ARG_SPEC +from ansible_collections.networktocode.nautobot.plugins.module_utils.utils import ( + NAUTOBOT_ARG_SPEC, + TAGS_ARG_SPEC, +) from ansible_collections.networktocode.nautobot.plugins.module_utils.dcim import ( NautobotDcimModule, NB_REAR_PORTS, @@ -118,6 +121,7 @@ def main(): Main entry point for module execution """ argument_spec = deepcopy(NAUTOBOT_ARG_SPEC) + argument_spec.update(deepcopy(TAGS_ARG_SPEC)) argument_spec.update( dict( device=dict(required=True, type="raw"), @@ -125,7 +129,6 @@ def main(): type=dict(required=True, type="str"), positions=dict(required=False, type="int"), description=dict(required=False, type="str"), - tags=dict(required=False, type="list", elements="raw"), ) ) diff --git a/plugins/modules/role.py b/plugins/modules/role.py index d239f3d8..f096b073 100644 --- a/plugins/modules/role.py +++ b/plugins/modules/role.py @@ -89,7 +89,10 @@ returned: always type: str """ -from ansible_collections.networktocode.nautobot.plugins.module_utils.utils import NAUTOBOT_ARG_SPEC +from ansible_collections.networktocode.nautobot.plugins.module_utils.utils import ( + NAUTOBOT_ARG_SPEC, + CUSTOM_FIELDS_ARG_SPEC, +) from ansible_collections.networktocode.nautobot.plugins.module_utils.dcim import ( NautobotDcimModule, NB_ROLES, @@ -103,6 +106,7 @@ def main(): Main entry point for module execution """ argument_spec = deepcopy(NAUTOBOT_ARG_SPEC) + argument_spec.update(deepcopy(CUSTOM_FIELDS_ARG_SPEC)) argument_spec.update( dict( name=dict(required=True, type="str"), @@ -110,7 +114,6 @@ def main(): color=dict(required=False, type="str"), content_types=dict(required=False, type="list", elements="str"), weight=dict(required=False, type="int"), - custom_fields=dict(required=False, type="dict"), ) ) diff --git a/plugins/modules/route_target.py b/plugins/modules/route_target.py index 3052c3bb..7aaf978a 100644 --- a/plugins/modules/route_target.py +++ b/plugins/modules/route_target.py @@ -96,7 +96,11 @@ type: str """ -from ansible_collections.networktocode.nautobot.plugins.module_utils.utils import NAUTOBOT_ARG_SPEC +from ansible_collections.networktocode.nautobot.plugins.module_utils.utils import ( + NAUTOBOT_ARG_SPEC, + TAGS_ARG_SPEC, + CUSTOM_FIELDS_ARG_SPEC, +) from ansible_collections.networktocode.nautobot.plugins.module_utils.ipam import ( NautobotIpamModule, NB_ROUTE_TARGETS, @@ -110,13 +114,13 @@ def main(): Main entry point for module execution """ argument_spec = deepcopy(NAUTOBOT_ARG_SPEC) + argument_spec.update(deepcopy(TAGS_ARG_SPEC)) + argument_spec.update(deepcopy(CUSTOM_FIELDS_ARG_SPEC)) argument_spec.update( dict( name=dict(required=True, type="str"), tenant=dict(required=False, type="raw"), description=dict(required=False, type="str"), - tags=dict(required=False, type="list", elements="raw"), - custom_fields=dict(required=False, type="dict"), ) ) diff --git a/plugins/modules/service.py b/plugins/modules/service.py index 4a21904a..766be88a 100644 --- a/plugins/modules/service.py +++ b/plugins/modules/service.py @@ -108,7 +108,11 @@ state: absent """ -from ansible_collections.networktocode.nautobot.plugins.module_utils.utils import NAUTOBOT_ARG_SPEC +from ansible_collections.networktocode.nautobot.plugins.module_utils.utils import ( + NAUTOBOT_ARG_SPEC, + TAGS_ARG_SPEC, + CUSTOM_FIELDS_ARG_SPEC, +) from ansible_collections.networktocode.nautobot.plugins.module_utils.ipam import ( NautobotIpamModule, NB_SERVICES, @@ -122,6 +126,8 @@ def main(): Main entry point for module execution """ argument_spec = deepcopy(NAUTOBOT_ARG_SPEC) + argument_spec.update(deepcopy(TAGS_ARG_SPEC)) + argument_spec.update(deepcopy(CUSTOM_FIELDS_ARG_SPEC)) argument_spec.update( dict( device=dict(required=False, type="raw"), @@ -131,8 +137,6 @@ def main(): protocol=dict(required=True, type="raw"), ip_addresses=dict(required=False, type="raw"), description=dict(required=False, type="str"), - tags=dict(required=False, type="list", elements="raw"), - custom_fields=dict(required=False, type="dict"), ) ) required_one_of = [["device", "virtual_machine"]] diff --git a/plugins/modules/tag.py b/plugins/modules/tag.py index e4b6812d..9809a908 100644 --- a/plugins/modules/tag.py +++ b/plugins/modules/tag.py @@ -127,7 +127,10 @@ type: str """ -from ansible_collections.networktocode.nautobot.plugins.module_utils.utils import NAUTOBOT_ARG_SPEC +from ansible_collections.networktocode.nautobot.plugins.module_utils.utils import ( + NAUTOBOT_ARG_SPEC, + CUSTOM_FIELDS_ARG_SPEC, +) from ansible_collections.networktocode.nautobot.plugins.module_utils.extras import ( NautobotExtrasModule, NB_TAGS, @@ -141,13 +144,13 @@ def main(): Main entry point for module execution """ argument_spec = deepcopy(NAUTOBOT_ARG_SPEC) + argument_spec.update(deepcopy(CUSTOM_FIELDS_ARG_SPEC)) argument_spec.update( dict( name=dict(required=True, type="str"), color=dict(required=False, type="str"), description=dict(required=False, type="str"), content_types=dict(required=False, type="list", elements="str"), - custom_fields=dict(required=False, type="dict"), ) ) diff --git a/plugins/modules/team.py b/plugins/modules/team.py index fc886703..63167397 100644 --- a/plugins/modules/team.py +++ b/plugins/modules/team.py @@ -99,7 +99,11 @@ type: str """ -from ansible_collections.networktocode.nautobot.plugins.module_utils.utils import NAUTOBOT_ARG_SPEC +from ansible_collections.networktocode.nautobot.plugins.module_utils.utils import ( + NAUTOBOT_ARG_SPEC, + TAGS_ARG_SPEC, + CUSTOM_FIELDS_ARG_SPEC, +) from ansible_collections.networktocode.nautobot.plugins.module_utils.extras import ( NautobotExtrasModule, NB_TEAM, @@ -113,6 +117,8 @@ def main(): Main entry point for module execution """ argument_spec = deepcopy(NAUTOBOT_ARG_SPEC) + argument_spec.update(deepcopy(TAGS_ARG_SPEC)) + argument_spec.update(deepcopy(CUSTOM_FIELDS_ARG_SPEC)) argument_spec.update( dict( name=dict(required=True, type="str"), @@ -121,8 +127,6 @@ def main(): address=dict(required=False, type="str"), contacts=dict(required=False, type="list", elements="raw"), comments=dict(required=False, type="str"), - tags=dict(required=False, type="list", elements="raw"), - custom_fields=dict(required=False, type="dict"), ) ) diff --git a/plugins/modules/tenant.py b/plugins/modules/tenant.py index 611d4fe6..68717502 100644 --- a/plugins/modules/tenant.py +++ b/plugins/modules/tenant.py @@ -96,7 +96,11 @@ type: str """ -from ansible_collections.networktocode.nautobot.plugins.module_utils.utils import NAUTOBOT_ARG_SPEC +from ansible_collections.networktocode.nautobot.plugins.module_utils.utils import ( + NAUTOBOT_ARG_SPEC, + TAGS_ARG_SPEC, + CUSTOM_FIELDS_ARG_SPEC, +) from ansible_collections.networktocode.nautobot.plugins.module_utils.tenancy import ( NautobotTenancyModule, NB_TENANTS, @@ -110,14 +114,14 @@ def main(): Main entry point for module execution """ argument_spec = deepcopy(NAUTOBOT_ARG_SPEC) + argument_spec.update(deepcopy(TAGS_ARG_SPEC)) + argument_spec.update(deepcopy(CUSTOM_FIELDS_ARG_SPEC)) argument_spec.update( dict( name=dict(required=True, type="str"), tenant_group=dict(required=False, type="raw"), description=dict(required=False, type="str"), comments=dict(required=False, type="str"), - tags=dict(required=False, type="list", elements="raw"), - custom_fields=dict(required=False, type="dict"), ) ) diff --git a/plugins/modules/virtual_chassis.py b/plugins/modules/virtual_chassis.py index b11fb203..3f4f7a7b 100644 --- a/plugins/modules/virtual_chassis.py +++ b/plugins/modules/virtual_chassis.py @@ -86,7 +86,10 @@ type: str """ -from ansible_collections.networktocode.nautobot.plugins.module_utils.utils import NAUTOBOT_ARG_SPEC +from ansible_collections.networktocode.nautobot.plugins.module_utils.utils import ( + NAUTOBOT_ARG_SPEC, + TAGS_ARG_SPEC, +) from ansible_collections.networktocode.nautobot.plugins.module_utils.dcim import ( NautobotDcimModule, NB_VIRTUAL_CHASSIS, @@ -100,12 +103,12 @@ def main(): Main entry point for module execution """ argument_spec = deepcopy(NAUTOBOT_ARG_SPEC) + argument_spec.update(deepcopy(TAGS_ARG_SPEC)) argument_spec.update( dict( name=dict(required=True, type="str"), master=dict(required=False, type="raw"), domain=dict(required=False, type="str"), - tags=dict(required=False, type="list", elements="raw"), ) ) diff --git a/plugins/modules/virtual_machine.py b/plugins/modules/virtual_machine.py index 7717d717..3a3dbce5 100644 --- a/plugins/modules/virtual_machine.py +++ b/plugins/modules/virtual_machine.py @@ -161,7 +161,11 @@ type: str """ -from ansible_collections.networktocode.nautobot.plugins.module_utils.utils import NAUTOBOT_ARG_SPEC +from ansible_collections.networktocode.nautobot.plugins.module_utils.utils import ( + NAUTOBOT_ARG_SPEC, + TAGS_ARG_SPEC, + CUSTOM_FIELDS_ARG_SPEC, +) from ansible_collections.networktocode.nautobot.plugins.module_utils.virtualization import ( NautobotVirtualizationModule, NB_VIRTUAL_MACHINES, @@ -175,6 +179,8 @@ def main(): Main entry point for module execution """ argument_spec = deepcopy(NAUTOBOT_ARG_SPEC) + argument_spec.update(deepcopy(TAGS_ARG_SPEC)) + argument_spec.update(deepcopy(CUSTOM_FIELDS_ARG_SPEC)) argument_spec.update( dict( name=dict(required=True, type="str"), @@ -188,8 +194,6 @@ def main(): memory=dict(required=False, type="int"), disk=dict(required=False, type="int"), status=dict(required=False, type="raw"), - tags=dict(required=False, type="list", elements="raw"), - custom_fields=dict(required=False, type="dict"), local_config_context_data=dict(required=False, type="dict"), comments=dict(required=False, type="str"), ) diff --git a/plugins/modules/vlan.py b/plugins/modules/vlan.py index 8dbfdaad..799d6f5b 100644 --- a/plugins/modules/vlan.py +++ b/plugins/modules/vlan.py @@ -132,7 +132,11 @@ type: str """ -from ansible_collections.networktocode.nautobot.plugins.module_utils.utils import NAUTOBOT_ARG_SPEC +from ansible_collections.networktocode.nautobot.plugins.module_utils.utils import ( + NAUTOBOT_ARG_SPEC, + TAGS_ARG_SPEC, + CUSTOM_FIELDS_ARG_SPEC, +) from ansible_collections.networktocode.nautobot.plugins.module_utils.ipam import ( NautobotIpamModule, NB_VLANS, @@ -146,6 +150,8 @@ def main(): Main entry point for module execution """ argument_spec = deepcopy(NAUTOBOT_ARG_SPEC) + argument_spec.update(deepcopy(TAGS_ARG_SPEC)) + argument_spec.update(deepcopy(CUSTOM_FIELDS_ARG_SPEC)) argument_spec.update( dict( location=dict(required=False, type="raw"), @@ -156,8 +162,6 @@ def main(): status=dict(required=False, type="raw"), role=dict(required=False, type="raw"), description=dict(required=False, type="str"), - tags=dict(required=False, type="list", elements="raw"), - custom_fields=dict(required=False, type="dict"), ) ) diff --git a/plugins/modules/vlan_group.py b/plugins/modules/vlan_group.py index eeef61fb..ecb3415b 100644 --- a/plugins/modules/vlan_group.py +++ b/plugins/modules/vlan_group.py @@ -79,7 +79,10 @@ type: str """ -from ansible_collections.networktocode.nautobot.plugins.module_utils.utils import NAUTOBOT_ARG_SPEC +from ansible_collections.networktocode.nautobot.plugins.module_utils.utils import ( + NAUTOBOT_ARG_SPEC, + CUSTOM_FIELDS_ARG_SPEC, +) from ansible_collections.networktocode.nautobot.plugins.module_utils.ipam import ( NautobotIpamModule, NB_VLAN_GROUPS, @@ -93,12 +96,12 @@ def main(): Main entry point for module execution """ argument_spec = deepcopy(NAUTOBOT_ARG_SPEC) + argument_spec.update(deepcopy(CUSTOM_FIELDS_ARG_SPEC)) argument_spec.update( dict( name=dict(required=True, type="str"), location=dict(required=False, type="raw"), description=dict(required=False, type="str"), - custom_fields=dict(required=False, type="dict"), ) ) diff --git a/plugins/modules/vm_interface.py b/plugins/modules/vm_interface.py index 1c02c1a3..3b1dfc64 100644 --- a/plugins/modules/vm_interface.py +++ b/plugins/modules/vm_interface.py @@ -152,7 +152,11 @@ type: str """ -from ansible_collections.networktocode.nautobot.plugins.module_utils.utils import NAUTOBOT_ARG_SPEC +from ansible_collections.networktocode.nautobot.plugins.module_utils.utils import ( + NAUTOBOT_ARG_SPEC, + TAGS_ARG_SPEC, + CUSTOM_FIELDS_ARG_SPEC, +) from ansible_collections.networktocode.nautobot.plugins.module_utils.virtualization import ( NautobotVirtualizationModule, NB_VM_INTERFACES, @@ -166,6 +170,8 @@ def main(): Main entry point for module execution """ argument_spec = deepcopy(NAUTOBOT_ARG_SPEC) + argument_spec.update(deepcopy(TAGS_ARG_SPEC)) + argument_spec.update(deepcopy(CUSTOM_FIELDS_ARG_SPEC)) argument_spec.update( dict( virtual_machine=dict(required=True, type="raw"), @@ -178,8 +184,6 @@ def main(): mode=dict(required=False, type="raw"), untagged_vlan=dict(required=False, type="raw"), tagged_vlans=dict(required=False, type="raw"), - tags=dict(required=False, type="list", elements="raw"), - custom_fields=dict(required=False, type="dict"), ) ) diff --git a/plugins/modules/vrf.py b/plugins/modules/vrf.py index 0d61b497..09443b62 100644 --- a/plugins/modules/vrf.py +++ b/plugins/modules/vrf.py @@ -120,7 +120,11 @@ type: str """ -from ansible_collections.networktocode.nautobot.plugins.module_utils.utils import NAUTOBOT_ARG_SPEC +from ansible_collections.networktocode.nautobot.plugins.module_utils.utils import ( + NAUTOBOT_ARG_SPEC, + TAGS_ARG_SPEC, + CUSTOM_FIELDS_ARG_SPEC, +) from ansible_collections.networktocode.nautobot.plugins.module_utils.ipam import ( NautobotIpamModule, NB_VRFS, @@ -134,6 +138,8 @@ def main(): Main entry point for module execution """ argument_spec = deepcopy(NAUTOBOT_ARG_SPEC) + argument_spec.update(deepcopy(TAGS_ARG_SPEC)) + argument_spec.update(deepcopy(CUSTOM_FIELDS_ARG_SPEC)) argument_spec.update( dict( name=dict(required=True, type="str"), @@ -143,8 +149,6 @@ def main(): import_targets=dict(required=False, type="list", elements="str"), export_targets=dict(required=False, type="list", elements="str"), description=dict(required=False, type="str"), - tags=dict(required=False, type="list", elements="raw"), - custom_fields=dict(required=False, type="dict"), ) )