node collaboration - exported resources and puppetdb

Post on 15-Jan-2015

647 Views

Category:

Technology

1 Downloads

Preview:

Click to see full reader

DESCRIPTION

Node Collaboration - How can your servers share information with each other. Exploring Exported Resources, PuppetDB and other methods. This talk was given at Sydney Puppet Users Meetup on 14/08/2014.

TRANSCRIPT

Node collaboration

How can your servers share information with each other?

Michael Richardson@m_richo

Warning!!

This talk contains both Facts and Opinions*.

*don’t believe everything I say.

Puppet’s answer

Puppet’s answer

Exported Resources!

Exported Resources

* https://docs.puppetlabs.com/puppet/latest/reference/lang_exported.html

Definition:An exported resource declaration specifies a desired state

for a resource, does not manage the resource on the target system, and publishes the resource for use by other nodes. Any node (including the node that exported it) can

then collect the exported resource and manage its own copy of it. *

Exported Resources

Exported Resources

For those that can’t afford DNS servers…

Exported Resources

Common Examples• Backend servers configured in a load balancer• Monitoring Servers updated with monitoring

clients (nagios_host / nagios_service)• Distribute public keys (ssh and openssl)

Exported Resources

Question for the audience

Exported Resources

Question for the audience

What do you think of Exported Resources?

Exported Resources

Question for the audience

What do you think of Exported Resources?

Great. Alright. So so.Let’s explore alternatives

What about our friends @

Ohai Node data (think facter) is automatically added, indexed and

searchable in the Chef Server.

No need to export facts or resources.

How to use Chef Search

Query the the Chef server data via

• Method within recipe (think puppet manifest)• Search subcommand of ‘knife’• /search or /search/INDEX endpoints of Chef

Server API

How to use Chef Search

1. Method within recipe (think puppet manifest)

Chef Search

What do people think?

Chef Search

What do people think?

Personally I feel this approach can sometimes be better than exported resources approach. *

* Remember this is an opinion

But what about Puppet?

Introducing PuppetDB

PuppetDB

Definition:collects data generated by Puppet. It enables

advanced Puppet features like the inventory service and exported resources, and can be the foundation

for other applications that use Puppet’s data. *

https://docs.puppetlabs.com/puppetdb/2.1/index.html

PuppetDB

• Written in Clojure.• Runs on the JVM• Backed by PostgreSQL• Scales horizontally

PuppetDB

PuppetDB stores:• The most recent facts from every node• The most recent catalog for every node• Optionally, 14 days of event reports for

every node• Exported Resources

PuppetDB

PuppetDB REST APIV3 API includes the following endpoints:

• Facts• Resources• Nodes• Fact-names,• Metrics

• Reports• Events• And more

PuppetDBGET /v3/nodes/

PuppetDBGET /v3/nodes/

QUERY = (JSON array of queries)

PuppetDBGET /v3/nodes/<NODE>/facts

Return all facts for given node

PuppetDBGET /v3/nodes/<NODE>/facts/<NAME>Return facts by their name

PuppetDB

I know what you’re thinkingSo much awesome information

How can I make use of it?

PuppetDB

checkoutPuppetdbquery module

by Erik Dalén

https://forge.puppetlabs.com/dalen/puppetdbqueryhttps://github.com/dalen/puppet-puppetdbquery

PuppetDB

Puppetdbquery module• Command line tools• Puppet functions to query PuppetDB• Hiera backend to return query results from

PuppetDB

PuppetDBPuppetdbquery CLI - nodes

facts

resources

PuppetDBPuppetdbquery CLI – facts

PuppetDBPuppetdbquery CLI – facts

factsquery

PuppetDBPuppetdbquery functions in manifests

• query_nodes

• query_facts

PuppetDBPuppetdbquery functionsquery fact

PuppetDBPuppetdbquery functions

note: Output is abbreviated

array

hash

Where to from here?

Exported Resourcesvs

PuppetDB + puppetdbquery

Where to from here?What about something

completely different

Where to from here?What about something

completely different

• Confd• Etcd• Consul

• Zookeeper• Doozer• Skydns

Where to from here?What about something

completely different

• Confd• Etcd• Consul

• Zookeeper• Doozer• Skydns

Really interesting space… but that’s for another talk.

SummaryHow can you share information between your nodes/servers?

SummaryHow can you share information between your nodes/servers?

Plenty of ways• Exported resources• PuppetDB• Many, many others.

SummaryHow can you share information between your nodes/servers?

Plenty of ways• Exported resources• PuppetDB• Many, many others.

Pick the method that works best for you

Thank you

Thank you

#protipgo buy this book nowBy Alessandro FranceschiIt is excellent!

IS HIRING

QUESTIONS?

top related