azure.azcollection.azure_rm_loadbalancer (2.3.0) — module

Manage Azure load balancers

| "added in version" 0.1.2 of azure.azcollection"

Authors: Thomas Stringer (@trstringer), Yuwei Zhou (@yuwzho)

Install collection

Install with ansible-galaxy collection install azure.azcollection:==2.3.0


Add to requirements.yml

  collections:
    - name: azure.azcollection
      version: 2.3.0

Description

Create, update and delete Azure load balancers.


Requirements

Usage examples

  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: create load balancer
  azure_rm_loadbalancer:
    resource_group: myResourceGroup
    name: testloadbalancer1
    frontend_ip_configurations:
      - name: frontendipconf0
        public_ip_address: testpip
    backend_address_pools:
      - name: backendaddrpool0
    probes:
      - name: prob0
        port: 80
    inbound_nat_pools:
      - name: inboundnatpool0
        frontend_ip_configuration_name: frontendipconf0
        protocol: Tcp
        frontend_port_range_start: 80
        frontend_port_range_end: 81
        backend_port: 8080
    load_balancing_rules:
      - name: lbrbalancingrule0
        frontend_ip_configuration: frontendipconf0
        backend_address_pool: backendaddrpool0
        frontend_port: 80
        backend_port: 80
        probe: prob0
    inbound_nat_rules:
      - name: inboundnatrule0
        backend_port: 8080
        protocol: Tcp
        frontend_port: 8080
        frontend_ip_configuration: frontendipconf0

Inputs

    
sku:
    choices:
    - Basic
    - Standard
    description:
    - The load balancer SKU.
    type: str

name:
    description:
    - Name of the load balancer.
    required: true
    type: str

tags:
    description:
    - Dictionary of string:string pairs to assign as metadata to the object.
    - Metadata tags on the object will be updated with any provided values.
    - To remove tags set append_tags option to false.
    - Currently, Azure DNS zones and Traffic Manager services also don't allow the use
      of spaces in the tag.
    - Azure Front Door doesn't support the use of
    - Azure Automation and Azure CDN only support 15 tags on resources.
    type: dict

state:
    choices:
    - absent
    - present
    default: present
    description:
    - Assert the state of the load balancer. Use C(present) to create/update a load balancer,
      or C(absent) to delete one.
    type: str

probes:
    description:
    - List of probe definitions used to check endpoint health.
    elements: dict
    suboptions:
      fail_count:
        aliases:
        - number_of_probes
        default: 3
        description:
        - The number of probes where if no response, will result in stopping further traffic
          from being delivered to the endpoint.
        - This values allows endpoints to be taken out of rotation faster or slower than
          the typical times used in Azure.
        type: int
      interval:
        default: 15
        description:
        - The interval, in seconds, for how frequently to probe the endpoint for health
          status.
        - Slightly less than half the allocated timeout period, which allows two full
          probes before taking the instance out of rotation.
        - The default value is C(15), the minimum value is C(5).
        type: int
      name:
        description:
        - Name of the probe.
        required: true
        type: str
      port:
        description:
        - Probe port for communicating the probe. Possible values range from 1 to 65535,
          inclusive.
        required: true
        type: int
      protocol:
        choices:
        - Tcp
        - Http
        - Https
        description:
        - The protocol of the end point to be probed.
        - If C(Tcp) is specified, a received ACK is required for the probe to be successful.
        - If C(Http) or C(Https) is specified, a 200 OK response from the specified URL
          is required for the probe to be successful.
        type: str
      request_path:
        description:
        - The URI used for requesting health status from the VM.
        - Path is required if I(protocol=Http) or I(protocol=Https). Otherwise, it is
          not allowed.
        type: str
    type: list

secret:
    description:
    - Azure client secret. Use when authenticating with a Service Principal.
    type: str

tenant:
    description:
    - Azure tenant ID. Use when authenticating with a Service Principal.
    type: str

ad_user:
    description:
    - Active Directory username. Use when authenticating with an Active Directory user
      rather than service principal.
    type: str

profile:
    description:
    - Security profile found in ~/.azure/credentials file.
    type: str

location:
    description:
    - Valid Azure location. Defaults to location of the resource group.
    type: str

log_mode:
    description:
    - Parent argument.
    type: str

log_path:
    description:
    - Parent argument.
    type: str

password:
    description:
    - Active Directory user password. Use when authenticating with an Active Directory
      user rather than service principal.
    type: str

protocol:
    choices:
    - Tcp
    - Udp
    description:
    - (deprecated) The protocol (TCP or UDP) that the load balancer will use.
    - This option has been deprecated, and will be removed in 2.9. Use I(load_balancing_rules)
      instead.
    type: str

client_id:
    description:
    - Azure client ID. Use when authenticating with a Service Principal or Managed Identity
      (msi).
    - Can also be set via the C(AZURE_CLIENT_ID) environment variable.
    type: str

probe_port:
    description:
    - (deprecated) The port that the health probe will use.
    - This option has been deprecated, and will be removed in 2.9. Use I(probes) instead.
    type: int

thumbprint:
    description:
    - The thumbprint of the private key specified in I(x509_certificate_path).
    - Use when authenticating with a Service Principal.
    - Required if I(x509_certificate_path) is defined.
    type: str
    version_added: 1.14.0
    version_added_collection: azure.azcollection

api_profile:
    default: latest
    description:
    - Selects an API profile to use when communicating with Azure services. Default value
      of C(latest) is appropriate for public clouds; future values will allow use with
      Azure Stack.
    type: str
    version_added: 0.0.1
    version_added_collection: azure.azcollection

append_tags:
    default: true
    description:
    - Use to control if tags field is canonical or just appends to existing tags.
    - When canonical, any tags not found in the tags parameter will be removed from the
      object's metadata.
    type: bool

auth_source:
    choices:
    - auto
    - cli
    - credential_file
    - env
    - msi
    default: auto
    description:
    - Controls the source of the credentials to use for authentication.
    - Can also be set via the C(ANSIBLE_AZURE_AUTH_SOURCE) environment variable.
    - When set to C(auto) (the default) the precedence is module parameters -> C(env)
      -> C(credential_file) -> C(cli).
    - When set to C(env), the credentials will be read from the environment variables
    - When set to C(credential_file), it will read the profile from C(~/.azure/credentials).
    - When set to C(cli), the credentials will be sources from the Azure CLI profile.
      C(subscription_id) or the environment variable C(AZURE_SUBSCRIPTION_ID) can be used
      to identify the subscription ID if more than one is present otherwise the default
      az cli subscription is used.
    - When set to C(msi), the host machine must be an azure resource with an enabled MSI
      extension. C(subscription_id) or the environment variable C(AZURE_SUBSCRIPTION_ID)
      can be used to identify the subscription ID if the resource is granted access to
      more than one subscription, otherwise the first subscription is chosen.
    - The C(msi) was added in Ansible 2.6.
    type: str
    version_added: 0.0.1
    version_added_collection: azure.azcollection

backend_port:
    description:
    - (deprecated) Backend port that will be exposed for the load balancer.
    - This option has been deprecated, and will be removed in 2.9. Use I(load_balancing_rules)
      instead.
    type: int

idle_timeout:
    default: 4
    description:
    - (deprecated) Timeout for TCP idle connection in minutes.
    - This option has been deprecated, and will be removed in 2.9. Use I(load_balancing_rules)
      instead.
    type: int

frontend_port:
    description:
    - (deprecated) Frontend port that will be exposed for the load balancer.
    - This option has been deprecated, and will be removed in 2.9. Use I(load_balancing_rules)
      instead.
    type: int

probe_interval:
    default: 15
    description:
    - (deprecated) Time (in seconds) between endpoint health probes.
    - This option has been deprecated, and will be removed in 2.9. Use I(probes) instead.
    type: int

probe_protocol:
    choices:
    - Tcp
    - Http
    - Https
    description:
    - (deprecated) The protocol to use for the health probe.
    - This option has been deprecated, and will be removed in 2.9. Use I(probes) instead.
    type: str

resource_group:
    description:
    - Name of a resource group where the load balancer exists or will be created.
    required: true
    type: str

subscription_id:
    description:
    - Your Azure subscription Id.
    type: str

natpool_protocol:
    description:
    - (deprecated) The protocol for the NAT pool.
    - This option has been deprecated, and will be removed in 2.9. Use I(inbound_nat_pools)
      instead.
    type: str

probe_fail_count:
    default: 3
    description:
    - (deprecated) The amount of probe failures for the load balancer to make a health
      determination.
    - This option has been deprecated, and will be removed in 2.9. Use I(probes) instead.
    type: int

cloud_environment:
    default: AzureCloud
    description:
    - For cloud environments other than the US public cloud, the environment name (as
      defined by Azure Python SDK, eg, C(AzureChinaCloud), C(AzureUSGovernment)), or a
      metadata discovery endpoint URL (required for Azure Stack). Can also be set via
      credential file profile or the C(AZURE_CLOUD_ENVIRONMENT) environment variable.
    type: str
    version_added: 0.0.1
    version_added_collection: azure.azcollection

inbound_nat_pools:
    description:
    - Defines an external port range for inbound NAT to a single backend port on NICs
      associated with a load balancer.
    - Inbound NAT rules are created automatically for each NIC associated with the Load
      Balancer using an external port from this range.
    - Defining an Inbound NAT pool on your Load Balancer is mutually exclusive with defining
      inbound Nat rules.
    - Inbound NAT pools are referenced from virtual machine scale sets.
    - NICs that are associated with individual virtual machines cannot reference an inbound
      NAT pool.
    - They have to reference individual inbound NAT rules.
    elements: dict
    suboptions:
      backend_port:
        description:
        - The port used for internal connections on the endpoint.
        - Acceptable values are between 1 and 65535.
        required: true
        type: int
      frontend_ip_configuration_name:
        description:
        - A reference to frontend IP addresses.
        required: true
        type: str
      frontend_port_range_end:
        description:
        - The last port in the range of external ports that will be used to provide inbound
          NAT to NICs associated with the load balancer.
        - Acceptable values range between 1 and 65535.
        required: true
        type: int
      frontend_port_range_start:
        description:
        - The first port in the range of external ports that will be used to provide inbound
          NAT to NICs associated with the load balancer.
        - Acceptable values range between 1 and 65534.
        required: true
        type: int
      name:
        description:
        - Name of the inbound NAT pool.
        required: true
        type: str
      protocol:
        choices:
        - Tcp
        - Udp
        - All
        description:
        - IP protocol for the NAT pool.
        type: str
    type: list

inbound_nat_rules:
    description:
    - Collection of inbound NAT Rules used by a load balancer.
    - Defining inbound NAT rules on your load balancer is mutually exclusive with defining
      an inbound NAT pool.
    - Inbound NAT pools are referenced from virtual machine scale sets.
    - NICs that are associated with individual virtual machines cannot reference an Inbound
      NAT pool.
    - They have to reference individual inbound NAT rules.
    elements: dict
    suboptions:
      backend_port:
        description:
        - The port used for internal connections on the endpoint.
        - Acceptable values are between 0 and 65535.
        - Note that value 0 enables "Any Port".
        required: true
        type: int
      enable_floating_ip:
        description:
        - Configures a virtual machine's endpoint for the floating IP capability required
          to configure a SQL AlwaysOn Availability Group.
        - This setting is required when using the SQL AlwaysOn Availability Groups in
          SQL server.
        - This setting can't be changed after you create the endpoint.
        type: bool
      enable_tcp_reset:
        description:
        - Receive bidirectional TCP Reset on TCP flow idle timeout or unexpected connection
          termination.
        - This element is only used when I(protocol=Tcp).
        type: bool
      frontend_ip_configuration:
        description:
        - A reference to frontend IP addresses.
        required: true
        type: str
      frontend_port:
        description:
        - The port for the external endpoint.
        - Frontend port numbers must be unique across all rules within the load balancer.
        - Acceptable values are between 0 and 65534.
        - Note that value 0 enables "Any Port".
        required: true
        type: int
      idle_timeout:
        description:
        - The timeout for the TCP idle connection.
        - The value can be set between 4 and 30 minutes.
        - The default value is C(4) minutes.
        - This element is only used when I(protocol=Tcp).
        type: int
      name:
        description:
        - name of the inbound nat rule.
        required: true
        type: str
      protocol:
        choices:
        - Tcp
        - Udp
        - All
        description:
        - IP protocol for the inbound nat rule.
        type: str
    type: list

load_distribution:
    choices:
    - Default
    - SourceIP
    - SourceIPProtocol
    description:
    - (deprecated) The type of load distribution that the load balancer will employ.
    - This option has been deprecated, and will be removed in 2.9. Use I(load_balancing_rules)
      instead.
    type: str

adfs_authority_url:
    description:
    - Azure AD authority url. Use when authenticating with Username/password, and has
      your own ADFS authority.
    type: str
    version_added: 0.0.1
    version_added_collection: azure.azcollection

probe_request_path:
    description:
    - (deprecated) The URL that an HTTP probe or HTTPS probe will use (only relevant if
      I(probe_protocol=Http) or I(probe_protocol=Https)).
    - This option has been deprecated, and will be removed in 2.9. Use I(probes) instead.
    type: str

cert_validation_mode:
    choices:
    - ignore
    - validate
    description:
    - Controls the certificate validation behavior for Azure endpoints. By default, all
      modules will validate the server certificate, but when an HTTPS proxy is in use,
      or against Azure Stack, it may be necessary to disable this behavior by passing
      C(ignore). Can also be set via credential file profile or the C(AZURE_CERT_VALIDATION)
      environment variable.
    type: str
    version_added: 0.0.1
    version_added_collection: azure.azcollection

load_balancing_rules:
    description:
    - Object collection representing the load balancing rules Gets the provisioning.
    elements: dict
    suboptions:
      backend_address_pool:
        description:
        - A reference to a pool of DIPs. Inbound traffic is randomly load balanced across
          IPs in the backend IPs.
        required: true
        type: str
      backend_port:
        description:
        - The port used for internal connections on the endpoint.
        - Acceptable values are between 0 and 65535.
        - Note that value 0 enables "Any Port".
        type: int
      disable_outbound_snat:
        default: false
        description:
        - Configure outbound source network address translation (SNAT).
        - The default behavior when omitted is equivalent to I(disable_outbound_snat=True).
        - True is equivalent to "(Recommended) Use outbound rules to provide backend pool
          members access to the internet" in portal.
        - False is equivalent to "Use default outbound access" in portal.
        type: bool
      enable_floating_ip:
        description:
        - Configures a virtual machine's endpoint for the floating IP capability required
          to configure a SQL AlwaysOn Availability Group.
        type: bool
      frontend_ip_configuration:
        description:
        - A reference to frontend IP addresses.
        required: true
        type: str
      frontend_port:
        description:
        - The port for the external endpoint.
        - Frontend port numbers must be unique across all rules within the load balancer.
        - Acceptable values are between 0 and 65534.
        - Note that value 0 enables "Any Port".
        required: true
        type: int
      idle_timeout:
        default: 4
        description:
        - The timeout for the TCP idle connection.
        - The value can be set between 4 and 30 minutes.
        - The default value is C(4) minutes.
        - This element is only used when the protocol is set to TCP.
        type: int
      load_distribution:
        choices:
        - Default
        - SourceIP
        - SourceIPProtocol
        default: Default
        description:
        - The session persistence policy for this rule; C(Default) is no persistence.
        type: str
      name:
        description:
        - Name of the load balancing rule.
        required: true
        type: str
      probe:
        description:
        - The name of the load balancer probe this rule should use for health checks.
        required: true
        type: str
      protocol:
        choices:
        - Tcp
        - Udp
        - All
        description:
        - IP protocol for the load balancing rule.
        type: str
    type: list

natpool_backend_port:
    description:
    - (deprecated) Backend port used by the NAT pool.
    - This option has been deprecated, and will be removed in 2.9. Use I(inbound_nat_pools)
      instead.
    type: int

backend_address_pools:
    description:
    - List of backend address pools.
    elements: dict
    suboptions:
      name:
        description:
        - Name of the backend address pool.
        required: true
        type: str
    type: list

x509_certificate_path:
    description:
    - Path to the X509 certificate used to create the service principal in PEM format.
    - The certificate must be appended to the private key.
    - Use when authenticating with a Service Principal.
    type: path
    version_added: 1.14.0
    version_added_collection: azure.azcollection

public_ip_address_name:
    aliases:
    - public_ip_address
    - public_ip_name
    - public_ip
    description:
    - (deprecated) Name of an existing public IP address object to associate with the
      security group.
    - This option has been deprecated, and will be removed in 2.9. Use I(frontend_ip_configurations)
      instead.
    type: str

natpool_frontend_port_end:
    description:
    - (deprecated) End of the port range for a NAT pool.
    - This option has been deprecated, and will be removed in 2.9. Use I(inbound_nat_pools)
      instead.
    type: int

disable_instance_discovery:
    default: false
    description:
    - Determines whether or not instance discovery is performed when attempting to authenticate.
      Setting this to true will completely disable both instance discovery and authority
      validation. This functionality is intended for use in scenarios where the metadata
      endpoint cannot be reached such as in private clouds or Azure Stack. The process
      of instance discovery entails retrieving authority metadata from https://login.microsoft.com/
      to validate the authority. By setting this to **True**, the validation of the authority
      is disabled. As a result, it is crucial to ensure that the configured authority
      host is valid and trustworthy.
    - Set via credential file profile or the C(AZURE_DISABLE_INSTANCE_DISCOVERY) environment
      variable.
    type: bool
    version_added: 2.3.0
    version_added_collection: azure.azcollection

frontend_ip_configurations:
    description:
    - List of frontend IPs to be used.
    elements: dict
    suboptions:
      name:
        description:
        - Name of the frontend ip configuration.
        required: true
        type: str
      private_ip_address:
        description:
        - The reference of the Public IP resource.
        type: str
      private_ip_allocation_method:
        choices:
        - Static
        - Dynamic
        description:
        - The Private IP allocation method.
        type: str
      public_ip_address:
        description:
        - Name of an existing public IP address object in the current resource group to
          associate with the security group.
        type: str
      subnet:
        description:
        - The reference of the subnet resource.
        - Should be an existing subnet's resource id.
        type: str
      zones:
        description:
        - list of availability zones denoting the IP allocated for the resource needs
          to come from.
        - This must be specified I(sku=Standard) and I(subnet) when setting zones.
        elements: str
        type: list
    type: list

natpool_frontend_port_start:
    description:
    - (deprecated) Start of the port range for a NAT pool.
    - This option has been deprecated, and will be removed in 2.9. Use I(inbound_nat_pools)
      instead.
    type: int

Outputs

changed:
  description:
  - Whether or not the resource has changed.
  returned: always
  type: bool
state:
  description:
  - Current state of the load balancer.
  returned: always
  type: dict

See also