Skip to main content

Python MaaS and Juju toolkit

Project description

pyjamaas

Python Juju and MaaS toolkit.

Features

pyjamaas simplifies interaction with MaaS and Juju when working with a large number of heterogenous machines. It heavily utilizes the MaaS tags mechanism.

Features:

  • pyjamaas tags: Easily create, delete and update multiple tags for multiple machines
  • pyjamaas clone: Easily clone configuration to multiple machines, using tags
  • pyjamaas machine: Utility commands for retrieving machine information

Also see examples

Installation

$ pip install pyjamaas

Configuration

pyjamaas needs MaaS credentials. You can use environment variables:

$ export MAAS_API_URL=https://maas.server.name:5240/MAAS/api/2.0
$ export MAAS_API_KEY=AAAAAAAAAAAAAA:BBBBBBBBBBBBBBB:CCCCCCCCCCCCCCC

Or create a pyjamaas.conf file (see sample):

[maas]
api_url = https://maas.server.name:5240/MAAS/api/2.0
api_key = AAAAAAAAAAAAAA:BBBBBBBBBBBBBBB:CCCCCCCCCCCCCCC
$ pyjamaas <command> --config-file pyjamaas.conf

pyjamaas will automatically look for config files in a few standard directories, e.g. /etc/pyjamaas.conf, /etc/pyjamaas/pyjamaas.conf, ~/.pyjamaas/pyjamaas.conf).

Print loaded configuration with pyjamaas config. If a required option is missing, an error message is printed:

$ pyjamaas config
value required for option api_key in group [maas]

Usage

For a list of available commands:

$ pyjamaas --help

Most pyjamaas commands have the format pyjamaas <command> <args> --match <filter>. The <filter> can be used to select machines based on system_id, hostname, or tags. The examples below should be clear enough:

# Match a single machine using hostname
$ pyjamaas machine list --match '{hostname: host1}'
# Match multiple machines by hostname
$ pyjamaas machine list --match '{hostname: [host1, host2]}'
# Match multiple machines by system id
$ pyjamaas machine list --match '{system_id: [system1, system2]}'
# Match machines using tags (multiple tags imply AND)
$ pyjamaas machine list --match '{tags: [tag1, tag2]}'

Auto completion

Enable auto-completion with:

$ . <(pyjamaas complete)

Project details


Download files

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

Source Distribution

pyjamaas-0.6.tar.gz (8.8 kB view hashes)

Uploaded Source

Built Distribution

pyjamaas-0.6-py3-none-any.whl (29.3 kB view hashes)

Uploaded Python 3

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