Coder Social home page Coder Social logo

fortigate-inventory-ansible's People

Contributors

emilvonck avatar

Watchers

 avatar

fortigate-inventory-ansible's Issues

inventory not working

I get below results

❯ ansible-inventory -i example_fortigate.yaml --list -vvvv
ansible-inventory [core 2.13.5]
  config file = /Users/emil/ansible-projects/test-fortigate-inventory/ansible.cfg
  configured module search path = ['/Users/emil/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
  ansible python module location = /Users/emil/Library/Caches/pypoetry/virtualenvs/fortigate-inventory-ansible-DldwIwzt-py3.8/lib/python3.8/site-packages/ansible
  ansible collection location = /Users/emil/.ansible/collections:/usr/share/ansible/collections
  executable location = /Users/emil/Library/Caches/pypoetry/virtualenvs/fortigate-inventory-ansible-DldwIwzt-py3.8/bin/ansible-inventory
  python version = 3.8.15 (default, Oct 11 2022, 21:31:25) [Clang 14.0.0 (clang-1400.0.29.102)]
  jinja version = 3.1.2
  libyaml = False
Using /Users/emil/ansible-projects/test-fortigate-inventory/ansible.cfg as config file
setting up inventory plugins
Loading collection evonck.fortigate from /Users/emil/.ansible/collections/ansible_collections/evonck/fortigate
[WARNING]:  * Failed to parse /Users/emil/ansible-projects/test-fortigate-inventory/example_fortigate.yaml with ansible_collections.evonck.fortigate.plugins.inventory.inventory plugin: 'NoneType'
object is not subscriptable
  File "/Users/emil/Library/Caches/pypoetry/virtualenvs/fortigate-inventory-ansible-DldwIwzt-py3.8/lib/python3.8/site-packages/ansible/inventory/manager.py", line 290, in parse_source
    plugin.parse(self._inventory, self._loader, source, cache=cache)
  File "/Users/emil/.ansible/collections/ansible_collections/evonck/fortigate/plugins/inventory/inventory.py", line 270, in parse
    self._fill_host_group_variables(host=host, hostname=hostname)
  File "/Users/emil/.ansible/collections/ansible_collections/evonck/fortigate/plugins/inventory/inventory.py", line 194, in _fill_host_group_variables
    safe_group_name = self._generate_safe_group_name(extracted_value)
  File "/Users/emil/.ansible/collections/ansible_collections/evonck/fortigate/plugins/inventory/inventory.py", line 201, in _generate_safe_group_name
    first_char: str = group_name[0]
[WARNING]:  * Failed to parse /Users/emil/ansible-projects/test-fortigate-inventory/example_fortigate.yaml with yaml plugin: Plugin configuration YAML file, not YAML inventory
  File "/Users/emil/Library/Caches/pypoetry/virtualenvs/fortigate-inventory-ansible-DldwIwzt-py3.8/lib/python3.8/site-packages/ansible/inventory/manager.py", line 290, in parse_source
    plugin.parse(self._inventory, self._loader, source, cache=cache)
  File "/Users/emil/Library/Caches/pypoetry/virtualenvs/fortigate-inventory-ansible-DldwIwzt-py3.8/lib/python3.8/site-packages/ansible/plugins/inventory/yaml.py", line 114, in parse
    raise AnsibleParserError('Plugin configuration YAML file, not YAML inventory')
[WARNING]:  * Failed to parse /Users/emil/ansible-projects/test-fortigate-inventory/example_fortigate.yaml with ini plugin: Invalid host pattern '---' supplied, '---' is normally a sign this is a
YAML file.
  File "/Users/emil/Library/Caches/pypoetry/virtualenvs/fortigate-inventory-ansible-DldwIwzt-py3.8/lib/python3.8/site-packages/ansible/inventory/manager.py", line 290, in parse_source
    plugin.parse(self._inventory, self._loader, source, cache=cache)
  File "/Users/emil/Library/Caches/pypoetry/virtualenvs/fortigate-inventory-ansible-DldwIwzt-py3.8/lib/python3.8/site-packages/ansible/plugins/inventory/ini.py", line 136, in parse
    raise AnsibleParserError(e)
[WARNING]: Unable to parse /Users/emil/ansible-projects/test-fortigate-inventory/example_fortigate.yaml as an inventory source
[WARNING]: No inventory was parsed, only implicit localhost is available

error when fortigate has offline devices with empty properties

❯ ansible-inventory -i example_fortigate.yaml --list -vvvv
ansible-inventory [core 2.13.6]
  config file = /Users/emil/ansible-projects/test-fortigate-inventory/ansible.cfg
  configured module search path = ['/Users/emil/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
  ansible python module location = /Users/emil/Library/Caches/pypoetry/virtualenvs/test-fgt-inventory-OiZhMrYG-py3.8/lib/python3.8/site-packages/ansible
  ansible collection location = /Users/emil/.ansible/collections:/usr/share/ansible/collections
  executable location = /Users/emil/Library/Caches/pypoetry/virtualenvs/test-fgt-inventory-OiZhMrYG-py3.8/bin/ansible-inventory
  python version = 3.8.15 (default, Oct 11 2022, 21:31:25) [Clang 14.0.0 (clang-1400.0.29.102)]
  jinja version = 3.1.2
  libyaml = False
Using /Users/emil/ansible-projects/test-fortigate-inventory/ansible.cfg as config file
setting up inventory plugins
host_list declined parsing /Users/emil/ansible-projects/test-fortigate-inventory/example_fortigate.yaml as it did not pass its verify_file() method
script declined parsing /Users/emil/ansible-projects/test-fortigate-inventory/example_fortigate.yaml as it did not pass its verify_file() method
Loading collection evonck.fortigate from /Users/emil/.ansible/collections/ansible_collections/evonck/fortigate
Using inventory plugin 'ansible_collections.evonck.fortigate.plugins.inventory.inventory' to process inventory source '/Users/emil/ansible-projects/test-fortigate-inventory/example_fortigate.yaml'
toml declined parsing /Users/emil/ansible-projects/test-fortigate-inventory/example_fortigate.yaml as it did not pass its verify_file() method
[WARNING]:  * Failed to parse /Users/emil/ansible-projects/test-fortigate-
inventory/example_fortigate.yaml with auto plugin: expected string or bytes-like object
  File "/Users/emil/Library/Caches/pypoetry/virtualenvs/test-fgt-inventory-OiZhMrYG-py3.8/lib/python3.8/site-packages/ansible/inventory/manager.py", line 290, in parse_source
    plugin.parse(self._inventory, self._loader, source, cache=cache)
  File "/Users/emil/Library/Caches/pypoetry/virtualenvs/test-fgt-inventory-OiZhMrYG-py3.8/lib/python3.8/site-packages/ansible/plugins/inventory/auto.py", line 59, in parse
    plugin.parse(inventory, loader, path, cache=cache)
  File "/Users/emil/.ansible/collections/ansible_collections/evonck/fortigate/plugins/inventory/inventory.py", line 268, in parse
    self._fill_host_variables(host=host, hostname=hostname)
  File "/Users/emil/.ansible/collections/ansible_collections/evonck/fortigate/plugins/inventory/inventory.py", line 182, in _fill_host_variables
    extracted_value = extractor(host)
  File "/Users/emil/.ansible/collections/ansible_collections/evonck/fortigate/plugins/inventory/inventory.py", line 128, in extract_os_release
    value = re.search(r"-.*-(.*)", host.get("os_version"))
  File "/opt/homebrew/opt/[email protected]/Frameworks/Python.framework/Versions/3.8/lib/python3.8/re.py", line 201, in search
    return _compile(pattern, flags).search(string)
[WARNING]:  * Failed to parse /Users/emil/ansible-projects/test-fortigate-
inventory/example_fortigate.yaml with yaml plugin: Plugin configuration YAML file, not YAML inventory
  File "/Users/emil/Library/Caches/pypoetry/virtualenvs/test-fgt-inventory-OiZhMrYG-py3.8/lib/python3.8/site-packages/ansible/inventory/manager.py", line 290, in parse_source
    plugin.parse(self._inventory, self._loader, source, cache=cache)
  File "/Users/emil/Library/Caches/pypoetry/virtualenvs/test-fgt-inventory-OiZhMrYG-py3.8/lib/python3.8/site-packages/ansible/plugins/inventory/yaml.py", line 114, in parse
    raise AnsibleParserError('Plugin configuration YAML file, not YAML inventory')
[WARNING]:  * Failed to parse /Users/emil/ansible-projects/test-fortigate-
inventory/example_fortigate.yaml with ini plugin: Invalid host pattern '---' supplied, '---' is normally
a sign this is a YAML file.
  File "/Users/emil/Library/Caches/pypoetry/virtualenvs/test-fgt-inventory-OiZhMrYG-py3.8/lib/python3.8/site-packages/ansible/inventory/manager.py", line 290, in parse_source
    plugin.parse(self._inventory, self._loader, source, cache=cache)
  File "/Users/emil/Library/Caches/pypoetry/virtualenvs/test-fgt-inventory-OiZhMrYG-py3.8/lib/python3.8/site-packages/ansible/plugins/inventory/ini.py", line 136, in parse
    raise AnsibleParserError(e)
[WARNING]: Unable to parse /Users/emil/ansible-projects/test-fortigate-inventory/example_fortigate.yaml
as an inventory source
[WARNING]: No inventory was parsed, only implicit localhost is available
{
    "_meta": {
        "hostvars": {}
    },
    "all": {
        "children": [
            "ungrouped"
        ]
    }
}

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.