A command called inventory and foo for the cloudmesh shell
Project description
Cloudmesh Inventory
Instalation and Documentation
Please note that several packages are available which are pointed to in the instalation documentation.
Links | |
---|---|
Documentation | https://cloudmesh.github.io/cloudmesh-cloud |
Code | https://github.com/cloudmesh/cloudmesh-inventory |
Instalation Instructions | https://github.com/cloudmesh/get |
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 3.7.3
- pip 19.0.3
Instalation with pip
You will need the followng other cloudmesh modules before you can install via pip:
$ pip insatll cloudmesh-common
$ pip insatll cloudmesh-cmd5
$ pip insatll cloudmesh-inventory
Instalation from source
To install it form source (which is the current method) use:
mkdir ~/github
cd ~/github
git clone https://github.com/cloudmesh-common.git
git clone https://github.com/cloudmesh-cmd5.git
git clone https://github.com/cloudmesh-inventory.git
cd ~/github/cloudmesh-common
python setup.py install
pip install -e .
cd ~/github/cloudmesh-cmd5
python setup.py install
pip install -e .
cd ~/github/cloudmesh-inventory
python setup.py install
pip install -e .
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.
An example file will look as follows:
g001:
cluster: gregor
comment: test
host: g001
ip: 127.0.0.1
label: g001
metadata: None
name: g001
owners: gvonlasz
project: cloudmesh
service: compute
g002:
cluster: gregor
comment: test
host: g002
ip: 127.0.0.1
label: g002
metadata: None
name: g002
owners: gvonlasz
project: cloudmesh
service: compute
BUGS
This command has not be extensively tested and we are sure we have not yet implemented everything. Please help improving it by forking and contributing via pull requests.
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
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Hashes for cloudmesh-inventory-4.0.24.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | bd6e87cf94fc4a7e96966cc000f18abfec8cb9cead68829a7bb43072992211aa |
|
MD5 | 074c4e8e23dd3fe851b1e4c06560b15a |
|
BLAKE2b-256 | 569c786c24af23e822a756727dfcabd138cad2de745389cf345d2e44d5e7166d |
Hashes for cloudmesh_inventory-4.0.24-py2.py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 93c70024c9a5f48afda81fa8ba87246663770c25ff82edbcb7ce29636e4b2717 |
|
MD5 | 19b305771cc576b0d629652e89f0eb21 |
|
BLAKE2b-256 | 8341370a35b6309255383002396f4d430b7d6e795a65200ddb34dd325fcdd098 |