GithubHelp home page GithubHelp logo

dmsimard / ansible-inventory-puppetdb Goto Github PK

View Code? Open in Web Editor NEW
55.0 55.0 16.0 27 KB

Leverage Puppet facts and PuppetDB to generate a dynamic Ansible inventory

License: Apache License 2.0

Python 100.00%

ansible-inventory-puppetdb's People

Contributors

dmsimard avatar madhakish avatar sepulworld avatar techcadia avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

ansible-inventory-puppetdb's Issues

TypeError: connect() got an unexpected keyword argument 'api_version'

Thanks for your work on this and I'm hoping I can get it working. I updated puppetdb.yml with my info:

host: 10.2.0.10
api_version: 3
port: 8081
timeout: 10
ssl_verify: False
ssl_key:
ssl_cert:
cache_file: '/tmp/ansible-inventory-puppetdb.cache'
cache_duration: 30
group_by:
group_by_tag:

but when I run ./puppetdb.py --list I get:

Traceback (most recent call last): File "./puppetdb.py", line 234, in <module> main() File "./puppetdb.py", line 226, in main inventory = PuppetdbInventory(args.refresh) File "./puppetdb.py", line 86, in __init__ self.puppetdb = connect(**puppetdb_config) TypeError: connect() got an unexpected keyword argument 'api_version'

Any ideas?

404 Client Error with pypuppetdb==0.1.1

[root@puppetmaster ansible-inventory-puppetdb]# pip freeze | grep -i pypuppetdb
You are using pip version 8.1.2, however version 10.0.1 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.
pypuppetdb==0.1.1
>>> from pypuppetdb import connect
>>> db = connect()
>>> nodes = db.nodes()
>>> for node in nodes:
...   print(node)
...
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/lib/python2.7/site-packages/pypuppetdb/api/v3.py", line 55, in nodes
    nodes = self._query('nodes', path=name, query=query)
  File "/usr/lib/python2.7/site-packages/pypuppetdb/api/__init__.py", line 267, in _query
    r.raise_for_status()
  File "/usr/lib/python2.7/site-packages/requests/models.py", line 935, in raise_for_status
    raise HTTPError(http_error_msg, response=self)
requests.exceptions.HTTPError: 404 Client Error: Not Found for url: http://localhost:8080/v3/nodes
>>>
>>> exit()
[root@puppetmaster ansible-inventory-puppetdb]# pip install pypuppetdb==0.2.3
< long out put skipped >
Successfully installed pypuppetdb-0.2.3
You are using pip version 8.1.2, however version 10.0.1 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.
[root@puppetmaster ansible-inventory-puppetdb]# python
Python 2.7.5 (default, Jun 24 2015, 00:41:19)
[GCC 4.8.3 20140911 (Red Hat 4.8.3-9)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> from pypuppetdb import connect
>>> db = connect()
>>> nodes = db.nodes()
>>> for node in nodes:
...   print(node)
...
puppetmaster
host1
host2
host3
<and so on>

and hence the with pypuppetdb version 0.1.1 gives this error

[root@puppetmaster ansible-inventory-puppetdb]# ./puppetdb.py --list
Traceback (most recent call last):
  File "./puppetdb.py", line 230, in <module>
    main()
  File "./puppetdb.py", line 224, in main
    print(inventory.get_host_list())
  File "./puppetdb.py", line 115, in get_host_list
    groups = self.fetch_host_list()
  File "./puppetdb.py", line 168, in fetch_host_list
    for node in self.puppetdb.nodes():
  File "/usr/lib/python2.7/site-packages/pypuppetdb/api/v3.py", line 55, in nodes
    nodes = self._query('nodes', path=name, query=query)
  File "/usr/lib/python2.7/site-packages/pypuppetdb/api/__init__.py", line 267, in _query
    r.raise_for_status()
  File "/usr/lib/python2.7/site-packages/requests/models.py", line 935, in raise_for_status
    raise HTTPError(http_error_msg, response=self)
requests.exceptions.HTTPError: 404 Client Error: Not Found for url: http://localhost:8080/v3/nodes

but with version 0.2.3, works just fine

[root@puppetmaster ansible-inventory-puppetdb]# ./puppetdb.py --list | jq '.all.hosts | length'
27

Repo maintenance

Do you still have plans to maintain this repository? There are 2 year old pull requests which need to be merged to enable connectivity with recent versions of puppetdb.

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.