[英]How to add load balancer to aws ecs service with ansible
我想使用ansible
將load balancer
添加到ecs service
模塊。 因此,我使用以下代碼:
- 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"
它需要一個包含目標組 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
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.