Giter VIP home page Giter VIP logo

puppetlabs-inventory's Introduction

inventory provides a new Puppet command which outputs a data structure describing properties of the system on which it's run.

Puppet Forge Build Status

Here's a quick example:

$ puppet inventory | head -n 20
{
  "schema_version": 1,
  "created": "2016-07-14T07:42:01Z",
  "resources": [
    {
      "title": "root",
      "resource": "group",
      "gid": 0
    },
    {
      "title": "bin",
      "resource": "group",
      "gid": 1
    },
    {
      "title": "daemon",
      "resource": "group",
      "gid": 2
    },
    {

Specifically inventory outputs information on:

  • Users
  • Groups
  • Packages
  • Services
  • Facts

If you have the Lumogon module installed then it will also detect information about running Docker containers.

All of this information is already available via the RAL and puppet resource or via facter. inventory simply offers a higher-level interface, a single command that outputs everything in a simplified data format.

Installation

inventory is packaged as a Puppet Module, and can be installed from the Forge like so:

puppet module install puppetlabs-inventory

You can also include in your Puppetfile if using r10k or librarian-puppet:

mod 'puppetlabs/inventory'

Demonstration

A simple way of demonstrating the module is to use Docker. Docker is not required, it just makes for nice single line examples. The following should be run from a checkout of this repository.

Output inventory information for the puppet/puppet-agent-alpine image from Hub:

docker run --rm -it -v $(pwd):/src:ro -e RUBYLIB=/src/lib puppet/puppet-agent-alpine inventory

Output the same information but instead of formatted JSON render the output as YAML:

docker run --rm -it -v $(pwd):/src:ro -e RUBYLIB=/src/lib puppet/puppet-agent-alpine inventory --render-as yaml

Only generate the resources portion of the output:

docker run --rm -it -v $(pwd):/src:ro -e RUBYLIB=/src/lib puppet/puppet-agent-alpine inventory resources

Only generate the facts portion of the output:

docker run --rm -it -v $(pwd):/src:ro -e RUBYLIB=/src/lib puppet/puppet-agent-alpine inventory facts

If you're doing something specific to Puppet you can also output the full Puppet Catalog. This is also an easy way of seeing how Puppet works under the hood.

docker run --rm -it -v $(pwd):/src:ro -e RUBYLIB=/src/lib puppet/puppet-agent-alpine inventory catalog

The above examples all use images which already have Puppet installed on them. This example runs an inventory of the vanilla centos image, which does not have Puppet installed. It does that by mounting Puppet from another container as described in the Puppet-in-Docker examples:

docker run --name puppet-agent -v /opt/puppetlabs puppet/puppet-agent-ubuntu --version
docker run --rm -it --volumes-from=puppet-agent -v $(pwd):/src:ro -e RUBYLIB=/src/lib centos /opt/puppetlabs/bin/puppet inventory all

Puppet inventory is also available as a Docker Image from Hub. So the following is a clearer way of doing the above

docker run --name puppet-inventory puppet/puppet-inventory
docker run --rm -it --volumes-from=puppet-inventory centos /opt/puppetlabs/bin/puppet inventory

Status and Schema Version

This is an early prototype at the moment and based on experience with writing clients for the generated format the structure of the data produced may change a lot between now and a 1.0 release of the module. I will increment the schema_version key in the output if/when I make changes but until the module hits a 1.0 release don't expect any backwards compatibility guarantees.

Maintainers

This repository is maintained by: Gareth Rushgrove [email protected].

puppetlabs-inventory's People

Contributors

garethr avatar

Stargazers

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

Watchers

 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  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

puppetlabs-inventory's Issues

version `GLIBC_2.17' not found (required by /opt/puppetlabs/puppet/lib/libruby.so.2.1)

I am trying to use the inventory container to inventory the contents of some other containers on docker hub.

$ docker run --name puppet-inventory puppet/puppet-inventory
$docker run --rm -it -u root --volumes-from=puppet-inventory ubuntu:12.04 /opt/puppetlabs/bin/puppet inventory
/opt/puppetlabs/puppet/bin/ruby: /lib/x86_64-linux-gnu/libc.so.6: version `GLIBC_2.17' not found (required by /opt/puppetlabs/puppet/lib/libruby.so.2.1)

Are there any additional volumes that should be created in the puppet-inventory container (like libc.so) to allow the container to function with older base images?

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.