states.azurerm.compute.ssh_public_key

Azure Resource Manager (ARM) Compute SSH Public Key State Module

New in version 4.0.0.

maintainer:

<devops@eitr.tech>

configuration:

This module requires Azure Resource Manager credentials to be passed via acct. Note that the authentication parameters are case sensitive.

Required provider parameters:

if using username and password:
  • subscription_id
  • username
  • password
if using a service principal:
  • subscription_id
  • tenant
  • client_id
  • secret

Optional provider parameters:

cloud_environment: Used to point the cloud driver to different API endpoints, such as Azure GovCloud. Possible values:

  • AZURE_PUBLIC_CLOUD (default)
  • AZURE_CHINA_CLOUD
  • AZURE_US_GOV_CLOUD
  • AZURE_GERMAN_CLOUD

Example acct setup for Azure Resource Manager authentication:

azurerm:
    default:
        subscription_id: 3287abc8-f98a-c678-3bde-326766fd3617
        tenant: ABCDEFAB-1234-ABCD-1234-ABCDEFABCDEF
        client_id: ABCDEFAB-1234-ABCD-1234-ABCDEFABCDEF
        secret: XXXXXXXXXXXXXXXXXXXXXXXX
        cloud_environment: AZURE_PUBLIC_CLOUD
    user_pass_auth:
        subscription_id: 3287abc8-f98a-c678-3bde-326766fd3617
        username: fletch
        password: 123pass

The authentication parameters can also be passed as a dictionary of keyword arguments to the connection_auth parameter of each state, but this is not preferred and could be deprecated in the future.

idem_azurerm.states.azurerm.compute.ssh_public_key.absent(hub, ctx, name, resource_group, connection_auth=None, **kwargs)

New in version 4.0.0.

Ensures the specified SSH public key resource does not exist.

Parameters:
  • name – The name of the SSH public key resource.
  • resource_group – The name of the resource group.
  • connection_auth – A dict with subscription and authentication parameters to be used in connecting to the Azure Resource Manager API.

Example usage:

Ensure ssh public key absent:
    azurerm.compute.ssh_public_key.absent:
        - name: test_key
        - resource_group: test_group
idem_azurerm.states.azurerm.compute.ssh_public_key.present(hub, ctx, name, resource_group, public_key=None, generate_key_pair=False, tags=None, connection_auth=None, **kwargs)

New in version 4.0.0.

Ensures the SSH public key exists.

Parameters:
  • name – The name of the SSH public key.
  • resource_group – The name of the resource group name assigned to the SSH public key.
  • public_key – SSH public key used to authenticate to a virtual machine through ssh. If this property is not initially provided when the resource is created, the public_key parameter will be populated when the generate_key_pair module is called. If the public key is provided upon resource creation, the provided public key needs to be at least 2048-bit and in ssh-rsa format.
  • generate_key_pair – A boolean flag specifying whether or not to generate a public/private key pair to populates the SSH public key resource with the public key. The length of the key will be 3072 bits. This may only be done if the SSH public key resource does not already have a public key associated with it. Defaults to False. This parameter can not be specified at the same time as the public_key parameter.
  • tags – A dictionary of strings can be passed as tag metadata to the SSH public key resource object.
  • connection_auth – A dict with subscription and authentication parameters to be used in connecting to the Azure Resource Manager API.

Example usage:

Ensure SSH Public Key exists:
    azurerm.compute.ssh_public_key.present:
        - name: test_key
        - resource_group: test_group
        - tags:
            contact_name: Elmer Fudd Gantry