Forge Home

azure_inventory

A task to generate Bolt inventory from Azure VMs

61,228 downloads

22,759 latest version

4.8 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.5.0 (latest)
  • 0.4.1
  • 0.3.0
  • 0.2.0
  • 0.1.0
released Jan 21st 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-azure_inventory', '0.5.0'
Learn more about managing modules with a Puppetfile

Add this module to your Bolt project:

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

Manually install this module globally with Puppet module tool:

puppet module install puppetlabs-azure_inventory --version 0.5.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/azure_inventory — version 0.5.0 Jan 21st 2021

azure_inventory

Table of Contents

  1. Description
  2. Requirements
  3. Usage

Description

This module includes a Bolt plugin to generate Bolt targets from Azure VMs.

Requirements

You will need a client ID and secret in order to authenticate with Azure. The simplest way to generate these is to use the Azure CLI tool.

Run az ad sp create-for-rbac and copy the appId and password fields. These correspond to the client_id and client_secret parameters to the task.

Alternatively, you can follow the instructions to register a client application with Azure AD.

You will also need to know your subscription ID and tenant ID. If you're using the Azure CLI, you can retrieve these with az account show. These will be in the id and tenantId fields respectively.

Usage

The plugin supports looking up virtual machines and virtual machine scale sets. It supports several fields:

  • resource_group: The resource group to filter by (optional)
  • scale_set: The scale set to filter by (optional, requires that resource_group also be set)
  • location: The location to filter by (optional)
  • tags: A list of one or more tags to filter by (optional, tags are name: value pairs and instances must match all listed tags)

Accessing Azure resources requires credentials for signing all API requests. Each credential will be looked up from an environment variable if not set in the inventory config.

  • client_id: The Azure client application ID (defaults to $AZURE_CLIENT_ID)
  • client_secret: The Azure client application secret (defaults to $AZURE_CLIENT_SECRET)
  • tenant_id: The Azure AD tenant ID (defaults to $AZURE_TENANT_ID)
  • subscription_id: The Azure subscription ID (defaults to $AZURE_SUBSCRIPTION_ID)

Bolt will only target virtual machines and virtual machine scale sets that have a public IP address. The uri of the target will be set to the public IP address and the name will be set to either the fully qualified domain name if one exists or the instance name otherwise.

If scale_set is not provided, Bolt will not find VMs that are defined by a scale set.

Examples

# inventory.yaml
version: 2
groups:
  - name: azure-vms
    targets:
      - _plugin: azure_inventory
        tenant_id: xxxx-xxx-xxxx
        client_id: xxxx-xxx-xxxx
        client_secret: xxxx-xxx-xxxx
        subscription_id: xxxx-xxx-xxxx
        location: eastus
        resource_group: bolt
        tags:
          foo: bar
          baz: bak
  - name: azure-scale-sets
    targets:
      - _plugin: azure_inventory
        tenant_id: xxxx-xxx-xxxx
        client_id: xxxx-xxx-xxxx
        client_secret: xxxx-xxx-xxxx
        subscription_id: xxxx-xxx-xxxx
        location: eastus2
        resource_group: puppet
        scale_set: bolt
        tags:
          foo: bar