ansible / ansible.builtin / v2.5.12 / module / elb_classic_lb Creates or destroys Amazon ELB. | "added in version" 1.5 of ansible.builtin" Authors: Jim Dalton (@jsdalton) preview | supported by certifiedansible.builtin.elb_classic_lb (v2.5.12) — module
pip
Install with pip install ansible==2.5.12
Returns information about the load balancer.
Will be marked changed when called only if state is changed.
# Note: None of these examples set aws_access_key, aws_secret_key, or region. # It is assumed that their matching environment variables are set. # Basic provisioning example (non-VPC) - elb_classic_lb: name: "test-please-delete" state: present zones: - us-east-1a - us-east-1d listeners: - protocol: http # options are http, https, ssl, tcp load_balancer_port: 80 instance_port: 80 proxy_protocol: True - protocol: https load_balancer_port: 443 instance_protocol: http # optional, defaults to value of protocol setting instance_port: 80 # ssl certificate required for https or ssl ssl_certificate_id: "arn:aws:iam::123456789012:server-certificate/company/servercerts/ProdServerCert" delegate_to: localhost
# Internal ELB example - elb_classic_lb: name: "test-vpc" scheme: internal state: present instance_ids: - i-abcd1234 purge_instance_ids: true subnets: - subnet-abcd1234 - subnet-1a2b3c4d listeners: - protocol: http # options are http, https, ssl, tcp load_balancer_port: 80 instance_port: 80 delegate_to: localhost
# Configure a health check and the access logs - elb_classic_lb: name: "test-please-delete" state: present zones: - us-east-1d listeners: - protocol: http load_balancer_port: 80 instance_port: 80 health_check: ping_protocol: http # options are http, https, ssl, tcp ping_port: 80 ping_path: "/index.html" # not required for tcp or ssl response_timeout: 5 # seconds interval: 30 # seconds unhealthy_threshold: 2 healthy_threshold: 10 access_logs: interval: 5 # minutes (defaults to 60) s3_location: "my-bucket" # This value is required if access_logs is set s3_prefix: "logs" delegate_to: localhost
# Ensure ELB is gone - elb_classic_lb: name: "test-please-delete" state: absent delegate_to: localhost
# Ensure ELB is gone and wait for check (for default timeout) - elb_classic_lb: name: "test-please-delete" state: absent wait: yes delegate_to: localhost
# Ensure ELB is gone and wait for check with timeout value - elb_classic_lb: name: "test-please-delete" state: absent wait: yes wait_timeout: 600 delegate_to: localhost
# Normally, this module will purge any listeners that exist on the ELB # but aren't specified in the listeners parameter. If purge_listeners is # false it leaves them alone - elb_classic_lb: name: "test-please-delete" state: present zones: - us-east-1a - us-east-1d listeners: - protocol: http load_balancer_port: 80 instance_port: 80 purge_listeners: no delegate_to: localhost
# Normally, this module will leave availability zones that are enabled # on the ELB alone. If purge_zones is true, then any extraneous zones # will be removed - elb_classic_lb: name: "test-please-delete" state: present zones: - us-east-1a - us-east-1d listeners: - protocol: http load_balancer_port: 80 instance_port: 80 purge_zones: yes delegate_to: localhost
# Creates a ELB and assigns a list of subnets to it. - elb_classic_lb: state: present name: 'New ELB' security_group_ids: 'sg-123456, sg-67890' region: us-west-2 subnets: 'subnet-123456,subnet-67890' purge_subnets: yes listeners: - protocol: http load_balancer_port: 80 instance_port: 80 delegate_to: localhost
# Create an ELB with connection draining, increased idle timeout and cross availability # zone load balancing - elb_classic_lb: name: "New ELB" state: present connection_draining_timeout: 60 idle_timeout: 300 cross_az_load_balancing: "yes" region: us-east-1 zones: - us-east-1a - us-east-1d listeners: - protocol: http load_balancer_port: 80 instance_port: 80 delegate_to: localhost
# Create an ELB with load balancer stickiness enabled - elb_classic_lb: name: "New ELB" state: present region: us-east-1 zones: - us-east-1a - us-east-1d listeners: - protocol: http load_balancer_port: 80 instance_port: 80 stickiness: type: loadbalancer enabled: yes expiration: 300 delegate_to: localhost
# Create an ELB with application stickiness enabled - elb_classic_lb: name: "New ELB" state: present region: us-east-1 zones: - us-east-1a - us-east-1d listeners: - protocol: http load_balancer_port: 80 instance_port: 80 stickiness: type: application enabled: yes cookie: SESSIONID delegate_to: localhost
# Create an ELB and add tags - elb_classic_lb: name: "New ELB" state: present region: us-east-1 zones: - us-east-1a - us-east-1d listeners: - protocol: http load_balancer_port: 80 instance_port: 80 tags: Name: "New ELB" stack: "production" client: "Bob" delegate_to: localhost
# Delete all tags from an ELB - elb_classic_lb: name: "New ELB" state: present region: us-east-1 zones: - us-east-1a - us-east-1d listeners: - protocol: http load_balancer_port: 80 instance_port: 80 tags: {} delegate_to: localhost
name: description: - The name of the ELB required: true tags: description: - An associative array of tags. To delete all tags, supply an empty dict. required: false version_added: '2.1' version_added_collection: ansible.builtin wait: choices: - 'yes' - 'no' default: false description: - When specified, Ansible will check the status of the load balancer to ensure it has been successfully removed from AWS. required: false version_added: '2.1' version_added_collection: ansible.builtin state: choices: - present - absent description: - Create or destroy the ELB required: true zones: description: - List of availability zones to enable on this ELB required: false region: aliases: - aws_region - ec2_region description: - The AWS region to use. - For global services such as IAM, Route53 and CloudFront, I(region) is ignored. - The C(AWS_REGION) or C(EC2_REGION) environment variables may also be used. - See the Amazon AWS documentation for more information U(http://docs.aws.amazon.com/general/latest/gr/rande.html#ec2_region). - The C(ec2_region) alias has been deprecated and will be removed in a release after 2024-12-01 - Support for the C(EC2_REGION) environment variable has been deprecated and will be removed in a release after 2024-12-01. type: str scheme: choices: - internal - internet-facing default: internet-facing description: - The scheme to use when creating the ELB. For a private VPC-visible ELB use 'internal'. If you choose to update your scheme with a different value the ELB will be destroyed and recreated. To update scheme you must use the option wait. required: false version_added: '1.7' version_added_collection: ansible.builtin profile: aliases: - aws_profile description: - A named AWS profile to use for authentication. - See the AWS documentation for more information about named profiles U(https://docs.aws.amazon.com/cli/latest/userguide/cli-configure-profiles.html). - The C(AWS_PROFILE) environment variable may also be used. - The I(profile) option is mutually exclusive with the I(aws_access_key), I(aws_secret_key) and I(security_token) options. type: str subnets: aliases: [] default: None description: - A list of VPC subnets to use when creating ELB. Zones should be empty if using this. required: false version_added: '1.7' version_added_collection: ansible.builtin listeners: description: - List of ports/protocols for this ELB to listen on (see example) required: false access_key: aliases: - aws_access_key_id - aws_access_key - ec2_access_key description: - AWS access key ID. - See the AWS documentation for more information about access tokens U(https://docs.aws.amazon.com/general/latest/gr/aws-sec-cred-types.html#access-keys-and-secret-access-keys). - The C(AWS_ACCESS_KEY_ID), C(AWS_ACCESS_KEY) or C(EC2_ACCESS_KEY) environment variables may also be used in decreasing order of preference. - The I(aws_access_key) and I(profile) options are mutually exclusive. - The I(aws_access_key_id) alias was added in release 5.1.0 for consistency with the AWS botocore SDK. - The I(ec2_access_key) alias has been deprecated and will be removed in a release after 2024-12-01. - Support for the C(EC2_ACCESS_KEY) environment variable has been deprecated and will be removed in a release after 2024-12-01. type: str aws_config: description: - A dictionary to modify the botocore configuration. - Parameters can be found in the AWS documentation U(https://botocore.amazonaws.com/v1/documentation/api/latest/reference/config.html#botocore.config.Config). type: dict secret_key: aliases: - aws_secret_access_key - aws_secret_key - ec2_secret_key description: - AWS secret access key. - See the AWS documentation for more information about access tokens U(https://docs.aws.amazon.com/general/latest/gr/aws-sec-cred-types.html#access-keys-and-secret-access-keys). - The C(AWS_SECRET_ACCESS_KEY), C(AWS_SECRET_KEY), or C(EC2_SECRET_KEY) environment variables may also be used in decreasing order of preference. - The I(secret_key) and I(profile) options are mutually exclusive. - The I(aws_secret_access_key) alias was added in release 5.1.0 for consistency with the AWS botocore SDK. - The I(ec2_secret_key) alias has been deprecated and will be removed in a release after 2024-12-01. - Support for the C(EC2_SECRET_KEY) environment variable has been deprecated and will be removed in a release after 2024-12-01. type: str stickiness: description: - An associative array of stickiness policy settings. Policy will be applied to all listeners ( see example ) required: false version_added: '2.0' version_added_collection: ansible.builtin access_logs: default: None description: - An associative array of access logs configuration settings (see example) required: false version_added: '2.0' version_added_collection: ansible.builtin purge_zones: default: false description: - Purge existing availability zones on ELB that are not found in zones required: false endpoint_url: aliases: - ec2_url - aws_endpoint_url - s3_url description: - URL to connect to instead of the default AWS endpoints. While this can be used to connection to other AWS-compatible services the amazon.aws and community.aws collections are only tested against AWS. - The C(AWS_URL) or C(EC2_URL) environment variables may also be used, in decreasing order of preference. - The I(ec2_url) and I(s3_url) aliases have been deprecated and will be removed in a release after 2024-12-01. - Support for the C(EC2_URL) environment variable has been deprecated and will be removed in a release after 2024-12-01. type: str health_check: default: None description: - An associative array of health check configuration settings (see example) required: false idle_timeout: description: - ELB connections from clients and to servers are timed out after this amount of time required: false version_added: '2.0' version_added_collection: ansible.builtin instance_ids: default: false description: - List of instance ids to attach to this ELB required: false version_added: '2.1' version_added_collection: ansible.builtin wait_timeout: default: 60 description: - Used in conjunction with wait. Number of seconds to wait for the elb to be terminated. A maximum of 600 seconds (10 minutes) is allowed. required: false version_added: '2.1' version_added_collection: ansible.builtin aws_ca_bundle: description: - The location of a CA Bundle to use when validating SSL certificates. - The C(AWS_CA_BUNDLE) environment variable may also be used. type: path purge_subnets: default: false description: - Purge existing subnet on ELB that are not found in subnets required: false version_added: '1.7' version_added_collection: ansible.builtin session_token: aliases: - aws_session_token - security_token - aws_security_token - access_token description: - AWS STS session token for use with temporary credentials. - See the AWS documentation for more information about access tokens U(https://docs.aws.amazon.com/general/latest/gr/aws-sec-cred-types.html#access-keys-and-secret-access-keys). - The C(AWS_SESSION_TOKEN), C(AWS_SECURITY_TOKEN) or C(EC2_SECURITY_TOKEN) environment variables may also be used in decreasing order of preference. - The I(security_token) and I(profile) options are mutually exclusive. - Aliases I(aws_session_token) and I(session_token) were added in release 3.2.0, with the parameter being renamed from I(security_token) to I(session_token) in release 6.0.0. - The I(security_token), I(aws_security_token), and I(access_token) aliases have been deprecated and will be removed in a release after 2024-12-01. - Support for the C(EC2_SECRET_KEY) and C(AWS_SECURITY_TOKEN) environment variables has been deprecated and will be removed in a release after 2024-12-01. type: str validate_certs: aliases: [] choices: - 'yes' - 'no' default: 'yes' description: - When set to "no", SSL certificates will not be validated for boto versions >= 2.6.0. required: false type: bool version_added: '1.5' version_added_collection: ansible.builtin purge_listeners: default: true description: - Purge existing listeners on ELB that are not found in listeners required: false purge_instance_ids: default: false description: - Purge existing instance ids on ELB that are not found in instance_ids required: false version_added: '2.1' version_added_collection: ansible.builtin security_group_ids: default: None description: - A list of security groups to apply to the elb required: false version_added: '1.6' version_added_collection: ansible.builtin security_group_names: default: None description: - A list of security group names to apply to the elb required: false version_added: '2.0' version_added_collection: ansible.builtin cross_az_load_balancing: aliases: [] choices: - 'yes' - 'no' default: 'no' description: - Distribute load across all configured Availability Zones required: false version_added: '1.8' version_added_collection: ansible.builtin connection_draining_timeout: aliases: [] description: - Wait a specified timeout allowing connections to drain before terminating an instance required: false version_added: '1.8' version_added_collection: ansible.builtin debug_botocore_endpoint_logs: default: false description: - Use a C(botocore.endpoint) logger to parse the unique (rather than total) C("resource:action") API calls made during a task, outputing the set to the resource_actions key in the task results. Use the C(aws_resource_action) callback to output to total list made during a playbook. - The C(ANSIBLE_DEBUG_BOTOCORE_LOGS) environment variable may also be used. type: bool