From 65d4304a11b925615f5fdd5c5917025b353ef9df Mon Sep 17 00:00:00 2001 From: Martijn Remmen Date: Fri, 7 May 2021 16:45:10 +0200 Subject: [PATCH] costum lookup plugin test --- ansible.cfg | 3 +++ inventory.yml | 8 +------- plugins/inventory/td_assetmgmt.py | 11 +++++++++++ 3 files changed, 15 insertions(+), 7 deletions(-) create mode 100644 ansible.cfg create mode 100644 plugins/inventory/td_assetmgmt.py diff --git a/ansible.cfg b/ansible.cfg new file mode 100644 index 0000000..dcb3840 --- /dev/null +++ b/ansible.cfg @@ -0,0 +1,3 @@ +[defaults] + +inventory_plugins = ./plugins/inventory \ No newline at end of file diff --git a/inventory.yml b/inventory.yml index 4d6c2fc..304e6aa 100644 --- a/inventory.yml +++ b/inventory.yml @@ -1,7 +1 @@ -plugin: netbox.netbox.nb_inventory -api_endpoint: https://demo.netbox.dev -token: da482f8ca0d65ebc3b97aba4a2b5cc66e31f8a7f -plurals: no -group_by: - - device_type - +plugin: td_assetmgmt diff --git a/plugins/inventory/td_assetmgmt.py b/plugins/inventory/td_assetmgmt.py new file mode 100644 index 0000000..5d85e1d --- /dev/null +++ b/plugins/inventory/td_assetmgmt.py @@ -0,0 +1,11 @@ +from ansible.plugins.inventory import BaseFileInventoryPlugin + +class InventoryModule(BaseFileInventoryPlugin): + + NAME = 'td_assetmgmt' + + def parse(self, inventory, loader, path, cache=True): + + super(InventoryModule, self).parse(inventory, loader, path, cache) + + self.inventory.add_host('boi') \ No newline at end of file