ec2_elb_lb - Creates or destroys Amazon ELB. - Returns information about the load balancer. - Will be marked changed when called only if state is changed.

Author:Jim Dalton

Synopsis

New in version 1.5.

C r e a t e s

o r

d e s t r o y s

A m a z o n

E L B .

Options

parameter required default choices comments
aws_access_key no
    AWS access key. If not set then the value of the AWS_ACCESS_KEY environment variable is used.
    aws_secret_key no
      AWS secret key. If not set then the value of the AWS_SECRET_KEY environment variable is used.
      ec2_url no
        Url to use to connect to EC2 or your Eucalyptus cloud (by default the module will use EC2 endpoints). Must be specified if region is not used. If not set then the value of the EC2_URL environment variable, if any, is used
        health_check no None
          An associative array of health check configuration settigs (see example)
          listeners no
            List of ports/protocols for this ELB to listen on (see example)
            name yes
              The name of the ELB
              profile no
                uses a boto profile. Only works with boto >= 2.24.0 (added in Ansible 1.6)
                purge_listeners no True
                  Purge existing listeners on ELB that are not found in listeners
                  purge_subnets no
                    Purge existing subnet on ELB that are not found in subnets (added in Ansible 1.7)
                    purge_zones no
                      Purge existing availability zones on ELB that are not found in zones
                      region no
                        The AWS region to use. If not specified then the value of the EC2_REGION environment variable, if any, is used.
                        scheme no internet-facing
                          The scheme to use when creating the ELB. For a private VPC-visible ELB use 'internal'. (added in Ansible 1.7)
                          security_group_ids no None
                            A list of security groups to apply to the elb (added in Ansible 1.6)
                            security_token no
                              security token to authenticate against AWS (added in Ansible 1.6)
                              state yes
                                Create or destroy the ELB
                                subnets no None
                                  A list of VPC subnets to use when creating ELB. Zones should be empty if using this. (added in Ansible 1.7)
                                  validate_certs no yes
                                  • yes
                                  • no
                                  When set to "no", SSL certificates will not be validated for boto versions >= 2.6.0. (added in Ansible 1.5)
                                  zones no
                                    List of availability zones to enable on this ELB

                                    Note

                                    Requires boto

                                    Examples


                                    # 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
                                    - local_action:
                                        module: ec2_elb_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
                                          - 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"
                                    
                                    
                                    # Basic VPC provisioning example
                                    - local_action:
                                        module: ec2_elb_lb
                                        name: "test-vpc"
                                        scheme: internal
                                        state: present
                                        subnets:
                                          - subnet-abcd1234
                                          - subnet-1a2b3c4d
                                        listeners:
                                          - protocol: http # options are http, https, ssl, tcp
                                            load_balancer_port: 80
                                            instance_port: 80
                                    
                                    # Configure a health check
                                    - local_action:
                                        module: ec2_elb_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
                                    
                                    # Ensure ELB is gone
                                    - local_action:
                                        module: ec2_elb_lb
                                        name: "test-please-delete"
                                        state: absent
                                    
                                    # 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
                                    - local_action:
                                        module: ec2_elb_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
                                    
                                    # Normally, this module will leave availability zones that are enabled
                                    # on the ELB alone. If purge_zones is true, then any extreneous zones
                                    # will be removed
                                    - local_action:
                                        module: ec2_elb_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
                                    
                                    # Creates a ELB and assigns a list of subnets to it.
                                    - local_action:
                                        module: ec2_elb_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
                                    

                                    Note

                                    The following environment variables can be used AWS_ACCESS_KEY or EC2_ACCESS_KEY or AWS_ACCESS_KEY_ID, AWS_SECRET_KEY or EC2_SECRET_KEY or AWS_SECRET_ACCESS_KEY, AWS_REGION or EC2_REGION, AWS_SECURITY_TOKEN

                                    Note

                                    Ansible uses the boto configuration file (typically ~/.boto) if no credentials are provided. See http://boto.readthedocs.org/en/latest/boto_config_tut.html

                                    Note

                                    AWS_REGION or EC2_REGION can be typically be used to specify the AWS region, when required, but this can also be configured in the boto config file