Skip to main content

A set of simple inventory that manages compute resources in a table.

Project description

Sometimes its necessary to maintain a simple inventory. Naturally if you know python you can do this with dicts. However to manage a large number of items with repeated values its is of advantage to do this from the commandline.

We have written such a tool that lets you easily manage the resources in a table format.

Installation

Make sure you have a new version of python and pip. We tested with

  • python 2.7.9

  • pip 6.11

It may work with other python versions, but we have not tried it.

From Pip:

pip install cloudmesh_inventory

From Source

mkdir github
cd github

git clone https://github.com/cloudmesh/base.git
cd base
python setup.py install
cd ..

git clone https://github.com/cloudmesh/cmd3.git
cd cmd3
python setup.py install
cd ..

git clone https://github.com/cloudmesh/inventory.git
cd cmd3
python setup.py install
cd ..

Configuration

Your inventory will be located at

  • ~/.cloudmesh/inventory.yaml

You can also change the yaml file by hand, but the cm command is more convenient.

This location can be changed in the file

  • ~/.cloudmesh/cloudmesh_system.yaml

If you have not yet created a cmd3.yaml file you can do this with:

cm setup_yaml

Edit the file ~/.cloudmesh/cmd3.yaml and add to the plugin list:

  • cloudmesh_inventory.plugin

Manpage

Usage:
    inventory add NAMES [--label=LABEL]
                        [--service=SERVICES]
                        [--project=PROJECT]
                        [--owners=OWNERS]
                        [--comment=COMMENT]
                        [--cluster=CLUSTER]
                        [--ip=IP]
    inventory set NAMES for ATTRIBUTE to VALUES
    inventory delete NAMES
    inventory clone NAMES from SOURCE
    inventory list [NAMES] [--format=FORMAT] [--columns=COLUMNS]
    inventory info

Arguments:

  NAMES     Name of the resources (example i[10-20])

  FORMAT    The format of the output is either txt,
            yaml, dict, table [default: table].

  OWNERS    a comma separated list of owners for this resource

  LABEL     a unique label for this resource

  SERVICE   a string that identifies the service

  PROJECT   a string that identifies the project

  SOURCE    a single host name to clone from

  COMMENT   a comment

Options:

   -v       verbose mode

Description:

      add -- adds a resource to the resource inventory

      list -- lists the resources in the given format

      delete -- deletes objects from the table

      clone -- copies the content of an existing object
               and creates new once with it

      set   -- sets for the specified objects the attribute
               to the given value or values. If multiple values
               are used the values are assigned to the and
               objects in order. See examples

      map   -- allows to set attibutes on a set of objects
               with a set of values

Examples:

  cm inventory add x[0-3] --service=openstack

      adds hosts x0, x1, x2, x3 and puts the string
      openstack into the service column

  cm lits

      lists the repository

  cm x[3-4] set temperature to 32

      sets for the resources x3, x4 the value of the
      temperature to 32

  cm x[7-8] set ip 128.0.0.[0-1]

      sets the value of x7 to 128.0.0.0
      sets the value of x8 to 128.0.0.1

  cm clone x[5-6] from x3

      clones the values for x5, x6 from x3

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

cloudmesh_inventory-1.2.8.zip (14.0 kB view hashes)

Uploaded Source

cloudmesh_inventory-1.2.8.tar.bz2 (7.1 kB view hashes)

Uploaded Source

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page