New in version 2.4.
parameter | required | default | choices | comments |
---|---|---|---|---|
aws_access_key | no | AWS access key. If not set then the value of the AWS_ACCESS_KEY_ID, AWS_ACCESS_KEY or EC2_ACCESS_KEY environment variable is used. aliases: ec2_access_key, access_key | ||
aws_secret_key | no | AWS secret key. If not set then the value of the AWS_SECRET_ACCESS_KEY, AWS_SECRET_KEY, or EC2_SECRET_KEY environment variable is used. aliases: ec2_secret_key, secret_key | ||
deregistration_delay_timeout | no | The amount time for Elastic Load Balancing to wait before changing the state of a deregistering target from draining to unused. The range is 0-3600 seconds. | ||
ec2_url | no | Url to use to connect to EC2 or your Eucalyptus cloud (by default the module will use EC2 endpoints). Ignored for modules where region is required. Must be specified for all other modules if region is not used. If not set then the value of the EC2_URL environment variable, if any, is used. | ||
health_check_interval | no | The approximate amount of time, in seconds, between health checks of an individual target. | ||
health_check_path | no | The ping path that is the destination on the targets for health checks. The path must be defined in order to set a health check. | ||
health_check_port | no | The port on which each target receives traffic from the load balancer. | The port the load balancer uses when performing health checks on targets. | |
health_check_protocol | no |
| The protocol the load balancer uses when performing health checks on targets. | |
health_check_timeout | no | The amount of time, in seconds, during which no response from a target means a failed health check. | ||
healthy_threshold_count | no | The number of consecutive health checks successes required before considering an unhealthy target healthy. | ||
modify_targets | no | True | Whether or not to alter existing targets in the group to match what is passed with the module | |
name | yes | The name of the target group. | ||
port | no | The port on which the targets receive traffic. This port is used unless you specify a port override when registering the target. Required if state is present . | ||
profile (added in 1.6)
| no | Uses a boto profile. Only works with boto >= 2.24.0. | ||
protocol | no |
| The protocol to use for routing traffic to the targets. Required when state is present . | |
purge_tags | no | True |
| If yes, existing tags will be purged from the resource to match exactly what is defined by tags parameter. If the tag parameter is not set then tags will not be modified. |
region | no | The AWS region to use. If not specified then the value of the AWS_REGION or EC2_REGION environment variable, if any, is used. See http://docs.aws.amazon.com/general/latest/gr/rande.html#ec2_region
aliases: aws_region, ec2_region | ||
security_token (added in 1.6)
| no | AWS STS security token. If not set then the value of the AWS_SECURITY_TOKEN or EC2_SECURITY_TOKEN environment variable is used. aliases: access_token | ||
state | yes |
| Create or destroy the target group. | |
stickiness_enabled | no |
| Indicates whether sticky sessions are enabled. | |
stickiness_lb_cookie_duration | no | The time period, in seconds, during which requests from a client should be routed to the same target. After this time period expires, the load balancer-generated cookie is considered stale. The range is 1 second to 1 week (604800 seconds). | ||
stickiness_type | no | lb_cookie | The type of sticky sessions. The possible value is lb_cookie. | |
successful_response_codes | no | The HTTP codes to use when checking for a successful response from a target. You can specify multiple values (for example, "200,202") or a range of values (for example, "200-299"). | ||
tags | no | A dictionary of one or more tags to assign to the target group. | ||
targets | no | A list of targets to assign to the target group. This parameter defaults to an empty list. Unless you set the 'modify_targets' parameter then all existing targets will be removed from the group. The list should be an Id and a Port parameter. See the Examples for detail. | ||
unhealthy_threshold_count | no | The number of consecutive health check failures required before considering a target unhealthy. | ||
validate_certs (added in 1.5)
| no | yes |
| When set to "no", SSL certificates will not be validated for boto versions >= 2.6.0. |
vpc_id | no | The identifier of the virtual private cloud (VPC). Required when state is present . |
# Note: These examples do not set authentication details, see the AWS Guide for details. # Create a target group with a default health check - elb_target_group: name: mytargetgroup protocol: http port: 80 vpc_id: vpc-01234567 state: present # Modify the target group with a custom health check - elb_target_group: name: mytargetgroup protocol: http port: 80 vpc_id: vpc-01234567 health_check_path: / successful_response_codes: "200, 250-260" state: present # Delete a target group - elb_target_group: name: mytargetgroup state: absent # Create a target group with targets - elb_target_group: name: mytargetgroup protocol: http port: 81 vpc_id: vpc-01234567 health_check_path: / successful_response_codes: "200,250-260" targets: - Id: i-01234567 Port: 80 - Id: i-98765432 Port: 80 state: present wait_timeout: 200 wait: True
Common return values are documented here Return Values, the following are the fields unique to this module:
name | description | returned | type | sample |
---|---|---|---|---|
protocol | The protocol to use for routing traffic to the targets. | when state present | string | HTTP |
tags | The tags attached to the target group. | when state present | dict | { 'Tag': 'Example' } |
matcher | The HTTP codes to use when checking for a successful response from a target. | when state present | dict | {'http_code': '200'} |
health_check_port | The port to use to connect with the target. | when state present | string | traffic-port |
target_group_name | The name of the target group. | when state present | string | mytargetgroup |
target_group_arn | The Amazon Resource Name (ARN) of the target group. | when state present | string | arn:aws:elasticloadbalancing:ap-southeast-2:01234567890:targetgroup/mytargetgroup/aabbccddee0044332211 |
deregistration_delay_timeout_seconds | The amount time for Elastic Load Balancing to wait before changing the state of a deregistering target from draining to unused. | when state present | int | 300 |
healthy_threshold_count | The number of consecutive health checks successes required before considering an unhealthy target healthy. | when state present | int | 5 |
port | The port on which the targets are listening. | when state present | int | 80 |
load_balancer_arns | The Amazon Resource Names (ARN) of the load balancers that route traffic to this target group. | when state present | list | [] |
health_check_protocol | The protocol to use to connect with the target. | when state present | string | HTTP |
unhealthy_threshold_count | The number of consecutive health check failures required before considering the target unhealthy. | when state present | int | 2 |
stickiness_type | The type of sticky sessions. | when state present | string | lb_cookie |
health_check_timeout_seconds | The amount of time, in seconds, during which no response means a failed health check. | when state present | int | 5 |
stickiness_lb_cookie_duration_seconds | The time period, in seconds, during which requests from a client should be routed to the same target. | when state present | int | 86400 |
stickiness_enabled | Indicates whether sticky sessions are enabled. | when state present | bool | True |
health_check_path | The destination for the health check request. | when state present | string | /index.html |
vpc_id | The ID of the VPC for the targets. | when state present | string | vpc-0123456 |
health_check_interval_seconds | The approximate amount of time, in seconds, between health checks of an individual target. | when state present | int | 30 |
Note
AWS_URL
or EC2_URL
, AWS_ACCESS_KEY_ID
or AWS_ACCESS_KEY
or EC2_ACCESS_KEY
, AWS_SECRET_ACCESS_KEY
or AWS_SECRET_KEY
or EC2_SECRET_KEY
, AWS_SECURITY_TOKEN
or EC2_SECURITY_TOKEN
, AWS_REGION
or EC2_REGION
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 fileThis module is flagged as preview which means that it is not guaranteed to have a backwards compatible interface.
For help in developing on modules, should you be so inclined, please read Community Information & Contributing, Testing Ansible and Developing Modules.
© 2012–2017 Michael DeHaan
© 2017 Red Hat, Inc.
Licensed under the GNU General Public License version 3.
https://docs.ansible.com/ansible/latest/elb_target_group_module.html