Skip to content

Instantly share code, notes, and snippets.

@blackknight36
Last active April 24, 2016 12:52
Show Gist options
  • Save blackknight36/b906ca1503d31f28b2709f91d8fcc8fa to your computer and use it in GitHub Desktop.
Save blackknight36/b906ca1503d31f28b2709f91d8fcc8fa to your computer and use it in GitHub Desktop.
#!/usr/bin/python
from pypuppetdb import connect
import platform
hostname = platform.node()
cert = '/etc/puppetlabs/puppet/ssl/certs/%s.pem' %hostname
key = '/etc/puppetlabs/puppet/ssl/private_keys/%s.pem' %hostname
ca_cert = '/etc/puppetlabs/puppet/ssl/ca/ca_crt.pem'
puppetdb_host = 'puppetdb.example.com'
db = connect(host=puppetdb_host, port=8081, ssl_key=key, ssl_cert=cert, ssl_verify=ca_cert)
nodes = db.nodes()
for node in nodes:
print(node)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment