Forge Home

container_inventory

Enumerates various container runtimes for bolt inventory

2,386 downloads

1,673 latest version

5.0 quality score

We run a couple of automated
scans to help you access a
module's quality. Each module is
given a score based on how well
the author has formatted their
code and documentation and
modules are also checked for
malware using VirusTotal.

Please note, the information below
is for guidance only and neither of
these methods should be considered
an endorsement by Puppet.

Version information

  • 0.1.1 (latest)
  • 0.1.0
released Oct 12th 2020
This version is compatible with:
  • Puppet Enterprise 2019.8.x, 2019.7.x, 2019.5.x, 2019.4.x, 2019.3.x, 2019.2.x, 2019.1.x, 2019.0.x, 2018.1.x, 2017.3.x, 2017.2.x, 2016.4.x
  • Puppet >= 4.10.0 < 7.0.0
  • , , , , , ,

Start using this module

  • r10k or Code Manager
  • Bolt
  • Manual installation
  • Direct download

Add this module to your Puppetfile:

mod 'nwops-container_inventory', '0.1.1'
Learn more about managing modules with a Puppetfile

Add this module to your Bolt project:

bolt module add nwops-container_inventory
Learn more about using this module with an existing project

Manually install this module globally with Puppet module tool:

puppet module install nwops-container_inventory --version 0.1.1

Direct download is not typically how you would use a Puppet module to manage your infrastructure, but you may want to download the module in order to inspect the code.

Download

Documentation

nwops/container_inventory — version 0.1.1 Oct 12th 2020

Bolt Container Inventory

This is a bolt container inventory plugin used to enumerate the currently running containers on your local docker host. Currently there is limited functionality but the plan is to add additional features to cover more runtimes and use cases.

Description

Bolt can use docker as a transport but there hasn't been a way to easily list the containers without this plugin. This plugin will run docker ps --filter status=running -q from the command line to return the current list of running containers. At the moment there is no way to alter this list with configuration.

Setup

You will need to have the puppetlabs/ruby_task_helper module and this module installed in your bolt module path.

Configuration

Ensure you inventory uses the plugin container_inventory name like below.

---
groups:
  - _plugin: container_inventory
    config:
      transport: docker
    parameters: 
      format: groups
      use_hostname: true

For fixtures:

# modulepath/.fixtures.yml

repositories:
  container_inventory: 'https://gitlab.com/nwops/bolt-container_inventory'

Usage

If you are using docker compose you can format the inventory as groups and return only containers from a specific docker-compose file. In this example standard is the name of my project in docker-compose. Because of this we can filter out only containers in the standard project and group them. By default if multiple docker-compose projects are running all containers will be returned. With bolt you can filter using the --targets=standard or whatever your project name is.

bolt command run 'uname -i' --targets=standard -i inventory.yaml 
Started on docker://bb8531de599e...
Finished on docker://bb8531de599e:
  STDOUT:
    x86_64
Successful on 1 target: docker://bb8531de599e
Ran on 1 target in 1.07 sec