Forge Home

github_inventory

A Bolt plugin that generates local Targets from GitHub org repositories

3,756 downloads

1,342 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.4.2 (latest)
  • 0.4.1
  • 0.4.0
  • 0.3.0
  • 0.2.1
  • 0.2.0
  • 0.1.0
released Dec 31st 2020
This version is compatible with:
  • Puppet Enterprise 2023.2.x, 2023.1.x, 2023.0.x, 2021.7.x, 2021.6.x, 2021.5.x, 2021.4.x, 2021.3.x, 2021.2.x, 2021.1.x, 2021.0.x, 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 < 8.0.0
  • , , , , , , ,
Tasks:
  • resolve_reference
Plans:
  • latest_semver_tags
  • required_checks
  • workflows

Start using this module

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

Add this module to your Puppetfile:

mod 'bolterrific-github_inventory', '0.1.0'
Learn more about managing modules with a Puppetfile

Add this module to your Bolt project:

bolt module add bolterrific-github_inventory
Learn more about using this module with an existing project

Manually install this module globally with Puppet module tool:

puppet module install bolterrific-github_inventory --version 0.1.0

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

bolterrific/github_inventory — version 0.1.0 Dec 31st 2020

github_inventory

Table of Contents

Description

github_inventory is an inventory reference plugin for Puppet Bolt. It uses the GitHub API to dynamically provide a list of local transport Targets that represent each repository under a GitHub org.

This module also contains an example Bolt project with a working inventory.yaml and several Bolt plans.

Setup

Setup Requirements

  • Puppet Bolt 2.15+, installed from an OS package (don't use the RubyGem)
    • Note: The example inventory.yaml assumes Bolt 2.37+ (see comments)
  • A GitHub API personal auth token with sufficient scope
  • The octokit RubyGem

Beginning with github_inventory

  1. If you are using rvm, you must disable it before running bolt:

    rvm use system
    
  2. Install the RubyGem dependencies using Bolt's gem command

    On most platforms:

    /opt/puppetlabs/bolt/bin/gem install --user-install -g gem.deps.rb
    

    On Windows:

    "C:/Program Files/Puppet Labs/Bolt/bin/gem.bat" install --user-install -g gem.deps.rb
    
  3. (If using the example Bolt plans in this module)

Usage

To use this plugin in your own Bolt project, configure it to provide targets in the inventory file.

Using the plugin in a Bolt inventory file

An example inventory.yaml file:

version: 2

groups:
  - name: repo_targets
    targets:
      - _plugin: github_inventory  # <- Plugin provides `local` Targets
        org: simp                  # <- GitHub org with Target repos
        github_api_token:          # <- API token with scope that can get repos
          _plugin: env_var         # <- (provided by another Bolt plugin)
          var: GITHUB_API_TOKEN

config:
  transport: local
  local:
    interpreters:
      .rb: /opt/puppetlabs/bolt/bin/ruby
    tmpdir:
     _plugin: env_var
     var: PWD

Reference

See REFERENCE.md

Limitations

In order to provide an example bolt project in the same module as the inventory plugin, the example bolt-project.yaml adds .. to the modulepath. This means that (when using the example bolt project) the folder containing this repo must be named github_inventory. There may be other weirdness, depending on this folders' neighbors.

This quirk only affects the example bolt project; it will not affect the inventory plugin or Bolt plans from your own Bolt projects.

Development

Submit PRs on the project's GitHub page.