Ansible инвентарь плагин нетбокс - PullRequest
0 голосов
/ 28 декабря 2018

Я пытаюсь получить динамический инвентарь Ansible с IPAM netbox в качестве источника доверия.Но я получаю сообщение об ошибке при выполнении ansible-inventory с плагином инвентаризации netbox.

root@server:/opt/ansible/projects/customer# ansible --version
ansible 2.7.4
  config file = /opt/ansible/projects/customer/ansible.cfg
  configured module search path = [u'/root/.ansible/plugins/modules', u'/usr/share/ansible/plugins/modules']
  ansible python module location = /usr/local/lib/python2.7/dist-packages/ansible-2.7.4-py2.7.egg/ansible
  executable location = /usr/local/bin/ansible
  python version = 2.7.13 (default, Sep 26 2018, 18:42:22) [GCC 6.3.0 20170516]

ansible.cfg

inventory_plugins  = /opt/ansible/plugins/plugin_type/inventory_plugins
[inventory]
# enable inventory plugins, default: 'host_list', 'script', 'yaml', 'ini', 'auto'
enable_plugins = netbox, ini, yaml, auto

netbox_inventory2.yaml

name: netbox
plugin_type: inventory
short_description: Netbox Inventory Source

plugin: netbox
api_endpoint: https://localhost:8000
token: ‘token’
validate_certs: False
group_by:
  - device_roles

Это сообщение об ошибке:

ansible-inventory -vvv --list -i netbox_inventory2.yaml
ansible-inventory 2.7.4
  config file = /opt/ansible/projects/customer/ansible.cfg
  configured module search path = [u'/root/.ansible/plugins/modules', u'/usr/share/ansible/plugins/modules']
  ansible python module location = /usr/local/lib/python2.7/dist-packages/ansible-2.7.4-py2.7.egg/ansible
  executable location = /usr/local/bin/ansible-inventory
  python version = 2.7.13 (default, Sep 26 2018, 18:42:22) [GCC 6.3.0 20170516]
Using /opt/ansible/projects/customer/ansible.cfg as config file
ERROR! Unexpected Exception, this is probably a bug: 'module' object has no attribute 'InventoryModule'
the full traceback was:

Traceback (most recent call last):
  File "/usr/local/lib/python2.7/dist-packages/ansible-2.7.4-py2.7.egg/EGG-INFO/scripts/ansible-inventory", line 118, in <module>
    exit_code = cli.run()
  File "/usr/local/lib/python2.7/dist-packages/ansible-2.7.4-py2.7.egg/ansible/cli/inventory.py", line 137, in run
    self.loader, self.inventory, self.vm = self._play_prereqs(self.options)
  File "/usr/local/lib/python2.7/dist-packages/ansible-2.7.4-py2.7.egg/ansible/cli/__init__.py", line 786, in _play_prereqs
    inventory = InventoryManager(loader=loader, sources=options.inventory)
  File "/usr/local/lib/python2.7/dist-packages/ansible-2.7.4-py2.7.egg/ansible/inventory/manager.py", line 145, in __init__
    self.parse_sources(cache=True)
  File "/usr/local/lib/python2.7/dist-packages/ansible-2.7.4-py2.7.egg/ansible/inventory/manager.py", line 196, in parse_sources
    self._setup_inventory_plugins()
  File "/usr/local/lib/python2.7/dist-packages/ansible-2.7.4-py2.7.egg/ansible/inventory/manager.py", line 184, in _setup_inventory_plugins
    plugin = inventory_loader.get(name)
  File "/usr/local/lib/python2.7/dist-packages/ansible-2.7.4-py2.7.egg/ansible/plugins/loader.py", line 381, in get
    obj = getattr(self._module_cache[path], self.class_name)
AttributeError: 'module' object has no attribute 'InventoryModule'

Я знаю, что модуль должен работать, но не могу найти свою ошибку.

Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...