Forge Home

gcloud_inventory

A task to generate Bolt inventory from Google Cloud compute engine instances

45,933 downloads

19,319 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.3.0 (latest)
  • 0.2.0
  • 0.1.3
  • 0.1.1
  • 0.1.0
released Mar 25th 2021
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
  • , , , , , ,

Start using this module

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

Add this module to your Puppetfile:

mod 'puppetlabs-gcloud_inventory', '0.3.0'
Learn more about managing modules with a Puppetfile

Add this module to your Bolt project:

bolt module add puppetlabs-gcloud_inventory
Learn more about using this module with an existing project

Manually install this module globally with Puppet module tool:

puppet module install puppetlabs-gcloud_inventory --version 0.3.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

puppetlabs/gcloud_inventory — version 0.3.0 Mar 25th 2021

gcloud_inventory

Table of Contents

  1. Description
  2. Requirements
  3. Usage

Description

This module includes a Bolt plugin to generate targets from Google Cloud compute engine instances.

Requirements

Usage

The plugin generates targets from a list of compute engine instances for a specific project and zone. It supports the following fields:

Option Type Description
credentials String A path to the service account credentials file. Accepts either an absolute path or a path relative to the Bolt project directory. Optional.
client_email String The Google Cloud client email to use. Optional.
token_uri String The Google Cloud token uri to use. Optional.
private_key String The Google Cloud private key to use. Optional.
project String The name of the project to lookup instances from. Required.
target_mapping Hash A hash of target attributes to populate with resource values. Must include either name or uri. Required.
zone String The name of the zone to lookup instances from. Required.

Credentials

The plugin supports loading a credentials file from a path specified in either the credentials option or the GOOGLE_APPLICATION_CREDENTIALS environment variable. A path specified in the credentials ption or credentials specified in the client_email, token_uri and private_key fields will take precedence over a path specified in the GOOGLE_APPLICATION_CREDENTIALS environment variable. If a credentials file is not specified, or the path does not point to a valid credentials file, the plugin will error.

The credentials file must contain a JSON object with at least the following fields:

  • client_email
  • private_key
  • token_uri

Target mapping

The target_mapping field accepts a hash of target attributes to populate with resource values. The hash of target attributes is formatted similarly to a target specification in an inventory file. Resource values are accessed using dot notation. For example, you can access an instance's public IP address using networkInterfaces.0.accessConfigs.0.natIP.

Example

---
# inventory.yaml
group:
  - name: google
    targets:
      _plugin: gcloud_inventory
      project: my_project
      zone: us-west1-b
      credentials: ~/.google/credentials.json
      target_mapping:
        name: name
        uri: networkInterfaces.0.accessConfigs.0.natIP
        vars: labels