azure_inventory

pdk
A task to generate Bolt inventory from Azure VMs

Puppet

puppetlabs

37,992 downloads

95 latest version

4.8 quality score

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 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/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