gcloud_inventory

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

Puppet

puppetlabs

21,383 downloads

428 latest version

5.0 quality score

Version information

  • 0.2.0 (latest)
  • 0.1.3
  • 0.1.1
  • 0.1.0
released Jan 22nd 2021
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 < 8.0.0
  • CentOS
    ,
    OracleLinux
    ,
    RedHat
    ,
    Scientific
    ,
    Debian
    ,
    Ubuntu
    ,
    windows

Start using this module

Documentation

puppetlabs/gcloud_inventory — version 0.2.0 Jan 22nd 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.
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 option 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