예제 #1
0
    def _setup_inventory_plugins(self):
        ''' sets up loaded inventory plugins for usage '''

        inventory_loader = PluginLoader('InventoryModule', 'ansible.plugins.inventory', 'inventory_plugins', 'inventory_plugins')
        display.vvvv('setting up inventory plugins')

        for name in C.INVENTORY_ENABLED:
            plugin = inventory_loader.get(name)
            if plugin:
                self._inventory_plugins.append(plugin)
            else:
                display.warning('Failed to load inventory plugin, skipping %s' % name)

        if not self._inventory_plugins:
            raise AnsibleError("No inventory plugins available to generate inventory, make sure you have at least one whitelisted.")
예제 #2
0
    def _setup_inventory_plugins(self):
        ''' sets up loaded inventory plugins for usage '''

        inventory_loader = PluginLoader('InventoryModule',
                                        'ansible.plugins.inventory',
                                        'inventory_plugins',
                                        'inventory_plugins')
        display.vvvv('setting up inventory plugins')

        for name in C.INVENTORY_ENABLED:
            plugin = inventory_loader.get(name)
            name = os.path.splitext(os.path.basename(plugin._original_path))[0]
            self._inventory_plugins[name] = plugin

        if not self._inventory_plugins:
            raise AnsibleError(
                "No inventory plugins available to generate inventory, make sure you have at least one whitelisted."
            )