我想使用load balancer
向ecs service
模块添加ansible
。因此,我正在使用以下代码:
- name: create ECS service on VPC network
ecs_service:
state: present
name: console-test-service
cluster: new_cluster
desired_count: 0
network_configuration:
subnets:
- subnet-abcd1234
security_groups:
- sg-aaaa1111
- my_security_group
现在,我想使用load_balancers
参数添加负载均衡器。但是,这是负载平衡器列表。如何添加要定义的负载均衡器名称列表?
例如:
load_balancers:
- name_of_my_load_balancer
返回以下错误:
提高 ParamValidationError(report = report.generate_report())\ nbotocore.exceptions.ParamValidationError: 参数验证失败:\ n参数类型无效 loadBalancers [0],值:name_of_my_load_balancer,类型:,有效 类型:\ n“
答案 0 :(得分:1)
它需要一个包含目标组ARN,容器名称和容器端口的字典。
- name: create ECS service on VPC network
ecs_service:
state: present
name: console-test-service
cluster: new_cluster
desired_count: 0
load_balancers:
- targetGroupArn: arn:aws:elasticloadbalancing:eu-west-1:453157221:targetgroup/tg/16331647320e8a42
containerName: laravel
containerPort: 80
network_configuration:
subnets:
- subnet-abcd1234
security_groups:
- sg-aaaa1111
- my_security_group